void fifthMove() { text.text = "You are at point where you do final Exchange. And one more turn to this end for the final properties and you are done with game \n\n" + "Press E for the Exchange"; if (Input.GetKeyDown(KeyCode.E)) { moves = MovesList.GameWin; } }
void GameWin() { text.text = "Congratulations!! You won the game.\n\n" + "Press P to play again"; if (Input.GetKeyDown(KeyCode.P)) { moves = MovesList.gameOver; } }
//Game Over void game_over() { text.text = "Oh no!! You could not save all your belonging.\n" + "Game Over\n\n" + "Press P to play again."; if (Input.GetKeyDown(KeyCode.P)) { moves = MovesList.firstLevel; } }
//Reaching cross the river with goat first stage void second_level() { text.text = "Ok Now that you brought goat to the other shore.\n" + "Press R to return to other bank where there are Cabbage and Wolf"; if (Input.GetKeyDown(KeyCode.R)) { moves = MovesList.firstLevel_2; } }
private void writeMoves() { int i = carryi; MovesList moveXML = new MovesList(); moveList.Clear(); moveList = moveXML.createList(pokeList[i].number); rtbInfo.Text = ("Moves:" + Environment.NewLine); for (var e = 0; e < moveList.Count; e++) { rtbInfo.Text += "-" + moveList[e].move + Environment.NewLine; } }
private async void OnViewModelPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(ChessBoardPageViewModel.History)) { // Small delay to give the UI time to update await Task.Delay(300); var lastElement = _viewModel?.History?.LastOrDefault(); if (lastElement != null) { Device.BeginInvokeOnMainThread(() => MovesList.ScrollTo(lastElement, ScrollToPosition.End, true)); } } }
//Taking Wolf for second Tranport void third_level_wolf() { text.text = "Allrighty! You brought Wolf with you but goat is right there.\n" + " If you leave those two together, there wont be any Goat when you return.\n" + "You can also take back one of them to first end to correct the error.\n\n" + "Press G for Goat and W for Wolf."; if (Input.GetKeyDown(KeyCode.W)) { moves = MovesList.fourthLevelWithWolf; } else if (Input.GetKeyDown(KeyCode.G)) { moves = MovesList.fourthLevelWithGoat; } }
//Taking Cabbage for second Transport void third_level_cabbage() { text.text = "Allrighty! You brought Cabbage with you but goat is right there.\n" + " If you leave Cabbage with Goat, there wont be any Cabbage when you return.\n" + "You can also take back one of them to first end to correct the error.\n\n" + "Press G for Goat and C for Cabbage."; if (Input.GetKeyDown(KeyCode.C)) { moves = MovesList.fourthLevelWithCabbage; } else if (Input.GetKeyDown(KeyCode.G)) { moves = MovesList.fourthLevelWithGoat; } }
//Next Animal Pick void first_level_2() { text.text = "Here we are again at the bank of river.\n" + "Now there are Wolf and Cabbage at this end and Goat at another end.\n" + "What will you do?\n\n" + "Press W for Wolf and C for Cabbage"; if (Input.GetKeyDown(KeyCode.C)) { moves = MovesList.thirdLevelWithCabbage; } else if (Input.GetKeyDown(KeyCode.W)) { moves = MovesList.thirdLevelWithWolf; } }
public ActionResult Index(int tabletDeviceNumber, int newRoundNumber, int tableNotReadyNumber = -1) { TabletDeviceStatus tabletDeviceStatus = AppData.TabletDeviceStatusList[tabletDeviceNumber]; if (newRoundNumber > Utilities.NumberOfRoundsInEvent(tabletDeviceStatus.SectionID)) // Session complete { if (Settings.ShowRanking == 2) { return(RedirectToAction("Final", "ShowRankingList", new { tabletDeviceNumber })); } else { return(RedirectToAction("Index", "EndScreen", new { tabletDeviceNumber })); } } TableStatus tableStatus = AppData.TableStatusList.Find(x => x.SectionID == tabletDeviceStatus.SectionID && x.TableNumber == tabletDeviceStatus.TableNumber); if (tableStatus != null && tableStatus.RoundNumber < newRoundNumber) { // No tablet device has yet advanced this table to the next round, so show that this one is ready to do so if (tabletDeviceStatus.Direction == Direction.North) { tableStatus.ReadyForNextRoundNorth = true; } else if (tabletDeviceStatus.Direction == Direction.East) { tableStatus.ReadyForNextRoundEast = true; } else if (tabletDeviceStatus.Direction == Direction.South) { tableStatus.ReadyForNextRoundSouth = true; } else if (tabletDeviceStatus.Direction == Direction.West) { tableStatus.ReadyForNextRoundWest = true; } } MovesList movesList = new MovesList(tabletDeviceNumber, tableStatus, newRoundNumber, tableNotReadyNumber); ViewData["Header"] = $"{tabletDeviceStatus.Location}"; ViewData["Title"] = $"Show Move - {tabletDeviceStatus.Location}"; ViewData["ButtonOptions"] = ButtonOptions.OKEnabled; return(View(movesList)); }
void start_text() { text.text = "\t\t\t\t\tWelcome User!!\n\n" + " A man once had to travel with a wolf, a goat and a cabbage. He had to take good care of them, " + "since the wolf would like to taste a.piece of goat if he would get the chance, while the goat appeared " + "to long for a tasty cabbage. After some traveling, he suddenly stood before a river. This river could only" + " be crossed using the small boat laying nearby at a shore. The boat was only good enough to take himself and " + "one of his loads across the river. The other two subjects/objects he had to leave on their own. How must the " + "man row across the river back and forth, to take himself as well as his luggage safe to the other side of the river, " + "without having one eating another?\n" + "Now press P to play"; if (Input.GetKeyDown(KeyCode.P)) { moves = MovesList.firstLevel; } }
//First Level of the game void game_start() { text.text = "Ok! So, now that you know the situation what will you take with you first to cross the river?\n\n" + "Press G for Goat, W for Wolf and C for Cabbage"; if (Input.GetKeyDown(KeyCode.G)) { moves = MovesList.secondLevel; } else if (Input.GetKeyDown(KeyCode.W)) { moves = MovesList.gameOver; } else if (Input.GetKeyDown(KeyCode.C)) { moves = MovesList.gameOver; } }
// Entry point for moves which first validates input, then either passes on to validate move based on piece rules // Message is the button text public void Move(object message) { MoveText += (string)message; OnPropertyChanged(nameof(MoveText)); // If moveText is over 4 it is an invalid move, so reset moveText and return if (MoveText.Length > 4) { MoveText = ""; OnPropertyChanged(nameof(MoveText)); return; } // Don't allow player to move other's pieces or select empty spots if (IsBlacksTurn == !Board[8 - (int)char.GetNumericValue(MoveText[1])][(int)MoveText[0] - 65].Piece.IsBlack || Board[8 - (int)char.GetNumericValue(MoveText[1])][(int)MoveText[0] - 65].Piece.Name == '\0') { MoveText = ""; OnPropertyChanged(nameof(MoveText)); return; } if (ValidInputCheck(MoveText)) { // Converts input to valid Column/Row indices int sourceRow = 8 - (int)char.GetNumericValue(MoveText[1]); int sourceColumn = (int)MoveText[0] - 65; int destRow = 8 - (int)char.GetNumericValue(MoveText[3]); int destColumn = (int)MoveText[2] - 65; // Check if move if legal, if so legalMove will be 1, if game is won it will be 2 int legalMove = Board[sourceRow][sourceColumn].Piece.LegalMove(Board, sourceRow, sourceColumn, destRow, destColumn); if (legalMove == 1) { // Move the piece to it's new location in the GUI OnPropertyChanged(nameof(Board)); // After a valid move, switch who's turn it is IsBlacksTurn = !IsBlacksTurn; // Notifies GUI who's turn it is OnPropertyChanged(nameof(WhoTurn)); // Adds move to list and updates it on GUI MovesList.Insert(0, MoveText); OnPropertyChanged(nameof(MovesList)); ResetMoveText(""); } // LegalMove is 2 when a king is taken, so winning condition goes here if (legalMove == 2) { // Unused wongame variable, maybe remove WonGame = 1; // Move the piece to it's new location in the GUI OnPropertyChanged(nameof(Board)); // Adds move to list and updates it on GUI MovesList.Insert(0, MoveText); OnPropertyChanged(nameof(MovesList)); // Implement winning dialog HERE // Implement winning dialog HERE // Implement winning dialog HERE MessageBox.Show("WINNER!"); ResetMoveText(""); } // LegalMove is 3 when a pawn makes it to the other side & needs to be promoted if (legalMove == 3) { PromoteRow = destRow; PromoteColumn = destColumn; // IMPLEMENT PROMOTION HERE // IMPLEMENT PROMOTION HERE // IMPLEMENT PROMOTION HERE PromotePiece(); // Move the piece to it's new location in the GUI OnPropertyChanged(nameof(Board)); IsBlacksTurn = !IsBlacksTurn; // Notifies GUI who's turn it is OnPropertyChanged(nameof(WhoTurn)); // Adds move to list and updates it on GUI MovesList.Insert(0, MoveText); OnPropertyChanged(nameof(MovesList)); ResetMoveText(""); } } if (MoveText.Length > 2) { MoveText = MoveText.Remove(2); OnPropertyChanged(nameof(MoveText)); } }
void Start() { moves = MovesList.textDisplay; }