Fixes Affecting Simultation Results
- No longer forbid splitting of runs between same-suit cards when the stock has two cards left, even when neither the source nor target pile can be covered by a future deal. This optimization is incorrect, ie, it could force some winning games to be reported as losses.
- Previously, splitting runs between cards of the same suit was not allowed when the stock was empty when runs are moved by suit. Add the condition that `Card(rank=last_card.rank - 1, suit=last_card.same_color_suit)` must also be in the foundation or meet the criteria for being forced to the foundation when it appears (for such splits to be forbidden), where `last_card` is the last card in the run moved. The additional condition is because placing the same-color suit at the bottom of the pile makes the pile unmovable, and so it would matter whether or not the split was performed. So we only forbid splits when this cannot be the case.
Fixes Improving Run-Time
- When checking whether a card is the last in the pile (which is used to determine whether a tableau move should be forced), we previously failed to consider the card that would become last in a pile after the move. These cards are now considered.
- Add Optimization (9) to force the last deal if the two dealt cards will immediately be forced to the foundation according to the first part of Optimization (8d). Attributes were added to the `AgnesState` class to store the last and second to last card, whether they are of the same suit in sequence, and whether they are the same color, but not the same suit.
- Add Optimization (10) to sort the tableau piles that can no longer be covered by a deal before storing in or checking against the losing states set. The piles are sorted by their top card.
Other Changes
- Add src/, bin/, obj/ directories. Rename inc/ to include/
- Fix Issue 2 (help message for print_usage function in `quagnes.cpp`)
- Change constants defined using C-style `define` statements to `const` variables and modernize notation used for these.
- Add `same_color_suit` function to `Card` structure and `InFoundation` function to `AgnesState` class.
- Mark all functions as `const` when possible.
- analysis.R: add `fill.from.nosplit` function to get wins from `NoSplit` results when `Split` simulation does not finish. Remove a footnote from the output table as there are now so few incomplete games that the rounded results are the same whether the results are wins or losses.