samedi 18 juillet 2020

Somewhat related to Tombola game

I am coding for a game which goes as follows:Let there be one Moderator and ‘n’ Players. The moderator displays 10 random numbers (between 0 – 50) on a display screen with one-minute gap between the numbers. Each player is given a card containing 10 random numbers (between 0 - 50). As the number is displayed, the player strikes the number on his card if it matches with the one on the screen. The player who strikes three numbers first will be announced as a winner and the moderator stops generating numbers if a player wins before all the 10 numbers are generated. The numbers generated by the moderator and the player can be redundant. For e.g. if the moderator generates a 20 twice and if a player has one 20. After the player strikes the number, it should not be considered as a match, when 20 appears again on the display screen. The moderator generates 10 numbers and stores it in an array list of integers. When the moderator is generating the number, the players should not read the array list. The moderator should generate the next number only after all the players have read the previously generated number. The array list should not be accessed by all players at once.

Can anyone help with the code from scratch using java Multithreading and arraylist.No GUI needed.

Aucun commentaire:

Enregistrer un commentaire