We will run two NoCanDo tournaments at Sprouts: one for humans and one for computers. Attendees can participate in the human tournament by acting like a human. They can also submit code for a computer player. This page provides the code for that.
In order to write the player, you'll need some files. (These are all from my GitHub for CG Code.)
public class WhateverYourNameYourPlayer extends Player<NoCanDo> {Except you should name your player something that no one else will name theirs. Player.java has the getMove method, which you must override. The method signature you'll include is:
public NoCanDo getMove(NoCanDo position, int playerId), where playerId is one of the two constants from above, indicating which player is taking this turn. You'll want your player to be able to handle both cases.
Once you have all of this, you can test your player with the following code:
//set things up Player<NoCanDo> random = new RandomPlayer<NoCanDo>(); Player<NoCanDo> myPlayer = new WhateverYouCalledYourPlayer(); PositionFactory<NoCanDo> factory = new NoCanDo.PositionBuilder(); //only creates empty boards Referee<NoCanDo> ref = new ManualAdvancingSwingReferee<NoCanDo>(random, myPlayer, factory); //run the tests ref.call(); //then test it the other way ref = new ManualAdvancingSwingReferee<NoCanDo>(myPlayer, random, factory); ref.call(); //now run a gauntlet (with no GUI) ref = new Referee<NoCanDo>(myPlayer, random, factory); ref.gauntlet(100); //plays 100 games and prints results
When you have a working player, please email it to Kyle and he'll include it in the tournament!
Return to the Sprouts 2018 homepage.