ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Poor table balance with late registration and re-entries #1302

Closed ctm closed 5 months ago

ctm commented 6 months ago

Look at the table splits that happened in this evening's WYWAE TOC. It looks like 18 went to 6, 5, 4, 4 instead of 5, 5, 5, 4.

In this evening's tournament we had 18 players, and then someone joined and the tables wound up being different by two places rather than one. Although that should be allowed via attrition, I don't think we want that when splitting. Furthermore, after someone bust it coalesced back to 3x6 only to have that person re-enter (I think), which meant the tables split again. Ugh!

In addition to the behavior from this evening's game being annoying, there's a chance that a split of four tables into five could be even worse or even crash, so I'm going to need to look into this ASAP.

ctm commented 5 months ago

We started the game with 17 players (6, 6, 5). Player 1018 (SunnyGirl) became the 18th player. Player 48 (TrayRacer) was the 19th that caused the split. For whatever reason, two players (13 and 39, GamboMouse and Adbhowler) were moved from table 5648 and one (20, jrx) was moved from 5649 to the new table. So one of the sixes was turned to a four by having two moved from it. Once one was moved from the other table, the new table then had the proper number, so there was no need to take from the third table.

mb2=> select public_table_messages.id, received_at at time zone 'america/denver', message, table_id, hand_id from public_table_messages join tables on table_id = tables.id where variant in (11, 33, 34, 51, 52) and player_id is NULL and event_id = 5109 order by received_at asc;
    id    |          timezone          |                          message                           | table_id | hand_id 
----------+----------------------------+------------------------------------------------------------+----------+---------
 10435897 | 2024-02-01 19:00:00.400577 | {"NewPlayersAdded": [5109, [26, 39, 13, 19, 1046, 17]]}    |     5648 |        
 10435898 | 2024-02-01 19:00:00.45196  | {"NewPlayersAdded": [5109, [18, 10743, 20, 11, 32, 36]]}   |     5649 |        
 10435899 | 2024-02-01 19:00:00.487923 | {"NewPlayersAdded": [5109, [28, 10528, 35, 29, 14]]}       |     5650 |        
 10436454 | 2024-02-01 19:03:18.92935  | {"NewPlayersAdded": [5109, [1018]]}                        |     5650 |  391923
 10438707 | 2024-02-01 19:18:07.864222 | {"NewPlayersAdded": [5109, [48]]}                          |     5651 |  391981
 10438708 | 2024-02-01 19:18:07.878998 | {"MovedFrom": [13, 5648, "🐭GamboMouse", null]}            |     5651 |  391981
 10438709 | 2024-02-01 19:18:07.884258 | {"MovedTo": [13, 5651]}                                    |     5648 |  391979
 10438710 | 2024-02-01 19:18:07.904871 | {"MovedFrom": [20, 5649, "jrx", null]}                     |     5651 |  391981
 10438711 | 2024-02-01 19:18:07.909762 | {"MovedTo": [20, 5651]}                                    |     5649 |  391980
 10438712 | 2024-02-01 19:18:07.923774 | {"MovedFrom": [39, 5648, "Adbhowler", null]}               |     5651 |  391981
 10438713 | 2024-02-01 19:18:07.928247 | {"MovedTo": [39, 5651]}                                    |     5648 |  391979
 10440295 | 2024-02-01 19:25:33.44897  | {"Bust": [10743, null, 5109, 0, 11, 0, null, true, 1]}     |     5649 |  392036
 10440309 | 2024-02-01 19:25:40.430062 | {"MovedFrom": [18, 5649, "LingCod", null]}                 |     5651 |  392038
 10440310 | 2024-02-01 19:25:40.438149 | {"MovedTo": [18, 5651]}                                    |     5649 |  392036
 10440311 | 2024-02-01 19:25:40.454463 | {"MovedFrom": [11, 5649, "gerdog", null]}                  |     5648 |  392039
 10440312 | 2024-02-01 19:25:40.45912  | {"MovedTo": [11, 5648]}                                    |     5649 |  392036
 10440313 | 2024-02-01 19:25:40.47359  | {"MovedFrom": [32, 5649, "samarai", null]}                 |     5648 |  392039
 10440314 | 2024-02-01 19:25:40.478354 | {"MovedTo": [32, 5648]}                                    |     5649 |  392036
 10440315 | 2024-02-01 19:25:40.5013   | {"MovedFrom": [36, 5649, "mrstcao", null]}                 |     5651 |  392038
 10440316 | 2024-02-01 19:25:40.506202 | {"MovedTo": [36, 5651]}                                    |     5649 |  392036
 10440449 | 2024-02-01 19:26:19.783118 | {"NewPlayersAdded": [5109, [10743]]}                       |     5652 |  392037
 10440450 | 2024-02-01 19:26:19.799179 | {"MovedFrom": [32, 5648, "samarai", null]}                 |     5652 |  392037
 10440451 | 2024-02-01 19:26:19.80804  | {"MovedTo": [32, 5652]}                                    |     5648 |  392041
 10440452 | 2024-02-01 19:26:19.835799 | {"MovedFrom": [11, 5648, "gerdog", null]}                  |     5652 |  392037
 10440453 | 2024-02-01 19:26:19.846312 | {"MovedTo": [11, 5652]}                                    |     5648 |  392041
 10440454 | 2024-02-01 19:26:19.864436 | {"MovedFrom": [10528, 5650, "SurveyLady", null]}           |     5652 |  392037
 10440455 | 2024-02-01 19:26:19.87132  | {"MovedTo": [10528, 5652]}                                 |     5650 |  392037
 10440456 | 2024-02-01 19:26:19.88733  | {"MovedFrom": [28, 5650, "JADC🚴", null]}                  |     5652 |  392037
 10440457 | 2024-02-01 19:26:19.892184 | {"MovedTo": [28, 5652]}                                    |     5650 |  392037
...

I will actually write a test for this and make sure the test breaks, then I'll fix it. Of course I'll want to get tests working again (#1316) first. Oops.

ctm commented 5 months ago

Accidentally closed prematurely.

ctm commented 5 months ago

Done. Deploying now.