D
D
DESAR2011-04-20 02:23:09
MySQL
DESAR, 2011-04-20 02:23:09

Organization of the standings

Hello.


In the course of work on the game project, the task of creating a tournament grid became.
Here is a good example of what I need.
image

But the question arose, how can I store all this in the database?
Not a single sensible idea has yet come to mind. I count on your advice.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
mark_ablov, 2011-04-20
@mark_ablov

match table, where there are fields - id, id of players, match position (in level), match level (1/32, 1/16, ...), status (ongoing, is there a winner, ...)
the match ends, level++, position = position / 2.

W
whynot, 2011-04-20
@whynot

I have an implementation of such a thing, you can write to habramail - I will gladly share the structure

J
jtraub, 2011-04-20
@jtraub

The leaderboard is essentially a binary tree (and this is the so-called full binary tree), so you need to look for a representation of binary trees in relational databases.
I looked at the profile - you know PHP, which means a good place to start from:
phpclub.ru/faq/Tree?v=w5u

E
Evgeny Bezymyannikov, 2011-05-12
@psman

i would number all games and store 3 records: player1 id, player2 id, winner id
15 lines

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question