Ras wrote: ↑
Sat Nov 21, 2020 12:05 pm
New feature idea: pausing tournaments. That would be useful for doing something else that needs processor power in-between, but without aborting the tournament. It could work as follows:
- Upon program start, c-chess-cli could print "press 'p' to pause tournament"
- Pressing the 'p' key for "pause"
- c-chess-cli prints "finishing ongoing games..."
- the ongoing games are finished, but no new ones started
- once all ongoing games have been finished, c-chess-cli prints "tournament paused, press 'r' to resume."
- Restarting would work via pressing 'r'.
- c-chess-cli would print "tournament resumed." and start the next games.
A different key for pause and resume would prevent the user from accidentally double-hitting the pause key and then being unclear about the state. Pressing 'r' before all ongoing games have been finished would just remove the pause state along with printing the "tournament resumed" message.
Another use case is system crashes, or computer switches off (eg. overheating). Or even a power cut. Could be the grid. Or your wife accidently stumbles on the wire while vacuming
So I would rather make the state persist in a tournament file, and be able to resume from that. This will also be much easier to implement than the interactive logic you propose (pausing/resuming threads is easier said than done, don't forget all these threads are busy waiting for blocking I/O). All I need to do is write a file with the argument list, the idx of the next game to play, and the (W,L,D) triplets for each pair.
The difficulty is that ongoing and mis-ordered games are lost, and can't be counted in the idx value. So I must only count the longest sequential sequence of completed games. For example, if we played (0,1,2,5,7,6,3), then (0,1,2,3) can be counted, and the tournament should resume with idx=4. Fortunately, I already have that logic built for sequential PGN output, so I can try to reuse it.
Regarding HGM's flexible concurrency, I think it could be viewed as a natural extension of this. You could specify the concurrency as you resume, overriding the original value. So you start with 8, then hit Ctrl+C, then resume with 6, etc. I would rather do it that way, than changing concurrency on the fly with the program still running, which is over-engineneering IMO.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.