Jump to content

Recommended Posts

Hey all. I have what I think may be a fairly complex problem to solve, and I'm sure there are many solutions. I'd like your opinions. Here's the rundown. I'd like to create a "ladder" for a company table tennis league. This is how the ladder works:

[*]Players are, at first, randomly assigned a rank

[*]Players can challenge any player up to 5 ranks above them

[*]If the higher-ranked player wins, nothing changes

[*]If the lower-ranked player (the challenger) beats the higher-ranked player, the lower-ranked player takes the higher rank. The higher rank player drops down one rank

 

To clarify, an example:

[*]Molly (ranked 5) challenges James (ranked 3)

[*]Molly wins the match

[*]Molly is now ranked 3

[*]James is now ranked 4

 

How do I accomplish this? Should I store the ladder in its own table? Should I store players' ranks in their respective rows in the players table? Either way, I'll need to update every record in the table to reflect the new rankings. Is that a reasonable way of doing things? Is there a better way?

 

Thanks, guys. :)

Link to comment
https://forums.phpfreaks.com/topic/224685-table-tennis-ladder/
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.