Knight's tour: Difference between revisions

Content added Content deleted
(added literal autohotkey)
(→‎{{header|AutoHotkey}}: fix onexit, move win code)
Line 260: Line 260:
#NoEnv
#NoEnv
SetBatchLines, -1
SetBatchLines, -1
OnExit, Exit
; Uncomment if Gdip.ahk is not in your standard library
; Uncomment if Gdip.ahk is not in your standard library
;#Include, Gdip.ahk
;#Include, Gdip.ahk
Line 273: Line 272:
ExitApp
ExitApp
}
}
OnExit, Exit
tour := "a1 b3 d2 c4 a5 b7 d8 e6 d4 b5 c7 a8 b6 c8 a7 c6 b8 a6 b4 d5 e3 d1 b2 a4 c5 d7 f8 h7 f6 g8 h6 f7 h8 g6 e7 f5 h4 g2 e1 d3 e5 g4 f2 h1 g3 f1 h2 f3 g1 h3 g5 e4 d6 e8 g7 h5 f4 e2 c1 a2 c3 b1 a3 c2 "
tour := "a1 b3 d2 c4 a5 b7 d8 e6 d4 b5 c7 a8 b6 c8 a7 c6 b8 a6 b4 d5 e3 d1 b2 a4 c5 d7 f8 h7 f6 g8 h6 f7 h8 g6 e7 f5 h4 g2 e1 d3 e5 g4 f2 h1 g3 f1 h2 f3 g1 h3 g5 e4 d6 e8 g7 h5 f4 e2 c1 a2 c3 b1 a3 c2 "
; Knight's tour with maximum symmetry by George Jelliss, http://www.mayhematics.com/t/8f.htm
; Knight's tour with maximum symmetry by George Jelliss, http://www.mayhematics.com/t/8f.htm
Line 297: Line 297:
Gui, Show, NA ; show board (currently transparent)
Gui, Show, NA ; show board (currently transparent)
hwnd1 := WinExist() ; required for Gdip
hwnd1 := WinExist() ; required for Gdip
OnMessage(0x201, "WM_LBUTTONDOWN")
, hbm := CreateDIBSection(Width, Height)
, hbm := CreateDIBSection(Width, Height)
, hdc := CreateCompatibleDC()
, hdc := CreateCompatibleDC()
Line 345: Line 346:
Exit:
Exit:
Gdip_Shutdown(pToken)
Gdip_Shutdown(pToken)
ExitApp</lang>
ExitApp

WM_LBUTTONDOWN()
{
If (A_Gui = 1)
PostMessage, 0xA1, 2
}</lang>
{{out}}
{{out}}
For start at b3
For start at b3