summaryrefslogtreecommitdiff
path: root/Userland/Games/Hearts
AgeCommit message (Collapse)Author
2022-08-22LibCards+Games: Replace card "value" int with a Rank enumSam Atkins
Because `card->value() == 11` is a lot less clear than `card->rank() == Cards::Rank::Queen`, and also safer. Put this, along with the `Suit` enum, in the `Cards` namespace directly instead of inside `Cards::Card`. Slightly less typing that way.
2022-08-22Hearts: Migrate to CardGameSam Atkins
2022-08-14Everywhere: Replace hardcoded anon's uid in unveil path with `%uid`Lucas CHOLLET
2022-08-14LibCore+LaunchServer: Move portal directory to `/tmp/user/%uid`Lucas CHOLLET
The `/tmp/user` directory is owned by root, this solution prevents malicious users to interfere with other users' portals. This commit also moves `launch`'s portal in the user directory.
2022-07-19LaunchServer+SystemServer: Move the portal to a user-specific directoryLucas CHOLLET
Various changes are needed to support this: - The directory is created by Core::Account on login (and located in /tmp). - Service's sockets are now deleted on exit (to allow re-creation) - SystemServer needs to handle SIGTERM to correctly destroy services.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-06-28Applications: Remove usages of deprecated implicit conversionsFrHun
These deprecated conversions are currently in place to make the system compile, but they are to be removed soon. This prepares that.
2022-05-13LibGUI+Userland: Make Dialog::ExecResult an enum classSam Atkins
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-18LibCards+Games: Change name of card type to card suitLenny Maiorani
Playing cards have a `suit` such as `hearts`/`diamonds`, not a `type`. Make the internal naming consistent with the way playing cards are typically named.
2022-03-18Hearts: Add icon to settings actionLinus Groh
2022-03-18Applications+Games: Drop ellipsis from settings actionLinus Groh
There is no second step to complete after activating this action.
2022-03-18Games: Add reload icon to 'New Game' actionsLinus Groh
2022-02-16Games: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-02-13Userland: Run gml-formatIdan Horowitz
This brings the existing GML files up to spec with the new requirements
2022-02-11LibConfig: Rename pledge_domains(String) => pledge_domain(String)Vitaly Dyachkov
pledge_domains() that takes only one String argument was specifically added as a shortcut for pledging a single domain. So, it makes sense to use singular here.
2022-02-07Meta+Userland: Run the GML formatter on CI and pre-commitkleines Filmröllchen
Now that the GML formatter is both perserving comments and also mostly agrees to the existing GML style, it can be used to auto-format all the GML files in the system. This commit does not only contain the scripts for running the formatting on CI and the pre-commit hook, but also initially formats all the existing GML files so that the hook is successfull.
2022-01-13Hearts: Add link to help pages in menuDavid Lindbom
2021-12-18Hearts: Convert to try_create_default_iconAstraeus-
2021-11-28Everywhere: Use default execpromises argument for Core::System::pledgeBrian Gianforcaro
2021-11-27Hearts: TRY() all the things in serenity_main() :^)Pedro Pereira
2021-11-24Hearts: Replace construct() with TRY(try_create()) patternPedro Pereira
2021-11-23Hearts: Port to LibMainPedro Pereira
Simplified one pledge() and two unveil() by using TRY().
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-09-13Everywhere: Use my fancy new serenityos.org email :^)Mustafa Quraish
2021-08-27Hearts: Remove `wpath` and `cpath` priviligesMustafa Quraish
There are no longer needed since the config file is not being modified by the application directly.
2021-08-27Hearts: Use LibConfig instead of Core::ConfigFileMustafa Quraish
2021-08-22Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to opennetworkException
This patch brings the ConfigFile helpers for opening lib, app and system configs more inline with the regular ConfigFile::open functions.
2021-08-22Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writingnetworkException
2021-08-18Userland+LibGUI: Add shorthand versions of the Margins constructorsin-ack
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same margin on all edges, for example. The constructors follow CSS' style of specifying margins. The added constructors are: - Margins(int all): Sets the same margin on all edges. - Margins(int vertical, int horizontal): Sets the first argument to top and bottom margins, and the second argument to left and right margins. - Margins(int top, int vertical, int bottom): Sets the first argument to the top margin, the second argument to the left and right margins, and the third argument to the bottom margin.
2021-07-24Hearts: Avoid reallocations for Vectors when possibleGunnar Beutner
2021-07-24Hearts: Use AK::get_random_uniform() instead of rand()/srand()Gunnar Beutner
2021-07-23Hearts: Avoid redrawing the UI unnecessarilyGunnar Beutner
2021-07-21Userland: Add GUI::Window::add_menu() and use it everywhereAndreas Kling
Applications previously had to create a GUI::Menubar object, add menus to it, and then call GUI::Window::set_menubar(). This patch introduces GUI::Window::add_menu() which creates the menubar automatically and adds items to it. Application code becomes slightly simpler as a result. :^)
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-06-06AK+Everywhere: Disallow constructing Functions from incompatible typesAli Mohammad Pur
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.
2021-06-04Hearts: Don't destroy the animation handler while running itGunnar Beutner
2021-06-02Hearts: Play the first valid card (left-to-right) when pressing spaceMatthew B. Jones
2021-06-01Hearts: Fix sorting for pick_low_points_high_value_cardGunnar Beutner
Previously the function did not sort the hand at all which means we wouldn't necessarily pick the card with the highest value.
2021-06-01Hearts: Prefer to pass high value cardsGunnar Beutner
Previously we'd prefer to pass high points cards. Instead we should prefer to pass high value cards first.
2021-06-01Hearts: Pick better non-matching cardsGunnar Beutner
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.
2021-06-01Hearts: Make debugging AI suggestions easierGunnar Beutner
When building Hearts with HEARTS_DEBUG we highlight the card the AI would have picked. This makes comparing AI and human decisions easier.
2021-06-01Hearts: Pick better cards when we're the third playerGunnar Beutner
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.
2021-06-01Hearts: Pick better lead cardsGunnar Beutner
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.
2021-05-26Hearts: Highlight cards when an invalid play is attemptedGunnar Beutner
This briefly inverts the selected card when the user attempts to make an invalid play.
2021-05-25Hearts: Don't advance the game's state when an animation is playingGunnar Beutner
Previously we'd end up cancelling an animation that was still playing when the user selects a card.
2021-05-25Hearts: Fix animations that get stuck "mid-flight"Gunnar Beutner
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.
2021-05-25Hearts: Add support for playing more than one handGunnar Beutner
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.