private static void testMoveOut(ILudoEngine ludoEngine) { while (true) { int result; do { result = ludoEngine.TossDice(); } while (result != 6); Console.WriteLine("Player " + ludoEngine.CurrentPlayer + " finally got a 6"); Console.WriteLine("Before moving out: " + ludoEngine.Squares[(ludoEngine.CurrentPlayer - 1) * 10].Occupied); Console.WriteLine("Moving out token..."); ludoEngine.MoveOutToken(); Console.WriteLine("After moving out: " + ludoEngine.Squares[(ludoEngine.CurrentPlayer - 1) * 10].Occupied); Console.ReadKey(); } //int currentPlayer = ludoEngine.CurrentPlayer; //Console.WriteLine("Player " + ludoEngine.CurrentPlayer + "'s start position occupied: " + ludoEngine.Squares[i*10].Occupied); // Console.WriteLine("Moving out player " + ludoEngine.CurrentPlayer + "'s token"); // ludoEngine.MoveOutToken(); //Console.WriteLine("Player " + ludoEngine.CurrentPlayer + "'s start position occupied: " + ludoEngine.Squares[i*10].Occupied); //Console.WriteLine("It is now player " + ludoEngine.CurrentPlayer + "'s turn"); //Console.WriteLine(); }
private void HomeYard_MouseDown(object sender, MouseButtonEventArgs e) { Shape homeYard = (Shape)sender; bool result; try { result = _engine.MoveOutToken((TokenColor)Enum.Parse(typeof(TokenColor), homeYard.Name)); if (result == false) { _errorMessage = "You can't move out your token"; } updateGraphics(); } catch (InvalidTokenColorException) { _errorMessage = "This is not your own homeyard"; } }