Created
October 26, 2011 03:31
-
-
Save harold/1315347 to your computer and use it in GitHub Desktop.
.NET.DOMOHNOES
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace Doms | |
{ | |
public class Dom | |
{ | |
public int l; | |
public int r; | |
public Dom(int inL, int inR) | |
{ | |
l = inL; | |
r = inR; | |
} | |
public List<int> GetList() { return new List<int> { l, r }; } | |
public List<int> GetReverseList() { return new List<int> { r, l }; } | |
public override string ToString() { return "("+l+", "+r+")"; } | |
} | |
public class TurnOption | |
{ | |
public Dom played; // The dom from your hand which would be played | |
public List<Dom> hand; // Your hand after you play that dom | |
public List<int> board; // The new board after you play that dom | |
public TurnOption(Dom inPlayed, List<Dom> inHand, List<int> inBoard) | |
{ | |
played = inPlayed; | |
hand = inHand; | |
board = inBoard; | |
} | |
} | |
public interface Player | |
{ | |
string GetName(); | |
int GetMove(List<TurnOption> inTurnOptions); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Plays randomly | |
type buffoonPlayer(i:int) = | |
interface Doms.Player with | |
member this.GetName() = sprintf "Buffoon #%O" i | |
member this.GetMove( inTurnOptions ) = | |
r.Next(0, inTurnOptions.Count) | |
new(i) = buffoonPlayer(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment