Jump to content

Shuffle array based on ELO rating


Staggan
Go to solution Solved by Barand,

Recommended Posts

Hello

I am looking for some help....

 

I am trying to shuffle an array based on an ELO rating as part of a tournament system....

 

I currently select the teams taking part and create an array which is currently ordered by their team ID... but this can result in tournaments where the competitors in each round are always the same

 

Instead I would to order the array by the teams ELO which is a numerical rating from 0 upwards

 

 

What I would like to do is as follows:

 

At the start of each round split the array into 2...  so one new array contains teams with higher ELOs and another with the lower

 

Then randomize each array

 

Then add the arrays back together taking one element from each of the two arrays at a time...

 

Ending up with something like...

 

Array 1 element 1

Array 2 element 1

Array 1 element 2

Array 2 element 2

 

and so on...

 

I also need it to work with an odd number of teams to start

 

With the final array my system then creates the tournament games and rounds etc....

 

I have no idea where to start.. so any suggestions would be greatly appreciated

 

Thanks

 

 

 

Link to comment
Share on other sites

I almost have this working now...

 

But how do I combine my two final, shuffled arrays back into a single array without one just being tagged on the end of the other..

 

This is what I want to do:

 

Array1  =  1,3,5,7

Array2 = 2,4,6,8

 

finalArray = 1,2,3,4,5,6,7,8

 

 

So my merge takes 1 element from each array at a time when merging...

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.