Uploaded by Ramzi65 ok

Seat Selection Program Code Explanation

advertisement
3.a
the purpose of the program is for the user to be able to select a random seat based on a grid
position without duplicates, as well as convey to the user which seats have already been
selected. The user clicks on the green box which selects a random seat then allows for this to
be repeated and reset as the user desires.
3.b
The list “Selected seats” contains the seats that have already been called, allowing for sprites to
use this information to update when a check is called for. The data being collected represents
the seats that have already been called, allowing for users to be able to visualize which seats
have been called. Storing this information in a list is more efficient because otherwise you’d
need a verrible for each sprite to toggle weather or not it’s been selected.
3.c
The procedure “Generate random” is to create a random set of coordantates that can be
compared to a list, then imputed into a list, this is used specifically when the green box is clicked
on, first generating a row, then a colum to join into a coordinate pair, to compair against a list
with the same formatting.
3.d
“Generate random” is used initially after the user input and by a different procedure “Selection
Check” again if the coordinates generated are duplicate. The first call waits for the user to select
the green box sprite with the cursor, while the second call compares the generated coordinates
to the ones already inserted into the list. With the results of both calls being a randomly
generated coordinate to compare to the list.
Download