public void BoardCanSetCellPiece() { var piece = new Piece("Blue", Army.Rank.General); Cell cellI9 = board.GetCell("I9"); board.SetCellPiece("I9", piece); Assert.AreEqual(piece, board.GetCellPiece("I9")); }
public int GetPieceMoveRule(Piece piece) { if (_gametypeName == "Classic") return GetClassicPieceMoveRule(piece); else return 0; }
public void SetPiece(Piece piece) { if (_currentState == State.Invalid) throw new CannotSetOrRemovePieceToInvalidCellException(); this._currentState = State.Occupied; this._piece = piece; }
public void Initialize() { redPiece = new Piece("Red"); bluePiece = new Piece("Blue"); redArmy = new Army("Red"); blueArmy = new Army("Blue"); }
private int GetClassicPieceMoveRule(Piece piece) { if (piece.GetRank() == Army.Rank.Scout) return -1; if (piece.GetRank() == Army.Rank.Bomb || piece.GetRank() == Army.Rank.Flag) return 0; return 1; }
public void CanRemoveCellPiece() { var cell = new Cell(); var piece = new Piece("Orange", Army.Rank.Scout); Assert.AreEqual(Cell.State.Empty, cell.GetState()); cell.SetPiece(piece); Assert.AreEqual(Cell.State.Occupied, cell.GetState()); cell.RemovePiece(); Assert.AreEqual(Cell.State.Empty, cell.GetState()); }
public void CanSetCellPiece() { var cell = new Cell("Test"); var piece = new Piece("Green", Army.Rank.Major); Assert.AreEqual(Cell.State.Empty, cell.GetState()); cell.SetPiece(piece); Assert.AreEqual(Cell.State.Occupied, cell.GetState()); Assert.AreEqual(piece, cell.GetPiece()); Assert.AreEqual("Green", cell.GetPiece().GetColor()); }
public void BoardCanGetCellPieceRank() { var i1Cell = board.GetCell("I1"); var piece = new Piece("Silver", Army.Rank.Spy); i1Cell.SetPiece(piece); Assert.AreEqual(Army.Rank.Spy, board.GetCellPieceRank("I1")); }
public void BoardCanGetCellPieceColor() { var d5Cell = board.GetCell("D8"); var piece = new Piece("Magenta", Army.Rank.Flag); d5Cell.SetPiece(piece); Assert.AreEqual("Magenta", board.GetCellPieceColor("D8")); }
public void BoardCanGetCellPiece() { var e9Cell = board.GetCell("E9"); var piece = new Piece("Purple", Army.Rank.Flag); e9Cell.SetPiece(piece); Assert.AreEqual(piece, board.GetCellPiece("E9")); }
public void CellCanGetPieceRank() { var cell = new Cell("Test"); var piece = new Piece("Blue", Army.Rank.Bomb); cell.SetPiece(piece); Army.Rank? cellPieceRank = cell.GetPieceRank(); Assert.AreEqual(Army.Rank.Bomb, cellPieceRank); }
public void CellCanGetPieceColor() { var cell = new Cell("Test"); var piece = new Piece("Blue", Army.Rank.Bomb); cell.SetPiece(piece); Assert.AreEqual("Blue", cell.GetPieceColor()); }
public void GetAdjacentCellCurrentPieceOrNameForC9() { var d9Piece = new Piece("Purple", Army.Rank.Colonel); board.GetCell("D9").SetPiece(d9Piece); Assert.AreEqual(d9Piece, board.GetCell("C9").GetAdjacent(Cell.Touching.Right).GetPiece()); Assert.AreEqual("B9", board.GetCell("C9").GetAdjacent(Cell.Touching.Left).Name); }
public void SetCellPiece(string c, Piece piece) { _cells[c].SetPiece(piece); }
public void GetPieceRank() { var scoutPiece = new Piece("Red", Army.Rank.Scout); Assert.AreEqual(Army.Rank.Scout, scoutPiece.GetRank()); }
//method used by players to set up the game //they can only set up their pieces in spaces defined in initGrid(). public bool setPieceOnGrid(Piece p,Position pos) { if (p.piecePlayer.playerType != initialGrid.mainGrid[pos.row,pos.col]._type) return false; initialGrid.mainGrid[pos.row, pos.col]._piece = p; return true; }