Skip to content

Latest commit

 

History

History
72 lines (61 loc) · 2.97 KB

File metadata and controls

72 lines (61 loc) · 2.97 KB

Solitaire Core

Features

  • Movement Validation
  • Undo Manager
  • Save Files
  • Basic Hint / Automatic Move Bot
  • Support for Embedded Swift

Embedded Swift Support

Embedded Swift is supported through a Swift package library, EmbeddedSolitaireCore. There is no alternate code for embedded Swift; the source directory for EmbeddedSolitaireCore is symlinked to the regular source directory of SolitaireCore.

Usage

Swift Package Manager

Add the following code to the dependencies of a Swift Package.

.package(url: "https://github.com/ActuallyTaylor/SolitaireCore", branch: "main"),

To add SolitaireCore as a dependency of a specific target, you must also add it to the target's dependencies.

.target(
    name: "Solitaire",
    dependencies: [
        .product(name: "SolitaireCore", package: "SolitaireCore")
    ],
)

Xcode

Add https://github.com/ActuallyTaylor/SolitaireCore to the package dependencies.

Embedded Swift

Including SolitaireCore into an embedded Swift project requires extra target settings for any targets depending on EmbeddedSolitaireCore. The code below outlines the necessary swiftSettings for a target using EmbeddedSolitaireCore. This code also includes an example of the target dependency.

.target(
    name: "EmbeddedSolitaire",
    dependencies: [
        .product(name: "EmbeddedSolitaireCore", package: "SolitaireCore")
    ],
    swiftSettings: [
        .enableExperimentalFeature("Embedded"),
        .unsafeFlags([
            "-whole-module-optimization",
            "-Xfrontend", "-disable-objc-interop",
            "-Xfrontend", "-disable-stack-protector",
            "-Xfrontend", "-function-sections",
            "-Xfrontend", "-gline-tables-only",
            "-Xcc", "-DTARGET_EXTENSION"
        ]),
    ]
)

Scoring

The following will cover how moves are scored in SolitaireCore. Included in the list will be implementation quirks to ensure any integrator of SolitaireCore is aware of them.

  • +5 points for uncovering a card.
  • +10 points for moving a card to the foundation.
    • If the same card is moved into the foundation repeatedly, it will not be scored.
    • This tracking is not saved in the save files generated by SolitaireCore. They are only valid for as long as the SolitaireGame object exists.
  • +5 points for moving a card from the waste into a column.
  • +3 points for moving a card from one pile to another.
    • Does not track if a card is being moved back and forth.
  • -15 points if a card is moved out of the foundation.
  • -100 points for every restock after the first restock in draw one.
  • -20 points for every restock after the fourth restock in draw three.

Scoring Source

Scoring is adopted from https://hands.com/~lkcl/hp6915/Dump/Files/soltr.htm, which is an explanation of the scoring system for the Microsoft Solitaire Collection as of Windows 7.