You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open two websockets, ws1 and ws2. On ws1 we claim the guess and check the result.
If we won, we close ws2 then ws1. Otherwise we close ws1 then ws2.
This works because the websocket saves the balance inside itself on initialization, and commits it to the user's balance without checking for concurrent modifications. This way we can have two sockets open and choose which one (a guaranteed 0 or a random -1/1) we want to pick.
The "intended" solution is more complex, so I guess this one was not intended?
The text was updated successfully, but these errors were encountered:
The solution is as follows:
This works because the websocket saves the balance inside itself on initialization, and commits it to the user's balance without checking for concurrent modifications. This way we can have two sockets open and choose which one (a guaranteed 0 or a random -1/1) we want to pick.
The "intended" solution is more complex, so I guess this one was not intended?
The text was updated successfully, but these errors were encountered: