private static BoardNode traverseBackwards(int spaces, int currentPosition) { BoardNode currentNode = board[currentPosition]; string category = ""; for (int i = 0; i < spaces; i++) { if (currentNode.backwards == null) { Console.WriteLine("You can't traverse Backwards"); return(null); } else { currentNode = currentNode.backwards; } } switch (currentNode.Category) { case 0: category = "Geography"; break; case 1: category = "Entertainment"; break; case 2: category = "History"; break; case 3: category = "Art"; break; case 4: category = "Science"; break; case 5: category = "Sports/Leisure"; break; case 6: category = "roll again"; break; } if (currentNode.position == blueStart || currentNode.position == pinkStart || currentNode.position == yellowStart || currentNode.position == purpleStart || currentNode.position == greenStart || currentNode.position == orangeStart) { Console.WriteLine("Moving Backwards " + spaces + " spaces will land you on the tile for a piece with " + category); } else { Console.WriteLine("Moving Backwards " + spaces + " spaces will land you on the tile with " + category); } return(currentNode); }
private static BoardNode traversePaths(int spaces) { Console.WriteLine("You are at the Center"); BoardNode blue = traverseAllPaths(spaces, 1); BoardNode pink = traverseAllPaths(spaces, 7); BoardNode yellow = traverseAllPaths(spaces, 13); BoardNode purple = traverseAllPaths(spaces, 19); BoardNode green = traverseAllPaths(spaces, 25); BoardNode orange = traverseAllPaths(spaces, 31); Console.WriteLine("Would you like to go down the Blue, Pink, Yellow, Purple, Green, or Orange Path?"); string choice = Console.ReadLine(); while (!choice.ToLower().Equals("blue") || !choice.ToLower().Equals("pink") || !choice.ToLower().Equals("yellow") || !choice.ToLower().Equals("green") || !choice.ToLower().Equals("orange")) { ClearConsole(); Console.WriteLine("Incorrect input"); Console.WriteLine("You are at the center would you like to go down the Blue, Pink, Yellow, Purple, Green, or Orange Path?"); choice = Console.ReadLine(); } switch (choice.ToLower()) { case "blue": return(blue); case "pink": return(pink); case "yellow": return(yellow); case "purple": return(purple); case "green": return(green); case "orange": return(orange); } return(null); }
private static BoardNode traverseStraight(int spaces, int currentPosition) { BoardNode currentNode = board[currentPosition]; string category = ""; for (int i = 0; i < spaces; i++) { if (currentNode.myType() == 1) { Console.WriteLine("You can move " + i + " spaces to the Center"); return(new BoardNode(0) { position = spaces - i, Category = -1 }); } if (currentNode.straight == null) { Console.WriteLine("You can't traverse Straight"); return(null); } currentNode = currentNode.straight; } switch (currentNode.Category) { case 0: category = "Geography"; break; case 1: category = "Entertainment"; break; case 2: category = "History"; break; case 3: category = "Art"; break; case 4: category = "Science"; break; case 5: category = "Sports/Leisure"; break; case 6: category = "roll again"; break; } if (currentNode.position == 0) { Console.WriteLine("Moving Straight " + spaces + " spaces will land you on the Center tile"); } else { Console.WriteLine("Moving Straight " + spaces + " spaces will land you on the tile with " + category); } return(currentNode); }