public Chit DrawChit(Chit.ElementType e) { if (ChitsLeft() == 0) { return(null); } Chit chit = chits.Find(c => c.Element == e); chits.Remove(chit); return(chit); }
public Chit DrawChit() { if (ChitsLeft() == 0) { return(null); } int i = random.Next(chits.Count); Chit c = chits[i]; chits.RemoveAt(i); return(c); }
internal int[] FindChit(Chit c) { for (int i = 0; i < chits.GetUpperBound(0); i++) { for (int j = 0; j < chits.GetUpperBound(1); j++) { if (chits[i, j] == c) { return(new int[] { i, j }); } } } return(null); }
public Tile[] TilesFor(Chit c) { // We map chits to a double-width array var pair = FindChit(c); int i = pair[0]; int j = pair[1]; j /= 2; // FIXME: This is completely wrong. return(new Tile[] { tiles[i, j], tiles[i - 1, j], tiles[i, j - 1] }); }
public Map() { for (int i = 0; i <= tiles.GetUpperBound(0); i++) { for (int j = 0; j <= tiles.GetUpperBound(1); j++) { tiles[i, j] = new Tile(); } } Tiles = new DataArrayWrapper <Tile>(tiles); for (int i = 0; i <= chits.GetUpperBound(0); i++) { for (int j = 0; j <= chits.GetUpperBound(1); j++) { chits[i, j] = new Chit(); } } Chits = new DataArrayWrapper <Chit>(chits); }
public virtual Tile[] TilesFor(Chit c) { return g.map.TilesFor(c); }
public void RemoveChit(Chit chit) { chit.Element = Chit.ElementType.None; }
public void PlaceChit(Chit chit, Chit.ElementType elementType) { chit.Element = elementType; }
public void AddElementToPlayer(Player player, Chit.ElementType element) { player.Adapt(element); }
public SpeciationActionSpace(Chit.ElementType element) : base(ActionType.Speciation) { Element = element; }
public void ReturnChit(Chit chit) { chits.Add(chit); }
public virtual Tile[] TilesFor(Chit c) { return(g.map.TilesFor(c)); }
internal int Adapt(Chit.ElementType e) { if (!CanAdapt()) throw new System.Exception("Already fully adapted."); var adapted = adaptation[e] + 1; adaptation[e] = adapted; return adapted; }
public int AdaptationTo(Chit.ElementType e) { if (e == Chit.ElementType.None || e == Chit.ElementType.Invalid) { return 0; } int adapted = adaptation[e]; if (bonus[Animal] == e) { adapted += 2; if (Animal == Animal.Amphibian) { adapted++; } } return adapted; }
public Chit DrawChit(Chit.ElementType e) { if (ChitsLeft() == 0) return null; Chit chit = chits.Find(c => c.Element == e); chits.Remove(chit); return chit; }