April 2017
Beginner
504 pages
14h 11m
English
The ParallelGamePlayer class implements the Player interface that defines the play method:
@Override public void play() { Table table = new Table(NR_COLUMNS, manager); Secret secret = new RandomSecret(manager); Guess secretGuess = secret.createSecret(NR_COLUMNS); Game game = new Game(table, secretGuess); final IntervalGuesser[] guessers = createGuessers(table); startAsynchronousGuessers(guessers); final Guesser finalCheckGuesser = new UniqueGuesser(table); try { while (!game.isFinished()) { final Guess guess = guessQueue.take(); if (finalCheckGuesser.guessMatch(guess)) { game.addNewGuess(guess); } } } catch (InterruptedException ie) { } finally { stopAsynchronousGuessers(guessers); } }
This method ...
Read now
Unlock full access