Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (60 points) For this assignment you will be creating the lobby for a game. In normal game lobbies players will connect to the lobby

image text in transcribedimage text in transcribed

3. (60 points) For this assignment you will be creating the lobby for a game. In normal game lobbies players will connect to the lobby and then signal for the game to start. Although this is normally done over network, we will be simulating this using only a local computer To do this project you will need three things e a Lobby class . a Player class e and a Player_state enum The lobby class has two jobs: to hold all the players and to check if they are all ready to start the game. So, this is what you will need for the Lobby class Instance variables representing lobby_id *Note that this id MUST be unique to the lobby, so if we make a bunch of lobbies at the same time none of them should have the same id The list of players The maximum size of the lobby The minimum number of players required to start the game e Constructor - initializes lobby_id should initialize the min number of players and the max size of the lobby - the list of players is initially empty Instance functions - check_if_all_players_ready ) -checks if all the players are ready - check_if_ready to_start_game) - checks if the number of players is within the specified range, and if all the players are ready - start_gameC) - starts the game and you just need to print "Game Started" - join_game (Player player_id) -connects a player to the game and adds the player to the list of players - leave_game (Player player_id) disconnects a player from the game and removes the player from the list of players. The Player class represents a player for our lobby, so it needs to have a player's state Instance variables representing - player id - like the lobby id this needs to be unique for this player, so any 2 players will never have the same ids lobby_id this is the lobby id of the lobby we are currently connected to. If we are not connected to a lobby this should be -1 - player state -this value holds the state of the player. It is a Player_state enum so it can be several different things to consider (read the next part to figure out what this holds) e Constructor this will initialize lobby_id, player_id, and player_state

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

LO2 Explain the major laws governing employee compensation.

Answered: 1 week ago