Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose you are designing a multi-player game that has n = 1000 players, numbere

ID: 3641238 • Letter: S

Question

Suppose you are designing a multi-player game that has n = 1000 players, numbered 1 to n, interacting in an enchanted forest. The winner of this game is the first player who can meet all the other players at least once (ties are allowed). Assuming that there is a function meet(i, j), which is called each time a player i meets a player j (with i ? j), describe a way to keep track of the pairs of meeting players and who is the winner.

I have an algorithm that could work in mind but dont know how to implement it
I need a table NxN filled with 0 and at the diagonal where i=j we give the value of 1
I need as well 2 random number generators(generate numbers from 1 to n for i and j) whenever a number is generated means that those two players have met so i go to the table and add 1
Plus i need an extra array from 1 to n to keep the count so that when count=to n winner is the player with the position in that array
Thank you in advance!

Explanation / Answer

Yes your way is correct:
You need a 2 dimension array NxN filled with 0 and at the diagonal where i=j we give the value of 1
generate 2 random number (generate numbers from 1 to n for i and j) whenever a number is generated means that those two players have met so i go to the table and add 1 to [i][j] index as well as[j][i] index of an array.

Plus you need an extra array from i=1 to i= n to keep the count of meeting . ith element for ith person so that when count= n of any element (suppose ith) then winner is the player with the position in that array.

Before adding 1 to [i][j] and [j][i] index when i meets j, check whether the element of that index is 0
if it is zero, just add +1 to ith element of an extra array
else continue.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote