public void MakeMove(int origin, int destination, string madeBy) { bool Color; if (madeBy != CurrentPlayer) { return; } if (origin < 0 || destination > 24) { return; } Color = WhoseTurn(); if (CheckMoveLegality(origin, destination, Color, out int action)) { DieActions.Remove(action); Board[origin].SoldiersQuantity--; switch (Board[destination].SoldiersQuantity) { case 0: Board[destination].Color = Color; Board[destination].SoldiersQuantity++; break; case 1: if (Board[destination].Color != Color) { if (Color) { Board[25].SoldiersQuantity++; } else { Board[0].SoldiersQuantity++; } Board[destination].Color = Color; } else { Board[destination].SoldiersQuantity++; } break; default: Board[destination].SoldiersQuantity++; break; } } if (DieActions.Count == 0 || !CanMakeMoves(WhoseTurn())) { StartNewTurn(); } }
private void removeFromOrigion(int origin, int action, bool color) { if (color) { BlackOut++; } else { WhiteOut++; } Board[origin].SoldiersQuantity--; DieActions.Remove(action); }