This is the doxygen documentation for gtkboard.
.
#include <stdio.h>
#include <glib.h>
Go to the source code of this file.
Defines | |
#define | byte gint8 |
Functions | |
byte* | movdup (byte *) |
Make a copy of the move. More... | |
gboolean | movcmp_literal (byte *move1, byte *move2) |
Compares two moves byte by byte. Literal not semantic comparison. Returns TRUE if the moves are equal. | |
int | movcpy (byte *dest, byte *src) |
Makes the move src to the move dest. More... | |
byte* | mov_getinv (byte *, byte *) |
Returns the inverse of a move in the given board. More... | |
void | move_apply (byte *, byte *) |
Applies the move to the board. | |
void | move_fwrite (byte *, FILE *) |
Writes a move to the pipe in human friendly format. | |
byte* | move_read (char *) |
Parses a string into a move. | |
byte* | move_fread (FILE *) |
Reads a move from the pipe. | |
byte* | move_fread_ack (FILE *) |
Same as move_fread(), except it expects the stream to begin with "ACK ". Returns NULL otherwise. | |
char* | line_read (FILE *) |
Reads a line from the stream. | |
void | move_fwrite_ack (byte *, FILE *) |
Same as move_fwrite(), but precedes line with "ACK ". | |
void | move_fwrite_nak (char *, FILE *) |
Writes "NAK " followed by arbitrary error message. | |
byte* | movlist_next (byte *) |
Returns the next move in a movlist. More... |
A move is an array of byte
s, which are simply gint8
s. A move is a sequence of movelets terminated by -1. A movelet is a sequence of 3 bytes which describes what happens to a particular square in the board. Movelet format is "x y val" where val is the new value of the square (x, y). Thus the move corresponding to "1. e4" in chess is "4 1 0 4 3 6 -1" (i.e, square (4, 0), which means e2 becomes empty, and square (4, 3), which is e4, becomes 6, assuming that white pawn is represented by 6. Note that row and col numbers start from 0.) When the move is written to file or sent to the engine, it will be converted to a human friendly format.
Definition in file move.h.
|
|
|
Reads a line from the stream.
Definition at line 153 of file move.c. Referenced by ui_check_who_won(). |
|
Returns the inverse of a move in the given board. The move format does not specify the old value of the squares. So it is not possible to go from the new Pos to the old Pos. To be able to do this we need to get the "inverse" of the move using the current board Definition at line 171 of file move.c. Referenced by ab_with_tt_incr(), and movstack_push(). |
|
Compares two moves byte by byte. Literal not semantic comparison. Returns TRUE if the moves are equal.
Definition at line 44 of file move.c. Referenced by ab_with_tt(). |
|
Makes the move src to the move dest. Memory is assumed to have already been allocated for dest. Definition at line 35 of file move.c. Referenced by ab_dfid(), ab_with_tt(), and ab_with_tt_incr(). |
|
Make a copy of the move. The new move is malloc()d and so must be free()d by the caller. Definition at line 160 of file move.c. Referenced by ab_with_tt(), hash_insert(), mov_getinv(), and movstack_push(). |
|
Applies the move to the board.
Definition at line 63 of file move.c. Referenced by ab_with_tt(), ab_with_tt_incr(), engine_back_move(), engine_forw_move(), engine_make_move(), engine_take_move(), and leads_to_check(). |
|
Reads a move from the pipe.
Definition at line 138 of file move.c. Referenced by ui_get_machine_move(). |
|
Same as move_fread(), except it expects the stream to begin with "ACK ". Returns NULL otherwise.
Definition at line 144 of file move.c. Referenced by menu_back_forw(), and ui_get_machine_move(). |
|
Writes a move to the pipe in human friendly format.
Definition at line 76 of file move.c. Referenced by ab_dfid(), move_fwrite_ack(), ui_get_machine_move(), and ui_make_human_move(). |
|
Same as move_fwrite(), but precedes line with "ACK ".
Definition at line 92 of file move.c. Referenced by engine_back_move(), engine_forw_move(), and engine_make_move(). |
|
Writes "NAK " followed by arbitrary error message.
Definition at line 98 of file move.c. Referenced by engine_back_move(), engine_forw_move(), engine_make_move(), and engine_who_won(). |
|
Parses a string into a move.
Definition at line 107 of file move.c. Referenced by engine_take_move(), move_fread(), and move_fread_ack(). |
|
Returns the next move in a movlist.
A movlist is also an array of Definition at line 56 of file move.c. Referenced by ab_dfid(), ab_with_tt(), and ab_with_tt_incr(). |