This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

towers.c File Reference

#include <stdio.h>
#include <assert.h>
#include "game.h"

Go to the source code of this file.

Defines

#define TOWERS_CELL_SIZE   16
#define TOWERS_NUM_PIECES   3
#define TOWERS_TOWER_WID   17
#define TOWERS_BOARD_WID   (3 * TOWERS_TOWER_WID)
#define TOWERS_BOARD_HEIT   18
#define TOWERS_EMPTY   0
#define TOWERS_POLE   1
#define TOWERS_RING_TOP   2
#define TOWERS_RING_BOT   3
#define TOWERS_RING_MID   3
#define TOWERS_RING_LEFT   4
#define TOWERS_RING_RIGHT   5
#define POLE_ROW(x)   (((x)/TOWERS_TOWER_WID)*TOWERS_TOWER_WID+TOWERS_TOWER_WID/2)

Functions

void towers_init ()
int towers_getmove (Pos *, int, int, GtkboardEventType, Player, byte **, int **)
ResultType towers_who_won (Pos *, Player, char **)
void towers_reset_uistate ()
void towers_get_render (Pos *pos, byte *move, int **rmovp)
gboolean towers_over (byte *board)
void get_top_ring (byte *board, int row, int *heit, int *len)

Variables

char towers_colors [6] = {150, 150, 150, 150, 150, 150}
char* pole_16_16_xpm []
char* ring_top_16_16_xpm []
char* ring_bot_16_16_xpm []
char** towers_pixmaps []
int towers_init_pos []
Game Towers
SCORE_FIELD towers_score_fields [] = {SCORE_FIELD_RANK, SCORE_FIELD_USER, SCORE_FIELD_SCORE, SCORE_FIELD_TIME, SCORE_FIELD_DATE, SCORE_FIELD_NONE}
char* towers_score_field_names [] = {"Rank", "User", "Moves", "Time", "Date", NULL}
int cur_row = -1


Define Documentation

#define POLE_ROW( x )   (((x)/TOWERS_TOWER_WID)*TOWERS_TOWER_WID+TOWERS_TOWER_WID/2)
 

Definition at line 198 of file towers.c.

Referenced by get_top_ring(), and towers_getmove().

#define TOWERS_BOARD_HEIT   18
 

Definition at line 29 of file towers.c.

#define TOWERS_BOARD_WID   (3 * TOWERS_TOWER_WID)
 

Definition at line 28 of file towers.c.

#define TOWERS_CELL_SIZE   16
 

Definition at line 24 of file towers.c.

#define TOWERS_EMPTY   0
 

Definition at line 31 of file towers.c.

#define TOWERS_NUM_PIECES   3
 

Definition at line 25 of file towers.c.

#define TOWERS_POLE   1
 

Definition at line 32 of file towers.c.

#define TOWERS_RING_BOT   3
 

Definition at line 34 of file towers.c.

#define TOWERS_RING_LEFT   4
 

Definition at line 36 of file towers.c.

#define TOWERS_RING_MID   3
 

Definition at line 35 of file towers.c.

#define TOWERS_RING_RIGHT   5
 

Definition at line 37 of file towers.c.

#define TOWERS_RING_TOP   2
 

Definition at line 33 of file towers.c.

#define TOWERS_TOWER_WID   17
 

Definition at line 27 of file towers.c.


Function Documentation

void get_top_ring ( byte * board,
int row,
int * heit,
int * len ) [static]
 

Definition at line 201 of file towers.c.

Referenced by towers_getmove().

void towers_get_render ( Pos * pos,
byte * move,
int ** rmovp )
 

Definition at line 302 of file towers.c.

int towers_getmove ( Pos * pos,
int x,
int y,
GtkboardEventType type,
Player to_play,
byte ** movp,
int ** rmovep ) [static]
 

Definition at line 222 of file towers.c.

void towers_init ( )
 

Definition at line 158 of file towers.c.

gboolean towers_over ( byte * board ) [static]
 

Definition at line 179 of file towers.c.

Referenced by towers_who_won().

void towers_reset_uistate ( )
 

Definition at line 297 of file towers.c.

ResultType towers_who_won ( Pos * pos,
Player to_play,
char ** commp ) [static]
 

Definition at line 185 of file towers.c.


Variable Documentation

Game Towers
 

Initial value:

 { TOWERS_CELL_SIZE, TOWERS_BOARD_WID, TOWERS_BOARD_HEIT, 
        TOWERS_NUM_PIECES, 
        towers_colors, towers_init_pos, towers_pixmaps, 
        "Tower of Hanoi", 
        towers_init}

Definition at line 144 of file towers.c.

int cur_row = -1 [static]
 

Definition at line 196 of file towers.c.

char* pole_16_16_xpm[] [static]
 

Initial value:

 {
"16 16 5 1",
"1 c #AAAA66",
"2 c #999955",
"3 c #888844",
"4 c #80803b",
"5 c #777733",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
"5433221111223345",
}

Definition at line 41 of file towers.c.

char* ring_bot_16_16_xpm[] [static]
 

Initial value:

 {
"16 16 2 1",
"  c #cccc99",
". c #aaaa77",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"................",
"................",
}

Definition at line 89 of file towers.c.

char* ring_top_16_16_xpm[] [static]
 

Initial value:

 {
"16 16 2 1",
"  c #cccc99",
". c #aaaa77",
"................",
"................",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
"                ",
}

Definition at line 67 of file towers.c.

char towers_colors[6] = {150, 150, 150, 150, 150, 150}
 

Definition at line 39 of file towers.c.

int towers_init_pos[] [static]
 

Initial value:

 
{
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  
        0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,  
        0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,  
        0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,  
}

Definition at line 119 of file towers.c.

char** towers_pixmaps[] [static]
 

Initial value:

{
        pole_16_16_xpm,
        ring_top_16_16_xpm,
        ring_bot_16_16_xpm,
}

Definition at line 112 of file towers.c.

char* towers_score_field_names[] = {"Rank", "User", "Moves", "Time", "Date", NULL}
 

Definition at line 151 of file towers.c.

SCORE_FIELD towers_score_fields[] = {SCORE_FIELD_RANK, SCORE_FIELD_USER, SCORE_FIELD_SCORE, SCORE_FIELD_TIME, SCORE_FIELD_DATE, SCORE_FIELD_NONE}
 

Definition at line 150 of file towers.c.