The LUDAE project

 ...previous goto main page

The System Structure

LUDĘ is built in different conceptual layers, in order to achieve the required modularity for meta-game learning. This next diagram shows some of the working modules

Graphical User Interface

Arena 

Academy

Selection 

Tournament Players Game

Libraries

 

The Graphical User Interface (GUI) give access to the following tasks: 
The Arena viewer, where the user may check the statistics and update any parameter of the present tournament.
The Academy viewer, where the user may check the knowledge gathered so far.
The Player viewer, where the user may actually play a game against a chosen computer player - this should also be included in a game Applet. 
The Arena module, where the actual contests will occur, needs the following structures:
The Game Class
An array of Player Class instances, which may use different playing methods.
The Tournament Class, specifies how a set of players will match each other, and execute all contests.
The Selection Class can:
Initialize a new random generation.
Create the new generation given a tournament result. 
The Academy module, consisting of:
A set of game measures, computed by the tournaments on the Arena.
An opening theory game tree
A library of middlegame positions
A library of endgame positions.

Class Design

Academy
Library
Game-Tree
Arena
Tournament
Contest
Selection
Game
Cell
Link
Sector
Board
Square-Board [subclass]
Hex-Board [subclass]
Player
Strategy
Tactic

Arena Class

// where the nasty stuff really happens... :-)

Game        game        // what game are we talking about
Player[]    players     // the set of players
Tournament  tournament  // what kind of tournament are we using
Selection   selector    // how player generations are created

Tournament Class

// define a set of contests (e.g., round-robin, pools, Swiss system, 
//                                 direct elimination...


Arena      arena     // to which arena this tournament belongs
Result[][] results   // the actual table of results

start()              // reset and start 1st contest
report()             // report last contest to ACADEMY
next()               // start next contest
pause()              // pause tournament
continue()           // continue tournament

toString()           // actual tournament state in a string

Contest Class

// a specific game contest between two players

Tournament tournament   // to which tournament it belongs

Player
player1
Player player2
bool   nextPlayer    // TRUE = Player1, FALSE = Player2

Board[] positions
int
     actualTurn   // 0 = start, 1 = after 1st Player1 move, ...
int     actualMove   // how many played moves so far (several moves 
                     //   can be made in the same turn)

Board   getPos( n )  // returns nth position (relative position, if n<0)

nextMove()           // get move from next player, and update positions[]
                     //   nextPlayer, actualTurn and actualMove

Selection Class

Arena    arena       // to which arena this selection belongs

Player[] reset()     // create a new set of players
Player[] next(
Result[][] results) // evolve a new generation

Player Abstract Class

int    id
string type          // the player's type
string name          // the player's name (e.g., White, Black, Left, ...)

abstract Board  nextMove()

HumanPlayer Class

Board  nextMove()    // Get a valid move by mouse, or whatever...

   
// Humans are permitted to express an opinion of his own moves

ComputerPlayer Class

Board  nextMove()

Strategy strategy    // where the complexity is hiding!!!

Strategy Class

string name

Game  
game          // which game are we talking

Tactic[] features    // the feature set defining the evaluation function
float[]  weights     // the relevance of each feature

search()             // the search game tree algorithm (alpha-beta, ...)
analyze()            // optimize strategy (if analysis is available)
learn()              // optimize strategy (if learning is available)

Tactic Class

// a specific point of view for evaluate a certain game position
string type          // expert, genetic, HOYLE-like,, neural, whatever...

float
 evaluation( Board position ) // the positional credit assignment

Game Class

string name

final char
empty = '-';
final char soldierBlack = 'x';
final char kingBlack = 'b';
final char soldierWhite = 'o';
final char kingWhite = 'w';     // more if needed...

      setup( Board setupBoard )    // initializes game setup
float endgame()    // 1 if win, 0.5 if draw, 0 if lost, -1 otherwise

Board[] validMoves( Board actualBoard )
Board   nextBoard( Board actualBoard, String nextMove )

  // auxiliary methods to ease the construction of validMoves()
bool KO            // TRUE means KO rule is ON
int  equalizer     // Black plays N moves, White chooses side; 0 = OFF

 Cell Class

Cell( String id, int maxLinks )

String 
id
char    piece      // empty, Black soldier, White soldier, ...
char    state      // cell state
Links[] links      // the set of connections (defined by maxLinks)

Cell    next( char direction )  // next cell in that direction

  // used to update specific cell information 
    setPiece( char value )
char getPiece(
)

    setState( char value )
char getState()

     addLink( char direction, Cell toCell )
     remLink( char direction )

Link Class

Link( char direction, char state, Cell toCell )

  // we will use one letter direction (to use chars instead of Strings)
  // 
  //      m n o         u -> up
  //       \|/          d -> down
  //     w--c--e        x -> diagonal
  //       /|\          + -> orthogonal
  //      r s t         * -> x and +
  //
  // other symbols may be used to extra directions!

char direction   // the actual direction
char state       // link state
Cell toCell      // to what cell

     setDirection( char direction )
char getDirection()

     setState(
char value )
char getState()

     setCell( Cell cell )
Cell getCell()

Sector Class

  // a sector is a sub-area of the board (e.g., a promotion zone)

Sector( String name, int maxCells )

String name
char  
state       // for dynamic sector change

Cell[] cells       // which cells are included in this sector

add( Cell cell )
rem(
Cell cell )

bool
isIn( Cell cell )
bool isIn( String idCell )

int
nPiece( char piece )  
// the number of piece in the sector
int nState( char state )  // the number cells in state in the sector

Board Abstract Class

Cell[] position             // keeps the actual board position

bool
  equals( Board other ) 
// this == other?
Board clone()               // make a copy

  // automatic creation of regular topologies,
  // using the following coordinate system for cell naming
  // 
  //                           4 5 6
  //  6 . . . . . .           3 . . .
  //  5 . . . . . .          2 . . . .
  //  4 . . . . . .         1 . . . . .
  //  3 . . . . . .          . . . . . .
  //  2 . . . . . .         a . . . . .
  //  1 . . . . . .          b . . . .
  //    a b c d e f           c d e f
  // 
abstract createGrid()

  // auxiliary methods to ease the construction of Game.validMoves()

Board[] step ( Cell cell, char direction, bool capture )
Board[] slide( Cell cell, char direction, bool capture )
Board[] jump ( Cell cell, char direction, bool capture,  
               int
pre, int pos, bool multiple, bool both )
    
  // pre is the number of cells before the jumped piece
       // pos is the number of cells after the jumped piece
       // multiple is TRUE for multiple jumps
       // both is TRUE for jumps of either color

SquareBoard Class

createGrid( int rows, int columns )

HexBoard Class

createGrid( int sizeTopRow, int sizeMidRow, 
           
int sizeBottomRow )


goto top
...previous goto main page