HEX
Hex is played on a board made up of hexagons.
The board itself is shaped like a rhombus .

The actual
board size is
14*14
for
AI Wars competition.
Rules of the game
One player uses the blue pieces, the
other player the green pieces. Both players in turn put one of
their pieces on an empty field on the board.
Game opens with a turn from the blue player. For a pair of
opponents, each player will get a chance to be blue pieces
owner. Hence there will be two games
played between any two opponents each getting a chance to own
blue pieces.(This is to compensate for any advantage a player
may get for making the
opening move of the game.)
Goal of the game
The goal is to make a chain in your own color between
opposite sides of the board. For player with blue pieces, goal
is to make a connected chain (not necessarily in a straight line
but in any order) between left end and right end of the board.
Similarly player with green pieces will battle to make a
connected chain between top end and bottom end of the board.
In fig (1) below, player with green pieces has
won.

fig (1)
In fig (2) below , player with blue pieces has won.

Other Rules:
1) Participants will have to write strictly a 'C' code (put in
all logic and strategy you can think of to win the game in this
code).
2) HEX board is represented as a 2D array.
For any cell board [row] [column],

left adjacent cell = board[row][column -1]
right adjacent cell =
board[row][column +1]
top left adjacent cell =
board[row -1 ][column]
top right adjacent cell =
board[row -1 ][column+1]
bottom left adjacent cell
= board[row +1 ][column-1]
bottom right adjacent
cell = board[row +1 ][column]
3)
The code should have
no main function.
4) It should contain a
function whose
name
is
same as that of the file (which is your team name also).
(Game engine will be calling only this function from your
code).
5) The prototype of the above mentioned function should be :
void <function_name> (int pass[][14],
int color , int temp[2]);
pass is the 2D array representing the board.
color is the piece color that you own.
(In the pass matrix 0-Empty,1-First player,2-Second
player).
6) X-coordinate of the move should be stored
in temp[0] .
Y-coordinate of the move should be stored in temp[1] .
( ex : If your move is first row , first column cell , then
temp[0] = 0 and temp[1] = 0
If your move
is fifth row , third column cell , then temp[0] = 4 and temp[1]
= 2 )
If the player returns an invalid move (one that is already occupied
or out of board range), he will not get a chance to correct the
invalid move.
7)Prefix all other functions (excluding function with name same
as that of file) in the code with the your team name_ . (<team
name>_<function name>).
8)Do not use the black , white , empty , blue , green as macro
names in your code.
In game engine macros used are :
blue 1
green 2
empty 0
9)Game engines can be downloaded from the links:
Dev Cpp :
1.
http://www.bloodshed.net/dev/devcpp.html
2.http://www.4shared.com/file/58378130/f11a7dd3/devcpp-4992_setup.html
Game engine without GUI :
1.http://mind-spark.org/EVENTPAGES/download/No GUI.zip
2.http://www.4shared.com/file/58503226/b05ceff2/No_GUI.html
Game engine with GUI :
1.http://mind-spark.org/EVENTPAGES/download/WITH GUI.zip
2.http://www.4shared.com/file/58503322/b6f341dc/WITH_GUI.html
PS : Read User Manual before starting.
Important Rule:
Participants will have to send a scanned copy of their valid college I-card along with their code at aiwars@mind-spark.org or
aiwars.mindspark@gmail.com.
If it is not possible to send it along with the code, participants will have to send it in case they win the competition, to receive the prize money.
Failing to do so , the winning participant will have no right to claim the prize and the next runner up will be declared as the winner.