Connect4Tournament

com.phasmidsoftware.gambit.examples.connect4.Connect4Tournament

Runs a round-robin tournament between all Connect Four player types and prints the league table to stdout.

Player parameters (depths, iteration counts, exploration constant) are read from application.conf via com.phasmidsoftware.gambit.game.GambitConfig. Edit the config file to tune contestants without recompiling.

Players entered:

  • RandomPlayer
  • HeuristicPlayer (one-ply greedy)
  • AlphaBeta(d=d1) (minimax, depth from config)
  • AlphaBeta(d=d2) (minimax, deeper depth from config)
  • MCTS(i=i1) (Monte Carlo, iteration count from config)
  • MCTS(i=i2) (Monte Carlo, higher iteration count from config)

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def main(args: Array[String]): Unit

The entry point for the Connect Four tournament application. Command-line args override config defaults.

The entry point for the Connect Four tournament application. Command-line args override config defaults.

Value parameters

args

optional: args(0) = gamesPerPairing (Int), args(1) = seed (Long).

Attributes

def run(gamesPerPairing: Int = ..., seed: Long = ..., out: String => Unit = ..., flush: () => Unit = ...): String

Build and run the tournament, printing progress and returning the league table.

Build and run the tournament, printing progress and returning the league table.

Output is written via out and flushed via flush, both of which default to stdout behaviour. Pass alternative implementations for testing or redirection:

 val sb = new StringBuilder
 val table = Connect4Tournament.run(
   gamesPerPairing = 2, seed = 42L,
   out   = s => { sb.append(s); sb.append('\n') },
   flush = () => ()
 )

Player parameters are read from GambitConfig (application.conf). Override by editing the config file -- no recompilation needed.

Value parameters

flush

flush function called after progress lines (default stdout flush).

gamesPerPairing

number of games each ordered pair plays (default from config: gambit.tournament.gamesPerPairing).

out

output function for progress lines (default println).

seed

random seed; default is System.currentTimeMillis().

Attributes

Returns

the formatted league table string.