AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Scripting Challenges
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat
View previous topic :: View next topic  
Author Message
Ian



Joined: 15 Jul 2007
Posts: 1157
Location: Enterprise, Alabama

PostPosted: Mon Jun 09, 2008 6:20 pm    Post subject: Scripting Challenges Reply with quote

Todays challenge: Click the button.

Scripting Challenge 1:

Code:
Gui +LastFoundExist
x := (250 - 75) / 2
y := (250 - 30) / 2
MyGuiHWND := WinExist("A")
Gui, Add, Button, x%x% y%y% w75 h20 -Theme vAI HwndMyButton1HWND gWin -Default, Click this
Gui, Show, w250 h250, Click the button!
OnMessage( 0x200, "M" )
Return

#IfWinactive, Click the button!
Tab::
Up::
Down::
Left::
Right::
Return
#IfWinActive

Win:
MsgBox, You got it!
Return

M() {
  MouseGetPos,,,, CID
  If ( CID = "Button1" ) {
    Random, x, 25, 150
    Random, y, 0, 220
    GuiControl, Movedraw, AI, x%x% y%y%
}}


Made by SKAN, Modified by Zed Gecko, then me for this.

The challenge is simple, just click the button and post your solution (Without taking out the functions or modifying them). You may not use any form of automation for this either.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Scripting Challenge 2:

Code:
Gui, Add, Text  , x10 y10 w50              , Password:
Gui, Add, Edit  , x60 y10 w160 vX +Password
Gui, Add, Button, x10 y40 w210 gSubmit     , Submit
Gui, Show, w230, Scripting Challenge 2
Return

Submit:
Gui, Submit, NoHide
Loop, Parse, X
   Num += Ceil((Asc(A_LoopField) * 50) / 37)
If (Mod(Mod((Num * 1000) / 433, 4), 5) = "1.182448")
   MsgBox, 48, Congrulations!, You got it!
Num := ""


The only thing is you cannot in any way change the label "submit". Just find the password.
_________________
ScriptPad/~dieom/dieom/izwian2k7/Trikster/God



Last edited by Ian on Tue Jun 10, 2008 12:23 am; edited 5 times in total
Back to top
View user's profile Send private message
300W



Joined: 12 Jan 2008
Posts: 27

PostPosted: Mon Jun 09, 2008 6:29 pm    Post subject: Reply with quote

I asked you and you said that it is allowed to add more lines outside functions...

so here's my solution:

Code:
Gui +LastFoundExist
x := (250 - 75) / 2
y := (250 - 30) / 2
MyGuiHWND := WinExist("A")
Gui, Add, Button
Gui, Add, Button, x%x% y%y% w75 h20 -Theme vAI HwndMyButton1HWND gWin -Default, Click this
Gui, Show, w250 h250, Click the button!
OnMessage( 0x200, "M" )
Return

#IfWinactive, Click the button!
Tab::
Up::
Down::
Left::
Right::
Return
#IfWinActive

Win:
MsgBox, You got it!
Return

M() {
  MouseGetPos,,,, CID
  If ( CID = "Button1" ) {
    Random, x, 25, 150
    Random, y, 0, 220
    GuiControl, Movedraw, AI, x%x% y%y%
}}


easy...

and an alternative solution (just push Alt+C):

Code:
Gui +LastFoundExist
x := (250 - 75) / 2
y := (250 - 30) / 2
MyGuiHWND := WinExist("A")
Gui, Add, Button, x%x% y%y% w75 h20 -Theme vAI HwndMyButton1HWND gWin -Default, $Click this
Gui, Show, w250 h250, Click the button!
OnMessage( 0x200, "M" )
Return

#IfWinactive, Click the button!
Tab::
Up::
Down::
Left::
Right::
Return
#IfWinActive

Win:
MsgBox, You got it!
Return

M() {
  MouseGetPos,,,, CID
  If ( CID = "Button1" ) {
    Random, x, 25, 150
    Random, y, 0, 220
    GuiControl, Movedraw, AI, x%x% y%y%
}}



My friend's solution:

Alt+tab into the program, use spacebar/enter


Last edited by 300W on Mon Jun 09, 2008 6:38 pm; edited 2 times in total
Back to top
View user's profile Send private message
Ian



Joined: 15 Jul 2007
Posts: 1157
Location: Enterprise, Alabama

PostPosted: Mon Jun 09, 2008 6:31 pm    Post subject: Reply with quote

Excellent, give me a few moments to think up one.
_________________
ScriptPad/~dieom/dieom/izwian2k7/Trikster/God

Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 722
Location: Florida

PostPosted: Mon Jun 09, 2008 6:36 pm    Post subject: Reply with quote

I just pressed space...
_________________
[Join IRC!]
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1354

PostPosted: Mon Jun 09, 2008 11:37 pm    Post subject: Reply with quote

Right click the tray icon to show the context menu, then click the button (single threaded ahk ftw! Razz )
Back to top
View user's profile Send private message
Ian



