program alquerque;
{ Pascal example framework player, written by Willem van der Vegt }
var line: string; {input from standard input }
I_am_white: boolean; { true if player is white }
White_to_move: boolean; {who is to play? true menas white is }
Moves_played: integer; {number of played moves }
number: array[boolean] of integer; { number of pieces on the board }
{ TODO rest of the needed variables }
procedure initALQ;
{ initialize gameboard and variables }
begin
{ TODO }
Moves_played:=0; { number of moves played }
White_to_move:=true; { first move for white }
number[true]:=24;
number[false]:=24;
end;
function capture(s: string): boolean; { is the move in string s a captue ? }
begin
capture:=pos('*',s)>0
end;
procedure Do_move(s: string; p: boolean);
{ execute move, change gameboard and White_to_move, count moves }
begin
if capture(s) then
begin
{ TODO }
end else
begin
{ TODO }
end;
White_to_move:=not White_to_move;
if White_to_move then inc(Moves_played)
end;
function Still_playing: boolean;
{ are we still playing? }
begin
{ TODO }
end;
procedure Find_move(p: boolean);
{ find a move for the program-player }
begin
{ TODO }
end;
procedure Present_move;
{ present the move of the program-player }
begin
writeln(line);
flush(output)
end;
procedure End_game;
{ exit when game is aborted }
begin
halt
end;
begin
initALQ;
readln(line);
if line='Start' then I_am_white:=true else
begin
I_am_white:=false;
Do_move(line,White_to_move)
end;
while Still_playing do
begin
Find_move(I_am_white);
Present_move;
Do_move(line,White_to_move);
if Still_playing then
begin
readln(line);
if line='Quit' then End_game else Do_move(line,White_to_move)
end
end
end.
syntax highlighted by Code2HTML, v. 0.9.1