This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

kttour.c File Reference

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include "game.h"
#include "aaball.h"
#include "../pixmaps/chess.xpm"
#include "../pixmaps/misc.xpm"

Go to the source code of this file.

Defines

#define KTTOUR_CELL_SIZE   54
#define KTTOUR_NUM_PIECES   4
#define KTTOUR_BOARD_WID   8
#define KTTOUR_BOARD_HEIT   8
#define KTTOUR_EMPTY   0
#define KTTOUR_CUR   1
#define KTTOUR_START   2
#define KTTOUR_USED   3
#define KTTOUR_HINT   4
#define abs(x)   ((x)<0?-(x):(x))
#define IS_FREE(x)   ((x) == KTTOUR_EMPTY || (x) == KTTOUR_HINT)

Functions

void kttour_init ()
int kttour_getmove (Pos *, int, int, GtkboardEventType, Player, byte **, int **)
ResultType kttour_who_won (Pos *, Player, char **)
char** kttour_get_pixmap (int, int)
gboolean are_nbrs (int x1, int y1, int x2, int y2)
void find_xy (byte *board, int *x, int *y, int val)
int get_degree (byte *board, int i, int j)
int get_min_degree (byte *board, int i, int j)
void add_hints (byte *board, int new_x, int new_y, byte **mp)

Variables

char kttour_colors [6] = {200, 200, 160, 200, 200, 160}
Game Kttour
SCORE_FIELD kttour_score_fields [] = {SCORE_FIELD_RANK, SCORE_FIELD_USER, SCORE_FIELD_TIME, SCORE_FIELD_DATE, SCORE_FIELD_NONE}
char* kttour_score_field_names [] = {"Rank", "User", "Time", "Date", NULL}
int incx [] = {-2, -2, -1, -1, 1, 1, 2, 2}
int incy [] = {-1, 1, -2, 2, -2, 2, -1, 1}


Define Documentation

#define IS_FREE( x )   ((x) == KTTOUR_EMPTY || (x) == KTTOUR_HINT)
 

Definition at line 156 of file kttour.c.

Referenced by get_degree(), and get_min_degree().

#define KTTOUR_BOARD_HEIT   8
 

Definition at line 34 of file kttour.c.

#define KTTOUR_BOARD_WID   8
 

Definition at line 33 of file kttour.c.

#define KTTOUR_CELL_SIZE   54
 

Definition at line 30 of file kttour.c.

#define KTTOUR_CUR   1
 

Definition at line 37 of file kttour.c.

#define KTTOUR_EMPTY   0
 

Definition at line 36 of file kttour.c.

#define KTTOUR_HINT   4
 

Definition at line 40 of file kttour.c.

#define KTTOUR_NUM_PIECES   4
 

Definition at line 31 of file kttour.c.

#define KTTOUR_START   2
 

Definition at line 38 of file kttour.c.

#define KTTOUR_USED   3
 

Definition at line 39 of file kttour.c.

#define abs( x )   ((x)<0?-(x):(x))
 

Definition at line 116 of file kttour.c.


Function Documentation

void add_hints ( byte * board,
int new_x,
int new_y,
byte ** mp ) [static]
 

Definition at line 189 of file kttour.c.

Referenced by kttour_getmove().

gboolean are_nbrs ( int x1,
int y1,
int x2,
int y2 ) [static]
 

Definition at line 118 of file kttour.c.

Referenced by add_hints(), kttour_getmove(), and kttour_who_won().

void find_xy ( byte * board,
int * x,
int * y,
int val ) [static]
 

Definition at line 125 of file kttour.c.

Referenced by kttour_getmove(), and kttour_who_won().

int get_degree ( byte * board,
int i,
int j ) [static]
 

Definition at line 158 of file kttour.c.

Referenced by add_hints(), and get_min_degree().

int get_min_degree ( byte * board,
int i,
int j ) [static]
 

Definition at line 172 of file kttour.c.

Referenced by add_hints().

char** kttour_get_pixmap ( int idx,
int color ) [static]
 

Definition at line 90 of file kttour.c.

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

Definition at line 225 of file kttour.c.

void kttour_init ( )
 

Definition at line 58 of file kttour.c.

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

Definition at line 140 of file kttour.c.


Variable Documentation

Game Kttour
 

Initial value:

 { KTTOUR_CELL_SIZE, KTTOUR_BOARD_WID, KTTOUR_BOARD_HEIT, 
        KTTOUR_NUM_PIECES, 
        kttour_colors, NULL,  NULL, "Knight's tour", 
        kttour_init}

Definition at line 46 of file kttour.c.

int incx[] = {-2, -2, -1, -1, 1, 1, 2, 2} [static]
 

Definition at line 153 of file kttour.c.

int incy[] = {-1, 1, -2, 2, -2, 2, -1, 1} [static]
 

Definition at line 154 of file kttour.c.

char kttour_colors[6] = {200, 200, 160, 200, 200, 160}
 

Definition at line 42 of file kttour.c.

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

Definition at line 52 of file kttour.c.

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

Definition at line 51 of file kttour.c.