private void ReplaceBoard(SaveData _data) { BlackPlayer.Reset(); WhitePlayer.Reset(); Pawns.Clear(); int number = 0; foreach (var color in _data.Pawns) { if (color == PawnColor.Black) { Pawns.Add(new Pawn(BlackPlayer, number)); } else if (color == PawnColor.White) { Pawns.Add(new Pawn(WhitePlayer, number)); } else { Pawns.Add(new Pawn(null, number)); } number++; } BlackPlayer.Time = _data.BlackTime; WhitePlayer.Time = _data.WhiteTime; CurrentPlayer = WhitePlayer; if (_data.CurrentPlayer == PawnColor.Black) { CurrentPlayer = BlackPlayer; } GetLegalMove(CurrentPlayer); UpdateScore(); }
public void AddPawn(Pawn pawn) { if (Pawns.Count == 3) { return; } Pawns.Add(pawn); }
public void ResetPawns() { this.Pawns.Clear(); foreach (var x in Enumerable.Range(1, 3)) { Pawns.Add(new Pawn(x, this.Color)); } this.Steps = 0; }
public bool PlaceNewPawn(Pawn pawn) { if (Tiles[pawn.Position.x, pawn.Position.y].Occupied() == false) { Pawns.Add(pawn); Tiles[pawn.Position.x, pawn.Position.y].Pawn = pawn; return(true); } return(false); }
public Player(string Color) { this.Color = Color; this.Pawns = new List <Pawn>() { }; this.Score = 0; this.Steps = 0; foreach (var x in Enumerable.Range(1, 3)) { Pawns.Add(new Pawn(x, this.Color)); } }
public Player(string name, ColorType color) { this.Name = name; this.Color = color; this.PawnsAtHome = PlayerConstants.InitPawnsAtHome; this.PawnsEscaped = PlayerConstants.InitPawnsEscaped; this.StepsLeft = 0; this.Home = new Home(color); this.Pawns = new List <Pawn>(); for (int i = 0; i < PlayerConstants.PawnsPerPlayer; i++) { Pawns.Add(new Pawn(Color, i)); } }
public void CreatePowns() { //Role 0=pawn/1=rook/2=knight/3=bishop/king=4/queen=5 //creat pawn white for (int i = 1; i <= 8; i++) { Pown pawn = new Pown(0, "white", i, 7, "pawnWhite" + i.ToString()); Pawns.Add(pawn); } //creat pawn black for (int i = 1; i <= 8; i++) { Pown pawn = new Pown(0, "black", i, 2, "pawnBlack" + i.ToString()); Pawns.Add(pawn); } Pown rook1B = new Pown(1, "black", 1, 1, "rookBlack1"); Pawns.Add(rook1B); Pown rook2B = new Pown(1, "black", 8, 1, "rookBlack2"); Pawns.Add(rook2B); Pown knight1B = new Pown(2, "black", 2, 1, "knightBlack1"); Pawns.Add(knight1B); Pown knight2B = new Pown(2, "black", 7, 1, "knightBlack2"); Pawns.Add(knight2B); Pown bishop1B = new Pown(3, "black", 3, 1, "bishopBlack1"); Pawns.Add(bishop1B); Pown bishop2B = new Pown(3, "black", 6, 1, "bishopBlack2"); Pawns.Add(bishop2B); Pown kingB = new Pown(4, "black", 5, 1, "kingBlack"); Pawns.Add(kingB); Pown queenB = new Pown(5, "black", 4, 1, "queenBlack"); Pawns.Add(queenB); //change color Pown rook1W = new Pown(1, "white", 1, 8, "rookWhite1"); Pawns.Add(rook1W); Pown rook2W = new Pown(1, "white", 8, 8, "rookWhite2"); Pawns.Add(rook2W); Pown knight1W = new Pown(2, "white", 2, 8, "knightWhite1"); Pawns.Add(knight1W); Pown knight2W = new Pown(2, "white", 7, 8, "knightWhite2"); Pawns.Add(knight2W); Pown bishop1W = new Pown(3, "white", 3, 8, "bishopWhite1"); Pawns.Add(bishop1W); Pown bishop2W = new Pown(3, "white", 6, 8, "bishopWhite2"); Pawns.Add(bishop2W); Pown kingW = new Pown(4, "white", 5, 8, "kingWhite"); Pawns.Add(kingW); Pown queenW = new Pown(5, "white", 4, 8, "queenWhite"); Pawns.Add(queenW); }
/// <summary> /// Adds a pawn to the node's inventory /// </summary> /// <param name="pawn">The pawn to be added</param> public void AddPawn(Pawn pawn) { Pawns.Add(pawn); }