Class Display
java.lang.Object
ubc.team09.view.Display
A class with static methods to display information and prompt users for
input via the CLI.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()static voidprintBlinkingText(int line, String text) static voidprintBoard(State state, String label) Prints a board state to the console.static voidprintBoard(State state, String label, String blackName, String whiteName) Prints a board state to the console.static voidprintGameBoard(BoardState state, int lastMove, String label, String blackName, String whiteName, LinkedList<String> messages) Prints a board state to the console.static voidprintSystemMessages(LinkedList<String> messages) static voidstatic StringPrompts the user for an input string, but only accepts values specified byoptions.static StringPrompts the user for a string, but only allows values specified byoptions.static intPrompts the user for an integer input.static StringpromptString(String prompt) Prompts the user for a string input.
-
Method Details
-
promptString
-
promptInt
Prompts the user for an integer input. -
prompt
Prompts the user for a string, but only allows values specified byoptions. E.g.,// The key of the map is an allowed option, and the value is a short // description. The description should be less than ~50 characters. Map<String, String> options = new HashMap<>(); options.put("Agedashi Tofu", "Fried tofu in tempura sauce"); options.put("Green Salad", ""); options.put("Yakitori", "2 chicken skewers"); String chosenItem = Display.prompt( "Choose an item from the menu.", options ); // `chosenItem` will be one of the keys from the `options` map. -
prompt
-
printText
-
printBlinkingText
-
printSystemMessages
-
printGameBoard
public static void printGameBoard(BoardState state, int lastMove, String label, String blackName, String whiteName, LinkedList<String> messages) Prints a board state to the console.- Parameters:
state-label-blackName-whiteName-
-
printBoard
-
printBoard
-
clear
public static void clear()
-