Tutorial - reubenpeeris/wippen GitHub Wiki

Introduction

By the end of this mini-tutorial you should be able to build the projects and run the example robots.

Pre-requisites:

You will need the following tools installed and configured

  • Java 1.7
  • Maven 3
  • Git

Steps

Clone the github repository into a workspace folder

$cd workspace
$git clone https://github.com/reubenpeeris/wippen.git

A wippen directory will be created containg 2 maven projects:

  • wippen-engine the game engine
  • wippen-robots a few very basic robots

Build the 2 projects

$cd wippen/wippen-engine
$mvn install    
$cd ../wippen-robots
$mvn package

At the end of both builds, you should see a BUILD SUCCESS notice.

View the example robots

$ls -1 src/main/java/com/reubenpeeris/wippen/examples/
Discarder.java
HumanRobot.java
PairAdder.java
SingleValueMatcher.java
$vim src/main/java/com/reubenpeeris/wippen/examples/Discarder.java
$vim src/main/java/com/reubenpeeris/wippen/examples/SingleValueMatcher.java
$vim src/main/java/com/reubenpeeris/wippen/examples/PairAdder.java

Run a match using maven with the default configuration

$mvn exec:java
...
Running
 Sets:       100
 First game: 0
 Players:    4
 Player 0 [Discarder]                         0   0.0%
 Player 1 [SingleValueMatcher]              512  10.5%
 Player 2 [PairAdder]                      1350  27.7%
 Player 3 [PairCapturer]                   3009  61.8%

...

There will be a some maven output including the results of executing wippen. In this default configuration, 3 robots (Discarder, SingleValueMatcher and PairAdder) play the output shows their overall score at the end of the match (0, 750 and 2016). To make comparison easier the percentage of points gained by each robot is also shown.

Run a match using maven with a custom configuration

Maven supplies the command line arguments to Wippen. To pass these into maven, set the exec.arguments property (which uses a comma (,) to seperate arguments. E.g. to run SingleValueMatcher against PairAdder execute:

$mvn exec:java -Dexec.arguments=class:com.reubenpeeris.wippen.examples.SingleValueMatcher,class:com.reubenpeeris.wippen.examples.PairAdder