Joined: 15 Jul 2007
Posts: 1157
Location: Enterprise, Alabama

PostPosted: Mon Jun 09, 2008 11:59 pm    Post subject: Reply with quote

New challenge up, everyone try it.
_________________
ScriptPad/~dieom/dieom/izwian2k7/Trikster/God

Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1128

PostPosted: Tue Jun 10, 2008 7:57 am    Post subject: Reply with quote

Ian wrote:
New challenge up, everyone try it.

Got it:
SPOILER: Password wrote:
l

_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
Hao
Guest





PostPosted: Fri Jun 27, 2008 10:26 pm    Post subject: Reply with quote

Hey, sorry for resurrecting this old thread, but does anyone have a solution to the 2nd challenge? [VxE] got it but I can't read his solution...
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Sat Jun 28, 2008 1:55 am    Post subject: Reply with quote

Hao wrote:
Hey, sorry for resurrecting this old thread, but does anyone have a solution to the 2nd challenge? [VxE] got it but I can't read his solution...
Run this then paste the answer into the password box Wink .
Code:
Loop, 128
  ascii .= Chr(A_Index)

Loop, parse, ascii
{
   Num += Ceil((Asc(A_LoopField) * 50) / 37)
   If (Mod(Mod((Num * 1000) / 433, 4), 5) = "1.182448") {
     MsgBox, 48,, The password is: %A_LoopField%
     clipboard = %A_LoopField%
     Return
   }
Num := ""
}
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Sat Jun 28, 2008 2:42 am    Post subject: Reply with quote

challenge 2b ?
Code:
Gui, Add, Text  , x10 y10 w50              , Password:
Gui, Add, Edit  , x60 y10 w160 vX +Password
Gui, Add, Button, x10 y40 w210 gSubmit     , Submit
Gui, Show, w230, Scripting Challenge 2
Return

Submit:
Gui, Submit, NoHide
Loop, Parse, X
   Num += Ceil((Asc(A_LoopField) * 50) / 37)
If (Mod(Mod((Num * 1000) / 433, 4), 5) = "2.983834")
   MsgBox, 48, Congrulations!, You got it!
Else
   MsgBox, 16, Nice try, Incorrect
Num := ""
Return

GuiClose:
ExitApp
Back to top
View user's profile Send private message Visit poster's website
Hao
Guest





PostPosted: Sat Jun 28, 2008 3:41 am    Post subject: Reply with quote

corrupt wrote:
Hao wrote:
Hey, sorry for resurrecting this old thread, but does anyone have a solution to the 2nd challenge? [VxE] got it but I can't read his solution...
Run this then paste the answer into the password box Wink .
Code:
Loop, 128
  ascii .= Chr(A_Index)

Loop, parse, ascii
{
   Num += Ceil((Asc(A_LoopField) * 50) / 37)
   If (Mod(Mod((Num * 1000) / 433, 4), 5) = "1.182448") {
     MsgBox, 48,, The password is: %A_LoopField%
     clipboard = %A_LoopField%
     Return
   }
Num := ""
}


Thanks, but isn't that like brute forcing? btw I know that the correct password is hawk (even though "l" seems to work fine), but what I were looking for was that if there is a way, that you could simply reverse that... so that you simply enter "1.182448" and then it reverses to the actual text... as if it was executing all those functions in reverse, I tried to do that but I can't figure it out... :S am I talking about something impossible here?

tried your challenge, seemed like it wasn't within the 128 first ascii characters so I kinda raised it to 512...

"Ù" was my solution
Back to top
Slanter



Joined: 28 May 2008
Posts: 267
Location: Minnesota, USA

PostPosted: Sat Jun 28, 2008 4:19 am    Post subject: Reply with quote

I don't think you can reverse it because I'm pretty sure there's no way to reliably reverse the mod() function. The reason for this is that the mod function can be represented like this
Code:
x = any number
y = any number
if (y > (x/2) && y < x)
   mod(x, y) = x - y
else if (y > x)
   mod(x, y) = x
else
   mod(x, y) = x - y*(x//y)
meaning that mod(50,45) is equal to mod(35,30)... there are literally an infinite number of ways to get "1.182448".

Edit: that last else looks wrong... oh well, I think I made my point Razz
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Sat Jun 28, 2008 4:31 am    Post subject: Reply with quote

Hao wrote:
tried your challenge, seemed like it wasn't within the 128 first ascii characters so I kinda raised it to 512...

"Ù" was my solution
Interesting. I suspected that alternate answers were possible with the encryption/decryption method used. The password is intended to be goodluck
Back to top
View user's profile Send private message Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2397

PostPosted: Sat Jun 28, 2008 4:33 am    Post subject: Reply with quote

Hao wrote:
Thanks, but isn't that like brute forcing?
Yep Smile
Back to top
View user's profile Send private message Visit poster's website
Hao
Guest





PostPosted: Sat Jun 28, 2008 4:40 am    Post subject: Reply with quote

OK, thanks for the reply, but would it be possible to do this if there never were any mod functions involved?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group