Skip to content

Instantly share code, notes, and snippets.

@harold
Created October 26, 2011 03:31
Show Gist options
  • Save harold/1315347 to your computer and use it in GitHub Desktop.
Save harold/1315347 to your computer and use it in GitHub Desktop.
.NET.DOMOHNOES
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);
}
}
// 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