HOME
|
DD
All
Tag
Groups
Search!
Fresh-Grass
— Knight's Tour
Published:
2010-08-22 11:55:54 +0000 UTC
; Views:
393
; Favourites:
0
; Downloads:
0
Redirect to original
Description
Knight's Tour is common chess problem, the task is to find a route for knight through all squares on the board by making a move to each square only once.
I've seen quite a few people write the algorithm for knight's movement ("L-move") with if statements or something similar, but it can be done more efficiently with mathematical formula.
My formula for knights movement:
i= (0,1); j= (0,1); k= (1,2)
x movement: k*(i*2-1)
y movement: (k-3)*(j*2-1)
The algorithm for "Knight's Tour" with user interface in 3 different languages:
C++:
[link]
C#:
[link]
Java:
[link]
User can define board size (NxM) and starting position.
Related content
Fresh-Grass - I drew a guy on a wall...
Fresh-Grass - Rubik's Cube
Fresh-Grass - Dynamix: uTorrent
Fresh-Grass - Alligator Calculator v1.4
Fresh-Grass - Dynamix Aero
Fresh-Grass - Dynamix: Gmail
Fresh-Grass - Moduko
Fresh-Grass - N-Queens on NxM board
Fresh-Grass - Run from IT collab: my part
LuiH64 - Look what I found!
HufflepuffBatboy - Project Emily - Body Building
MrWinter25 - animation test
Lobbomorro - Trazo malvado
dudeman1990 - Flash and Real Hands Animation
JennyRichardBlakina - LEGO VHS Cassette Player
LouBrication - stick figures
fire-mage-shinoharu - Paperchildren Kyofu and Kyoki
Rahiden - TC72: Mischief Managed
Comments:
0