/** * The core of the Hangman game * * @author Leon Traill * @version 0.01 */ public class GameSystem { private Dictionary dictionary; private Word word; public String currentWord; public static void main(String[] args) { GameSystem game = new GameSystem(); } public GameSystem() { dictionary = new Dictionary(); word = new Word(); } /** * Starts the game */ public void startGame() { dictionary.readDictionaryFile(); word.wordToConvert = dictionary.chooseNewWord(); word.wordArray = word.wordToConvert.toCharArray(); word.checkUsedBefore(); if( word.usedBefore == true ) { System.out.println("Word has been previously used: " + word.wordToConvert + ". Picking another.."); startGame(); } else { word.addWord(); dictionary.wordCount++; System.out.println("******** GAME HAS STARTED ********"); System.out.println("Word number: " + dictionary.wordCount); // Displays current word for debugging System.out.println(word.wordToConvert); word.convertToDashes(); } } /** * End the current game after 10 rounds, display player's score */ public void endGame() { System.out.println("******** GAME HAS ENDED ********"); //CurrentScore(); } /** * Checks user guesses for characters */ public void playerGuess(char charGuess) { word.charGuess = charGuess; word.checkGuess(); if( word.correctGuess == true ) { System.out.println("Correct guess: " + charGuess); } else { System.out.println("Incorrect guess: " + charGuess); } } public void currentScore() { // Keep count of score, based on win or lose } }