# FIRST ROUND OF ELIMINATION - NEOXIAN CITY JINX GAME

in Game Developmentlast year (edited)

Hello folks and welcome to another episode on the jinx game project, In this episode, I will be expanding on the logic and algorithm behind the first round of elimination called the NORMAL - WIN.

First and foremost, I want to summarize briefly on the player parameters. based on the rules of the game, the player stats is contained in a class defination below.

The logic behind this game is heavily reliant on the index positions of arrays. for instance, the line of code below stores the difference between the original player guess and the random generated number into an array called "closest_guess".

This array would be used to determine which player is closest to the random number.

Then I begin the next stage of elimination on the data, I had to scan the data according to the rule, rules no.8 and no. 9 state that; dragon jinx and meta dragon players are not eligible to earn a normal win.

So I used a conditional statement to exclude those players
from grabbing the win. The dropdown value of dragon jinx and meta dragon are stored with 7 and 8 which are excluded respectively.

The normal qualifiers are added dynamically to a list called normal_win_numbers, I prefer using descriptive names when naming my variables, more easy to understand.

Now, I could easily call a min function on the difference array to get the positional value of the closest guess, but what if two players make the same guess, I developed a coin flip logic to determine who gets the win in such cases.

For example, this snippet of code below counts the duplicates occurrences and uses that as a determinant for a coin flip.

The coin flip logic is contained within the conditional statements below, basically, a random number is generated based on the duplicate counter as the max value.

As I said earlier this script is heavily reliant on Indexing, so the positional value of the coin flip is stored in the win_position_idex.

This win_position_idex will be the value that secured the normal win but there is still other hurdles to climb. this normal win can be jinx or stolen away.

In the next episode, I will talk about the logic in the next phase of the elimination, the index position of the player which is initialized in the player-stats class above would be scanned against other players to see who is attacking him/her.

Below is the GUI preview of how the game runs. See you next time :-)

Sort:

Nice. Are you programming Jinx game.

Yes brother... I've actually already submitted a working prototype to Sir Neo. just waiting for the approval.

Nice

last year Reveal Comment