private Player InitPlayer(Color color, string name, bool isReverse) //Setting Board and position of peices { Player player = new Player { Color = color, Name = name }; int flagColumn = _rand.Next(RockPaperScissorsGame.BOARD_SIZE); int trapColumn = _rand.Next(RockPaperScissorsGame.BOARD_SIZE); GamePiece[] pieces = new GamePiece[RockPaperScissorsGame.BOARD_SIZE * 2]; for (int i = 0; i < pieces.Length; i++) { int col = i % RockPaperScissorsGame.BOARD_SIZE; int rowOffset = i / RockPaperScissorsGame.BOARD_SIZE; int row = isReverse ? RockPaperScissorsGame.BOARD_SIZE - 1 - rowOffset : rowOffset; if (rowOffset == 0 && col == flagColumn) { pieces[i] = new Flag(); } else if (rowOffset == 1 && col == trapColumn) { pieces[i] = new Trap(); } else { pieces[i] = new Soldier { Weapon = _game.GetRandomWeapon() }; } pieces[i].Game = _game; pieces[i].Owner = player; pieces[i].Position = new Position { Column = col, Row = row }; } player.Pieces = pieces; return(player); }