connectn

This is a Java version of Connect 4 using spudtrooper and darthtater. To play download the jar file

connectn.jar

and run the jar

% java -jar connectn.jar
    

Here's the source

connectn.tar.gz

Here's what it looks like

By default, the is one real player (spudtrooper) and a 'hard' computer player (darthtater). To see other options print help with the -help option and see this:

Usage: java ConnectN <options>
where options include
  -rows <n>           use 'n' number of rows
  -cols <n>           use 'n' number of columns
  -net                networked game               (pending)
  -gui                use GUI mode                 (default true)
  -term               use terminal mode
  -both               use two computer players
  -p2 <class>         use player 2 class 'class'
  -2                  use 2 players
  -n <i>              set the N in ConnectN to 'i' (default 4)
  -local              use local mode               
  -easy               use easy computer as player 2
  -hard <f> <m> <a>   use hard mode with parameters:
                       * exponent                 (default  2)
                       * level to which we search (default  6)
                       * aggresiveness            (default -1)
  -help               print this message and quit
    

By default player 2 is a HardPlayer, but you can write your own computer player by extending AbstractPlayer and implementing the method int nextMove(Game g) and passing the class name as value to parameter -p2, example

java ConnectN -p2 EasyPlayer