This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

mastermind.c File Reference

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

Go to the source code of this file.

Defines

#define MASTERMIND_CELL_SIZE   40
#define MASTERMIND_NUM_PIECES   28
#define MASTERMIND_BOARD_WID   8
#define MASTERMIND_BOARD_HEIT   11
#define MASTERMIND_EMPTY   0
#define MASTERMIND_MAIN_COL_START   2
#define MASTERMIND_MAIN_COL_END   5
#define MASTERMIND_ARROW   27
#define MASTERMIND_RETURN   28
#define MASTERMIND_RIGHT_ROW_START   2
#define MASTERMIND_RIGHT_ROW_END   7
#define MASTERMIND_GET_SELECTION(x, y)   (((x)==7&&(y)>=MASTERMIND_RIGHT_ROW_START&&(y)<(MASTERMIND_RIGHT_ROW_START+6))?(y):-1)
#define MASTERMIND_IS_MAIN_COL(x)   ((x)>1&&(x)<6)

Functions

void mastermind_init ()
char** mastermind_get_pixmap (int idx, int color)
ResultType mastermind_who_won (Pos *, Player, char **)
void mastermind_set_init_pos (Pos *pos)
int mastermind_getmove (Pos *, int, int, GtkboardEventType, Player, byte **, int **)
int mastermind_getmove_kb (Pos *, int, Player, byte **, int **)
void mastermind_reset_uistate ()
int mastermind_get_cur_row (byte *)
void mastermind_set_init_render (Pos *)
void mastermind_free ()

Variables

char mastermind_colors [9] = {200, 200, 200, 200, 200, 200, 0, 0, 0}
char mastermind_highlight_colors [9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}
char* arrow_blue_return_40_xpm []
char* arrow_blue_left_40_xpm []
int mastermind_init_pos [MASTERMIND_BOARD_WID *MASTERMIND_BOARD_HEIT]
SCORE_FIELD mastermind_score_fields [] = {SCORE_FIELD_USER, SCORE_FIELD_SCORE, SCORE_FIELD_TIME, SCORE_FIELD_DATE, SCORE_FIELD_NONE}
char* mastermind_score_field_names [] = {"User", "Tries", "Time", "Date", NULL}
Game Mastermind
int active = MASTERMIND_RIGHT_ROW_START


Detailed Description

Definition in file mastermind.c.


Define Documentation

#define MASTERMIND_ARROW   27
 

Definition at line 42 of file mastermind.c.

#define MASTERMIND_BOARD_HEIT   11
 

Definition at line 36 of file mastermind.c.

#define MASTERMIND_BOARD_WID   8
 

Definition at line 35 of file mastermind.c.

#define MASTERMIND_CELL_SIZE   40
 

Definition at line 32 of file mastermind.c.

#define MASTERMIND_EMPTY   0
 

Definition at line 38 of file mastermind.c.

#define MASTERMIND_GET_SELECTION( x, y )   (((x)==7&&(y)>=MASTERMIND_RIGHT_ROW_START&&(y)<(MASTERMIND_RIGHT_ROW_START+6))?(y):-1)
 

Definition at line 47 of file mastermind.c.

Referenced by mastermind_getmove().

#define MASTERMIND_IS_MAIN_COL( x )   ((x)>1&&(x)<6)
 

Definition at line 48 of file mastermind.c.

Referenced by mastermind_getmove().

#define MASTERMIND_MAIN_COL_END   5
 

Definition at line 40 of file mastermind.c.

#define MASTERMIND_MAIN_COL_START   2
 

Definition at line 39 of file mastermind.c.

#define MASTERMIND_NUM_PIECES   28
 

Definition at line 33 of file mastermind.c.

#define MASTERMIND_RETURN   28
 

Definition at line 43 of file mastermind.c.

#define MASTERMIND_RIGHT_ROW_END   7
 

Definition at line 46 of file mastermind.c.

#define MASTERMIND_RIGHT_ROW_START   2
 

Definition at line 45 of file mastermind.c.


Function Documentation

void mastermind_free ( )
 

Definition at line 317 of file mastermind.c.

int mastermind_get_cur_row ( byte * board )
 

Definition at line 250 of file mastermind.c.

Referenced by mastermind_getmove(), mastermind_getmove_kb(), and mastermind_who_won().

char** mastermind_get_pixmap ( int idx,
int color )
 

Definition at line 272 of file mastermind.c.

int mastermind_getmove ( Pos * pos,
int x,
int y,
GtkboardEventType type,
Player to_play,
byte ** movp,
int ** rmovep )
 

Definition at line 327 of file mastermind.c.

int mastermind_getmove_kb ( Pos * pos,
int key,
Player glob_to_play,
byte ** movp,
int ** rmovp )
 

Definition at line 386 of file mastermind.c.

void mastermind_init ( )
 

Definition at line 187 of file mastermind.c.

void mastermind_reset_uistate ( )
 

Definition at line 322 of file mastermind.c.

void mastermind_set_init_pos ( Pos * pos ) [static]
 

Definition at line 261 of file mastermind.c.

void mastermind_set_init_render ( Pos * pos )
 

Definition at line 217 of file mastermind.c.

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

Definition at line 222 of file mastermind.c.


Variable Documentation

Game Mastermind
 

Initial value:

 { MASTERMIND_CELL_SIZE, 
        MASTERMIND_BOARD_WID, MASTERMIND_BOARD_HEIT, 
        MASTERMIND_NUM_PIECES,  mastermind_colors,  
        NULL,   NULL, "Mastermind", mastermind_init}

Definition at line 170 of file mastermind.c.

int active = MASTERMIND_RIGHT_ROW_START [static]
 

Definition at line 315 of file mastermind.c.

char* arrow_blue_left_40_xpm[] [static]
 

Definition at line 100 of file mastermind.c.

char* arrow_blue_return_40_xpm[] [static]
 

Definition at line 53 of file mastermind.c.

char mastermind_colors[9] = {200, 200, 200, 200, 200, 200, 0, 0, 0}
 

Definition at line 50 of file mastermind.c.

char mastermind_highlight_colors[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}
 

Definition at line 51 of file mastermind.c.

int mastermind_init_pos[MASTERMIND_BOARD_WID*MASTERMIND_BOARD_HEIT]
 

Initial value:

 
{
        0, 0, 9, 9, 9, 9, 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, 6,
        0, 0, 0, 0, 0, 0, 0, 5,
        0, 0, 0, 0, 0, 0, 0, 4,
        0, 0, 0, 0, 0, 0, 0, 3,
        0, 0, 0, 0, 0, 0, 0, 2,
        0, 0, 0, 0, 0, 0, 0, 1,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0,27, 0,
}

Definition at line 148 of file mastermind.c.

char* mastermind_score_field_names[] = {"User", "Tries", "Time", "Date", NULL}
 

Definition at line 165 of file mastermind.c.

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

Definition at line 164 of file mastermind.c.