HOME
|
DD
All
Tag
Groups
Search!
Fresh-Grass
— N-Queens on NxM board
Published:
2010-08-22 12:35:35 +0000 UTC
; Views:
629
; Favourites:
0
; Downloads:
0
Redirect to original
Description
8 queens is common chess problem, the task is to place 8 queens on standard 8x8 chessboard without queens attacking each other. This program accepts any size of the board (NxM).
Rather than using a 2D array (matrix), all necessary data (x-coordinates of attacked squares) is stored in 1D array.
The values in the array are modified in each row:
elements at n*3 are decremented by 1
element at n*3+1 are left unchanged
elements at n*3+2 are incremented by 1
The code in 3 different languages:
C++
[link]
C#
[link]
Java
[link]
Related content
Fresh-Grass - I drew a guy on a wall...
Fresh-Grass - Rubik's Cube
Fresh-Grass - Dynamix: uTorrent
Fresh-Grass - Dynamix Aero
Fresh-Grass - Alligator Calculator v1.4
Fresh-Grass - Dynamix: Gmail
Fresh-Grass - Moduko
Fresh-Grass - Knight's Tour
Fresh-Grass - Testing out 'mouth tool'
LuiH64 - Look what I found!
Lobbomorro - Trazo malvado
dudeman1990 - Flash and Real Hands Animation
Prof-JR-Blake - (OLD) LEGO VHS Cassette Player
Rahiden - TC72: Mischief Managed
MrWinter25 - animation test
JoeMcGro - Door Guy
captaincrunch1950 - pulling a noob out
kazaki03 - DIY Padlock (DHMIS)
Comments:
0