public ZertzBallContainer CaptureLandPieces(HexLocation hl) //CLP { HashSet <HexLocation> visited = new HashSet <HexLocation>(); Stack <HexLocation> todo = new Stack <HexLocation>(); ZertzBallContainer zbc = ZertzBallContainer.Empty(); ZertzPiece zp; zbc[this[hl].BallType]++; this[hl] = ZertzPiece.Dead; visited.Add(hl); todo.Push(hl); HexLocation hla, nei; while (todo.Count > 0x00) { hla = todo.Pop(); for (int i = 0x00; i < 0x06; i++) { nei = hla + HexLocation.NeighbourDirections[i]; if (!visited.Contains(nei)) { visited.Add(nei); zp = this[nei]; if (zp.IsAlive) { zbc[zp.BallType]++; this[nei] = ZertzPiece.Dead; todo.Push(nei); } } } } return(zbc); }
public ZertzGame(out HexLocation[] hls) { //this.players = new IPlayer[] {playerA,playerB}; this.board = ZertzBoard.OffsetBoard(out hls); this.playersPools = new ZertzBallContainer[] { ZertzBallContainer.Empty(), ZertzBallContainer.Empty() }; this.turn = 0x00; this.zmc = new ZertzMoveCreator(this); }
private ZertzBallContainer getCurrentPlayerSourcePool() { if (this.commonPool != ZertzBallContainer.Empty()) { return(this.commonPool); } else { return(this.playersPools[this.turn]); } }
public void TestConstructor() { ZertzBallContainer zbc; for(byte b = byte.MinValue; b < byte.MaxValue; b++) { for(byte c = byte.MinValue; c < byte.MaxValue; c++) { for(byte d = byte.MinValue; d < byte.MaxValue; d++) { zbc = new ZertzBallContainer(b,c,d); Assert.AreEqual(b,zbc[ZertzBallType.White]); Assert.AreEqual(c,zbc[ZertzBallType.Gray]); Assert.AreEqual(d,zbc[ZertzBallType.Black]); } } } }
public void TestConstructor() { ZertzBallContainer zbc; for (byte b = byte.MinValue; b < byte.MaxValue; b++) { for (byte c = byte.MinValue; c < byte.MaxValue; c++) { for (byte d = byte.MinValue; d < byte.MaxValue; d++) { zbc = new ZertzBallContainer(b, c, d); Assert.AreEqual(b, zbc[ZertzBallType.White]); Assert.AreEqual(c, zbc[ZertzBallType.Gray]); Assert.AreEqual(d, zbc[ZertzBallType.Black]); } } } }
public void PutToPool(ZertzBallContainer container) //PTP { this.getCurrentPlayerDestinationPool().Add(container); }
public void Add(ZertzBallContainer container) { this.counters += container.counters; }
public static ZertzBallRenderer[] GenerateBalls(ZertzBallContainer zbc, RenderContainer rc, ZertzCupRenderer zcr, int offsetid) { int id = offsetid; ZertzBallType zbt; ZertzBallRenderer zbr; ZertzBallRenderer[] list = new ZertzBallRenderer[zbc.Total]; int j = 0x00; for(byte b = 0x00; b < 0x03; b++) { zbt = (ZertzBallType) b; for(int i = 0x00; i < zbc[zbt]; i++) { zbr = new ZertzBallRenderer(zbt); list[j++] = zbr; rc.Add(id++,zbr); zbr.RenderMover = RenderMoveManager.GenerateStaticMover(zcr.CommonContainer.Add(zbr)); } } return list; }
public void PutToPool(ZertzBallContainer container) { //PTP this.getCurrentPlayerDestinationPool().Add(container); }