This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

pentaline.c File Reference

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include "game.h"
#include "aaball.h"

Go to the source code of this file.

Data Structures

struct  Pentaline_state

Defines

#define PENTALINE_CELL_SIZE   40
#define PENTALINE_NUM_PIECES   2
#define PENTALINE_BOARD_WID   12
#define PENTALINE_BOARD_HEIT   12
#define PENTALINE_RP   1
#define PENTALINE_BP   2
#define PENTALINE_EMPTY   0
#define FIRST_WON   { *eval = player == WHITE ? (1 << 20) : - (1 << 20); return player == WHITE ? RESULT_WHITE : RESULT_BLACK; }
#define SECOND_WON   { *eval = player == WHITE ? - (1 << 20) : (1 << 20); return player == WHITE ? RESULT_BLACK : RESULT_WHITE; }

Functions

void pentaline_init ()
int pentaline_getmove (Pos *, int, int, GtkboardEventType, Player, byte **, int **)
ResultType pentaline_who_won (Pos *, Player, char **)
void pentaline_set_init_pos (Pos *pos)
unsigned char* pentaline_get_rgbmap (int idx, int color)
ResultType pentaline_eval_incr (Pos *, Player, byte *, float *)
byte* pentaline_movegen (Pos *)
ResultType pentaline_eval (Pos *, Player, float *)
void* pentaline_newstate (Pos *pos, byte *move)
float eval_line (byte *board, int x, int y, int incx, int incy)
float eval_line_bidir (byte *board, int x, int y, int incx, int incy)
float eval_runs (byte *board)
void get_chain_info (byte *board, int x, int y, int dx, int dy, int *len, int *open, int *color)
void update_state (byte chains[5][2][2], int len, int open, int color, int inc)

Variables

char pentaline_colors [9] = {200, 220, 200, 200, 220, 200, 0, 0, 0}
Game Pentaline
int incx [4] = { 0, 1, 1, -1 }
int incy [4] = { 1, 0, 1, 1 }


Detailed Description

Definition in file pentaline.c.


Define Documentation

#define FIRST_WON   { *eval = player == WHITE ? (1 << 20) : - (1 << 20); return player == WHITE ? RESULT_WHITE : RESULT_BLACK; }
 

#define PENTALINE_BOARD_HEIT   12
 

Definition at line 35 of file pentaline.c.

#define PENTALINE_BOARD_WID   12
 

Definition at line 34 of file pentaline.c.

#define PENTALINE_BP   2
 

Definition at line 38 of file pentaline.c.

#define PENTALINE_CELL_SIZE   40
 

Definition at line 31 of file pentaline.c.

#define PENTALINE_EMPTY   0
 

Definition at line 39 of file pentaline.c.

#define PENTALINE_NUM_PIECES   2
 

Definition at line 32 of file pentaline.c.

#define PENTALINE_RP   1
 

Definition at line 37 of file pentaline.c.

#define SECOND_WON   { *eval = player == WHITE ? - (1 << 20) : (1 << 20); return player == WHITE ? RESULT_BLACK : RESULT_WHITE; }
 


Function Documentation

float eval_line ( byte * board,
int x,
int y,
int incx,
int incy ) [static]
 

Definition at line 233 of file pentaline.c.

Referenced by eval_line_bidir(), and eval_runs().

float eval_line_bidir ( byte * board,
int x,
int y,
int incx,
int incy ) [static]
 

Definition at line 261 of file pentaline.c.

Referenced by pentaline_eval_incr().

float eval_runs ( byte * board ) [static]
 

Definition at line 276 of file pentaline.c.

void get_chain_info ( byte * board,
int x,
int y,
int dx,
int dy,
int * len,
int * open,
int * color ) [static]
 

Definition at line 373 of file pentaline.c.

Referenced by pentaline_newstate().

ResultType pentaline_eval ( Pos * pos,
Player player,
float * eval )
 

Definition at line 308 of file pentaline.c.

ResultType pentaline_eval_incr ( Pos * pos,
Player to_play,
byte * move,
float * eval )
 

Definition at line 296 of file pentaline.c.

unsigned char* pentaline_get_rgbmap ( int idx,
int color )
 

Definition at line 219 of file pentaline.c.

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

Definition at line 202 of file pentaline.c.

void pentaline_init ( )
 

Definition at line 67 of file pentaline.c.

byte* pentaline_movegen ( Pos * pos )
 

Definition at line 94 of file pentaline.c.

void* pentaline_newstate ( Pos * pos,
byte * move )
 

Definition at line 418 of file pentaline.c.

void pentaline_set_init_pos ( Pos * pos ) [static]
 

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

Definition at line 159 of file pentaline.c.

void update_state ( byte chains[5][2][2],
int len,
int open,
int color,
int inc ) [static]
 

Definition at line 405 of file pentaline.c.

Referenced by pentaline_newstate().


Variable Documentation

Game Pentaline
 

Initial value:

 { PENTALINE_CELL_SIZE, PENTALINE_BOARD_WID, PENTALINE_BOARD_HEIT, 
        PENTALINE_NUM_PIECES,
        pentaline_colors,  NULL, NULL, "Pentaline", pentaline_init}

Definition at line 46 of file pentaline.c.

int incx[4] = { 0, 1, 1, -1 } [static]
 

Definition at line 293 of file pentaline.c.

int incy[4] = { 1, 0, 1, 1 } [static]
 

Definition at line 294 of file pentaline.c.

char pentaline_colors[9] = {200, 220, 200, 200, 220, 200, 0, 0, 0}
 

Definition at line 41 of file pentaline.c.