Age | Commit message (Collapse) | Author |
|
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
|
|
|
|
Now that the cards have rounded corners, draw the stack box behind the
cards with rounded corners as well. This way, the corner of the stack
box doesn't peek out from behind the cards.
The caveat here is that the "play" card stack now needs to hold a
reference to the "waste" stack beneath it so it knows when not to draw
its background on top of the waste stack. To faciliate that, the array
of card stacks is now a NonnullRefPtrVector so the play stack can store
a smart pointer to the waste stack (instead of a raw pointer or
reference).
|
|
|
|
Also shifts logic of starting game length timer into function
`start_timer_if_necessary`, so it can be called from original
mouse event handler and new `auto_move_eligible_cards_to_stacks`
|
|
|
|
|
|
|
|
Previously the function did not sort the hand at all which means we
wouldn't necessarily pick the card with the highest value.
|
|
Previously we'd prefer to pass high points cards. Instead we should
prefer to pass high value cards first.
|
|
When we don't have a matching card for the lead card rather than
always preferring to play hearts we should try to get rid of our
high value cards first if no other player has hearts cards higher
than what we have.
|
|
When building Hearts with HEARTS_DEBUG we highlight the card the AI
would have picked. This makes comparing AI and human decisions easier.
|
|
When we're the third player in a trick and we don't have a lower value
card we would previously pick a slightly higher value card. Instead
we should pick the highest value card unless there are points in the
current trick or the lead card is spades and the higher value card
we would've picked is higher than the queen and another player still
has the queen.
The rationale is that we have to take the trick anyway so we might as
well get rid of our highest value card. If the trailing player has a
lower value card of the same type we take the trick but don't gain
any points. If they don't have a card of the same type it doesn't
matter whether we play a high value or low value card.
|
|
Previously the AI would prefer playing a lead card for which no other
player had a card with a higher value even though it also had a card
for which a higher value card was still in play.
|
|
Starts the game timer when the first card is clicked or moved instead of
when a new game is started.
Fixes #7489
|
|
This briefly inverts the selected card when the user attempts to make
an invalid play.
|
|
With different scoring rules for one-card vs. three-card draw mode, it
makes more sense to separately track their high scores.
|
|
The exact formula used for bonus points seems to vary by implementation.
This uses Klondike Solitaire's formula:
https://en.wikipedia.org/wiki/Klondike_(solitaire)#Scoring
|
|
Currently, the player loses 100 points each time the waste stack is
recycled. In three-card draw mode, it's standard to only lose 20 points
after the third recycle event.
|
|
This invocation will exit immediately. There's also no reason to invoke
stop_game_over_animation here because that's the first thing that will
happen in the call to setup.
|
|
Doesn't make much sense to update the high score on a lost game.
|
|
Previously we'd end up cancelling an animation that was still playing
when the user selects a card.
|
|
When an animation is stopped the cards should be moved to their final
position anyway. Otherwise they might end up getting stuck in the
middle of the animation.
|
|
This changes the game so that more than one hand can be played. Once
one player has 100 or more points the game ends. A score card is shown
between each hand.
Fixes #7374.
|
|
When there are no human players (toggled with Shift-F10) the AI will
continuously start new games when the current game has finished.
|
|
Fixes #7375.
|
|
|
|
|
|
|
|
|
|
|
|
Added a new settings dialog to Hearts with a textbox to allow the
player to set a name, which is persisted in the Hearts config file.
|
|
A single card can be played with F10 while Shift-F10 toggles the AI
for the current as well as all future tricks.
|
|
When picking a lead card the AI should avoid playing cards where it
knows that no other player has a lower value card of the same type.
|
|
The pick_lead_card() function sometimes picks the incorrect card
because the sorted_hand vector wasn't being sorted properly.
|
|
Instead of picking the card with the lowest value we should pick the
card with the highest value for which we know no lower value card is
in play anymore and that someone else still has an even higher value
card.
|
|
Previously in a trick like 2S, KS, 5S we'd rather follow up with AS
instead of QS. We should prefer to play QS in this case.
|
|
This ensures that the preceding animation is stopped first.
|
|
|
|
|
|
|
|
|
|
This reverts commit 800ea8ea969835297dc7e7da345a45b9dc5e751a.
Booting the system no longer worked after these changes.
|
|
Problem:
- `static` variables consume memory and sometimes are less
optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
every time the function is run.
Solution:
- If a global `static` variable is only used in a single function then
move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
`constexpr`.
|
|
|
|
Ask for a bold_variant() of the default_fixed_width_font() instead.
|
|
Instead use default_font().bold_variant() in cases where we want a bold
variant of the default font. :^)
|
|
Currently, it is possible for the player to drag an entire stack
of cards to the foundation stack, provided the top card of the stack
(i.e the "root" card) can be dropped onto the foundation stack.
This causes an invalid state where, e.g, red cards end up in a
black foundation stack, or vice versa.
|
|
- Make the ball chill out a bit by reducing its x velocity by 1.
- Make the AI dumber. It now relaxes until the ball is coming towards it
and is in its half of the court.
|
|
The game waited for the next key down event before moving the player
paddle. Now the state of the arrow keys is carried over between resets.
|