Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: chesskit-app/chesskit-swift
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.7.0
Choose a base ref
...
head repository: chesskit-app/chesskit-swift
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on May 7, 2024

  1. Copy the full SHA
    74decbf View commit details
  2. Copy the full SHA
    347494f View commit details
  3. Fix move tree previous index calculation (#24)

    * Fix issue in `MoveTree.previousIndex(for:)` when provided index is
    equal to `minimumIndex.next`.
    * Regression occurred after introduction of `minimumIndex` property in
    `MoveTree`.
    pdil authored May 7, 2024
    Copy the full SHA
    ab2c180 View commit details
  4. Update .gitignore

    pdil committed May 7, 2024
    Copy the full SHA
    ca7ad01 View commit details
  5. Apply .gitignore changes

    pdil committed May 7, 2024
    Copy the full SHA
    dcdb0a1 View commit details
  6. Prepare for 0.7.1 release

    pdil committed May 7, 2024
    Copy the full SHA
    9c522f7 View commit details
  7. Release version 0.7.1 (#25)

    `ChessKit 0.7.1` release candidate.
    pdil authored May 7, 2024
    Copy the full SHA
    445d1fd View commit details
  8. Added U-FE0E variant selector to the black pawn

    This selector forces the black pawn to be printed as a Unicode symbol. It's extremely useful if somebody wants to test directly on the preview/simulator, as iOS devices natively display the black pawn emoji. Things remain unchanged for the terminal
    joee-ca committed May 7, 2024
    Copy the full SHA
    ac42f4e View commit details
  9. Implemented logic for draw by insufficient material condition

    Everything is working, but probably could be refined a bit. Remove the comments if needed.
    Tests still to be implemented.
    joee-ca committed May 7, 2024
    Copy the full SHA
    9eee4c5 View commit details
  10. Copy the full SHA
    8bb01ee View commit details
  11. Copy the full SHA
    e469a5e View commit details
  12. Deleted useless lines

    joee-ca committed May 7, 2024
    Copy the full SHA
    0f66505 View commit details
  13. Implemented functionality that was previously overlooked (2 knights+k…

    …ing VS king)
    
    The check for this specific type of insufficient material draw wasn't placed within its own switch case (case 4: ...) to avoid duplicating the code already present in the default case (the part related to the same square color bishops check)
    joee-ca authored May 7, 2024
    Copy the full SHA
    cf556e3 View commit details
  14. Reverting last commit because I'm dumb

    sorry
    joee-ca authored May 7, 2024
    Copy the full SHA
    f4ada45 View commit details

Commits on May 8, 2024

  1. Copy the full SHA
    ff343fe View commit details
  2. Copy the full SHA
    7c1f26b View commit details
  3. Copy the full SHA
    2dcd692 View commit details
  4. Copy the full SHA
    955f80c View commit details
  5. Copy the full SHA
    4ae9d57 View commit details
  6. Copy the full SHA
    7ba6b20 View commit details

Commits on May 9, 2024

  1. Copy the full SHA
    7089cfd View commit details
  2. Copy the full SHA
    d023e5f View commit details
  3. Copy the full SHA
    23adb0b View commit details
  4. Copy the full SHA
    0b98574 View commit details
  5. Merge remote-tracking branch 'refs/remotes/origin/master'

    Conflicts:
    	Sources/ChessKit/Bitboards/Bitboard.swift
    joee-ca committed May 9, 2024
    Copy the full SHA
    22bda98 View commit details
  6. Added tests for insufficient Material

    I don't like the wayt these tests came out, but they work
    joee-ca committed May 9, 2024
    Copy the full SHA
    411af75 View commit details
  7. Added tests for insufficient Material

    I don't like the way these tests came out, but they work
    joee-ca authored May 9, 2024
    Copy the full SHA
    65a2e90 View commit details

Commits on May 10, 2024

  1. Add U-FE0E variant selector and implement logic for draw by insuffici…

    …ent material condition (#26)
    pdil authored May 10, 2024
    Copy the full SHA
    4556cd8 View commit details
  2. Update changelog with insufficient material draw changes

    Also performed minor refactor of insufficient material logic and added delegate test.
    pdil committed May 10, 2024
    Copy the full SHA
    68d0413 View commit details
  3. Fixed insufficient material logic

    All bishops needs to be considered. Also the checks are not done properly
    joee-ca committed May 10, 2024
    Copy the full SHA
    912d935 View commit details
  4. Copy the full SHA
    7dae70b View commit details
  5. Removed useless insufficientMaterial check (fen2)

    The position was already not a draw (white square bishop VS black square bishop). The promotion move doesn't change anything.
    fen3  - fen4 - fen5 -> fen2 - fen3 - fen4
    joee-ca committed May 10, 2024
    Copy the full SHA
    f2a7747 View commit details

Commits on May 13, 2024

  1. Fixed insufficientMaterial() test in BoardTests.swift

    Now the black bishop is on the right square
    joee-ca committed May 13, 2024
    Copy the full SHA
    016b444 View commit details
  2. Copy the full SHA
    35763b9 View commit details

Commits on May 27, 2024

  1. Copy the full SHA
    1318305 View commit details

Commits on Jun 7, 2024

  1. Copy the full SHA
    0af7849 View commit details
  2. Copy the full SHA
    e637a4c View commit details
  3. Copy the full SHA
    44749d2 View commit details
  4. Add separate castling tests file (#29)

    * Moved castling tests to a separate file as the number of tests is
    growing.
    * Removed some redundant `return`s in `Castling.swift`
    pdil authored Jun 7, 2024
    Copy the full SHA
    1ceafdb View commit details
  5. Prepare for 0.8.0 release

    pdil committed Jun 7, 2024
    Copy the full SHA
    18622e3 View commit details
  6. Release version 0.8.0 (#30)

    `ChessKit 0.8.0` release candidate.
    pdil authored Jun 7, 2024
    Copy the full SHA
    dd6eb04 View commit details
  7. Fix version number in readme

    pdil committed Jun 7, 2024
    Copy the full SHA
    82834b4 View commit details

Commits on Jun 8, 2024

  1. Copy the full SHA
    c20954f View commit details
  2. Copy the full SHA
    690d015 View commit details
  3. Remove redundant returns

    pdil committed Jun 8, 2024
    Copy the full SHA
    05f86d7 View commit details
  4. Standardize comment formatting

    pdil committed Jun 8, 2024
    Copy the full SHA
    164b23d View commit details
  5. Improve comment formatting and other small miscellaneous changes (#31)

    * Removed `CustomDebugStringConvertible` conformance on `Bitboard` as
    this was causing every `UInt64` to debug print as a chess board (funny
    but not ideal).
      * `Bitboard.chessString()` can be used to obtain the same string.
    * Improved documentation comment formatting.
    * Removed unnecessary "safe" dictionary subscript for `Bitboard`
    dictionaries (replaced with `default:`)
    * Removed redundant `return` keyword where possible.
    pdil authored Jun 8, 2024
    Copy the full SHA
    70ec237 View commit details

Commits on Jun 13, 2024

  1. Copy the full SHA
    6a1ac00 View commit details

Commits on Jun 14, 2024

  1. Copy the full SHA
    1187653 View commit details
  2. Add move tree collection tests

    pdil committed Jun 14, 2024
    Copy the full SHA
    7ee28c7 View commit details
Showing with 5,732 additions and 5,033 deletions.
  1. 0 codecov.yaml → .codecov.yaml
  2. +6 −0 .git-blame-ignore-revs
  3. +8 −7 .gitignore
  4. +15 −0 .swift-format
  5. +0 −8 .swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  6. +0 −64 ...code/xcshareddata/xcbaselines/ChessKitTests.xcbaseline/5265628F-744A-4498-99EB-06953EBFEB75.plist
  7. +0 −33 .swiftpm/xcode/xcshareddata/xcbaselines/ChessKitTests.xcbaseline/Info.plist
  8. +104 −17 CHANGELOG.md
  9. +16 −25 Package.swift
  10. +37 −21 README.md
  11. +284 −282 Sources/ChessKit/Bitboards/Attacks.swift
  12. +111 −118 Sources/ChessKit/Bitboards/Bitboard.swift
  13. +164 −172 Sources/ChessKit/Bitboards/PieceSet.swift
  14. +13 −13 Sources/ChessKit/Bitboards/Square+BB.swift
  15. +526 −486 Sources/ChessKit/Board.swift
  16. +9 −9 Sources/ChessKit/Clock.swift
  17. +33 −34 Sources/ChessKit/Configuration.swift
  18. +334 −350 Sources/ChessKit/Game.swift
  19. +119 −119 Sources/ChessKit/Move.swift
  20. +0 −401 Sources/ChessKit/MoveTree.swift
  21. +75 −0 Sources/ChessKit/MoveTree/MoveTree+Collection.swift
  22. +48 −0 Sources/ChessKit/MoveTree/MoveTree+Deprecated.swift
  23. +104 −0 Sources/ChessKit/MoveTree/MoveTree+Index.swift
  24. +389 −0 Sources/ChessKit/MoveTree/MoveTree.swift
  25. +0 −85 Sources/ChessKit/MoveTreeIndex.swift
  26. +6 −6 Sources/ChessKit/Parsers/EngineLANParser+Regex.swift
  27. +88 −92 Sources/ChessKit/Parsers/EngineLANParser.swift
  28. +129 −132 Sources/ChessKit/Parsers/FENParser.swift
  29. +16 −15 Sources/ChessKit/Parsers/PGNParser+Regex.swift
  30. +292 −293 Sources/ChessKit/Parsers/PGNParser.swift
  31. +18 −18 Sources/ChessKit/Parsers/SANParser+Regex.swift
  32. +238 −242 Sources/ChessKit/Parsers/SANParser.swift
  33. +101 −114 Sources/ChessKit/Piece.swift
  34. +224 −185 Sources/ChessKit/Position.swift
  35. +117 −110 Sources/ChessKit/Special Moves/Castling.swift
  36. +25 −23 Sources/ChessKit/Special Moves/EnPassant.swift
  37. +225 −194 Sources/ChessKit/Square.swift
  38. +3 −3 Sources/ChessKit/Utilities/Comparable+Bounded.swift
  39. +482 −323 Tests/ChessKitTests/BoardTests.swift
  40. +67 −0 Tests/ChessKitTests/CastlingTests.swift
  41. +308 −298 Tests/ChessKitTests/GameTests.swift
  42. +91 −91 Tests/ChessKitTests/MoveTests.swift
  43. +99 −0 Tests/ChessKitTests/MoveTreeTests.swift
  44. +48 −32 Tests/ChessKitTests/Parsers/EngineLANParserTests.swift
  45. +87 −87 Tests/ChessKitTests/Parsers/FENParserTests.swift
  46. +78 −60 Tests/ChessKitTests/Parsers/PGNParserTests.swift
  47. +78 −78 Tests/ChessKitTests/Parsers/SANParserTests.swift
  48. +184 −184 Tests/ChessKitTests/Performance/BoardPerformanceTests.swift
  49. +27 −0 Tests/ChessKitTests/Performance/PGNParserPerformanceTests.swift
  50. +101 −101 Tests/ChessKitTests/PieceTests.swift
  51. +65 −65 Tests/ChessKitTests/SpecialMoveTests.swift
  52. +62 −43 Tests/ChessKitTests/SquareTests.swift
  53. +34 −0 Tests/ChessKitTests/Utilities/MockBoardDelegate.swift
  54. +28 −0 Tests/ChessKitTests/Utilities/SampleGames.swift
  55. +16 −0 Tests/ChessKitTests/Utilities/SamplePositions.swift
File renamed without changes.
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# List of commits to ignore on git-blame.
#
# To activate run `git config blame.ignoreRevsFile .git-blame-ignore-revs`

# swift format
873661ac5bc64f0194a4a0addbc40c2d83d01b50
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.DS_Store
/.build
/Packages

# SPM
.swiftpm
.build
Packages/

# Xcode
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
xcuserdata/
15 changes: 15 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": 1,
"indentation": {
"spaces": 2
},
"indentConditionalCompilationBlocks": false,
"lineBreakBetweenDeclarationAttributes": false,
"lineLength": 200,
"multiElementCollectionTrailingCommas": false,
"respectsExistingLineBreaks": true,
"rules": {
"NoAccessLevelOnExtensionDeclaration": false,
"UseWhereClausesInForLoops": true
}
}

This file was deleted.

This file was deleted.

This file was deleted.

121 changes: 104 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,154 @@
# ChessKit 0.13.0
Released Thursday, October 3, 2024.

### New Features
* `BoardDelegate` now notifies when king is in check, and provides the color of the checked king, see [Issue #38](https://github.com/chesskit-app/chesskit-swift/issues/38).
* `Move.checkState` and `Move.disambiguation` are now publicly accessible, see [Issue #38](https://github.com/chesskit-app/chesskit-swift/issues/38).

### Technical Changes
* Enable Swift 6 language mode package-wide.
* `Game` and `MoveTree` are now `Sendable` types.

# ChessKit 0.12.1
Released Wednesday, September 11, 2024.

### Bug Fixes
* Fix `MoveTree.fullVariation(for:)` returning blank array when `.minimum` is passed as the index.
* If this index is passed, it will automatically start from the next (valid) index and return the moves for that index.
* In practice this will mean the main variation will be returned (starting from white's first move).

# ChessKit 0.12.0
Released Wednesday, August 21, 2024.

### Improvements
* Conform more types to `Hashable` such as `Game` and `MoveTree`.
* `Game.Tag` now publicly exposes `name`.
* `Game.Tags` is now `Hashable` and `Sendable`.

# ChessKit 0.11.0
Released Monday, August 5, 2024.

### New Features
* A draw result is now published by `BoardDelegate` when the board encounters a threefold repetition (by [@joee-ca](https://github.com/joee-ca)).
* Convenience directional properties added to `Square` such as `up`, `down`, `left`, and `right` to obtain squares in relation to the given `Square`.

### Bug Fixes
* `File.init(_ number: Int)` now correctly bounds invalid values.
* i.e. Values less than 1 become `File.a` and values greater than 8 become `File.h`.

### Technical Changes
* Test coverage has been improved.
* Parsers (`EngineLANParser`, `FENParser`, `PGNParser`, `SANParser`) have been converted from classes to caseless enums.
* This should have no effect on existing code since the class versions had private initializers.

# ChessKit 0.10.0
Released Friday, June 21, 2024.

### Improvements
* Update tools version to Swift 5.9 (requires Xcode 15.0 or greater).
* Conform to Swift strict concurrency and add `Sendable` conformance to most objects

### Breaking Changes
* `Game` is now a `struct` and no longer conforms to `ObservableObject`.
* If observation semantics are required, consider using `didSet` property observers or an object that utilizes the `@Observable` macro.

# ChessKit 0.9.0
Released Saturday, June 15, 2024.

### Improvements
* `MoveTree` now conforms to `BidirectionalCollection`, allowing for more standard collection-based semantics in Swift.
* Should not affect any existing functionality or API usage.
* Several methods on `MoveTree` have been deprecated in favor of their `Collection` counterparts:
* `previousIndex(for:)``index(before:)` / `hasIndex(before:)`
* `nextIndex(for:)``index(after:)` / `hasIndex(after:)`
* `move(at:)``subscript(_:)` (e.g. `tree[index]`)
* `MoveTree.annotate()` now optionally returns the `Move` object after annotation.
* `MoveTree.path()` now returns tuple with named parameters (`direction` and `index`).

### Bug Fixes
* Removed `CustomDebugStringConvertible` conformance from `Bitboard` to avoid affecting all `UInt64` debug prints.
* To print the string representation of `Bitboard` use `Bitboard.chessString()`.

# ChessKit 0.8.0
Released Friday, June 7, 2024.

### Improvements
* Add support for draw by insufficient material (by [@joee-ca](https://github.com/joee-ca)).
* Once this condition is reached `.draw(.insufficientMaterial)` will be published via the `BoardDelegate.didEnd(with:)` method.
* Add unicode variant selector when printing black pawn icon to avoid displaying emoji (by [@joee-ca](https://github.com/joee-ca)).

### Bug Fixes
* Fix issue where king could castle through other pieces (by [@TigranSaakyan](https://github.com/TigranSaakyan)).

# ChessKit 0.7.1
Released Monday, May 6, 2024.

* Fix `MoveTree.previousIndex(for:)` when provided index is one after `minimumIndex`.

# ChessKit 0.7.0
Released Monday, April 29, 2024.

#### Improvements
### Improvements
* Add `startingIndex` and `startingPosition` to `Game`.
* `startingIndex` takes into account the `sideToMove` of `startingPosition`.

#### Bug Fixes
### Bug Fixes
* Fix rare en passant issue that could allow the king to be left in check, see [Issue #18](https://github.com/chesskit-app/chesskit-swift/issues/18).

# ChessKit 0.6.0
Released Friday, April 19, 2024.

#### Improvements
### Improvements
* Enable `chesskit-swift` to run on oldest platform possible without code changes.
* Now works on iOS 13+, macOS 10.15+, tvOS 13+, watchOS 6+.
* Annotations on moves in the `MoveTree` can now also be updated via `Game.annotate(moveAt:assessment:comment:)`.

#### Bug Fixes
### Bug Fixes
* Fix `MoveTree` not properly publishing changes via `Game`.
* Fix `Board.EndResult.repetition` spelling.
* This isn't made available yet but will be implemented in an upcoming release.

# ChessKit 0.5.0
Released Sunday, April 14, 2024.

#### Improvements
### Improvements
* PGN parsing now supports tag pairs (for example `[Event "Name"]`) located at the top of the PGN format, see [Issue #8](https://github.com/chesskit-app/chesskit-swift/issues/8).

#### Bug Fixes
### Bug Fixes
* Fix issue where king is allowed to castle in check, see [Issue #11](https://github.com/chesskit-app/chesskit-swift/issues/11).

#### Breaking Changes
### Breaking Changes
* Remove `color` parameter from `Move.init(san:color:position:)` initializer.
* It was not being used, can be removed from any initializer call where it was included.
* The new initializer is simply `Move.init(san:position:)`.

# ChessKit 0.4.0
Released Saturday, April 13, 2024.

#### Improvements
### Improvements
* `Board` move calculation and validation performance has greatly increased.
* Performance has improved by over 250x when simulating a full game using `Board`.
* Underlying board representation has been replaced with much faster bitboard structures and algorithms.
* Add `CustomStringConvertible` conformance to `Board` and `Position` to allow for printing chess board representations, useful for debugging.
* Add `ChessKitConfiguration` with static configuration properties for the package.
* Currently the only option is `printMode` to determine how pieces should be represented when printing `Board` and `Position` objects (see previous item).

#### Breaking Changes
### Breaking Changes
* `EnPassant` has been made an `internal struct`. It is used interally by `Position` and `Board`.

#### Deprecations
### Deprecations
* `Position.toggleSideToMove()` is now private and handled automatically when calling `move()`. The public-facing `toggleSideToMove()` has been deprecated.

# ChessKit 0.3.2
Released Saturday, December 2, 2023.

#### Fixes
### Fixes
* Made `file` and `rank` public properties of `Square`.

# ChessKit 0.3.1
Released Friday, November 24, 2023.

#### Improvements
### Improvements
* Add `CaseIterable` conformance to several `Piece` and `Square` enums:
* `Piece.Color`
* `Piece.Kind`
@@ -70,24 +157,24 @@ Released Friday, November 24, 2023.
# ChessKit 0.3.0
Released Wednesday, June 21, 2023.

#### New Features
### New Features
* Add `future(for:)` and `fullVariation(for:)` methods to `MoveTree`.
* `future(for:)` returns the future moves for a given
index.
* `fullVariation(for:)` returns the sum of `history(for:)` and `future(for:)`.

#### Improvements
### Improvements
* Simplify `PGNElement` to just contain a single `.move` case.
* i.e. `.whiteMove` and `blackMove` have been removed and consolidated.

#### Fixes
### Fixes
* Fix behavior of `previousIndex(for:)` and `nextIndex(for:)` in `MoveTree`.
* Especially when the provided `index` is equal to `.minimum`.

# ChessKit 0.2.0
Released Wednesday, May 31, 2023.

#### New Features
### New Features
* `MoveTree` and `MoveTree.Index` objects to track move turns and variations.
* `Game.moves` is now a `MoveTree` object instead of `[Int: MovePair]`
* `MoveTree.Index` includes piece color and variation so it can be used to directly identify any single move within a game
@@ -102,7 +189,7 @@ Released Wednesday, May 31, 2023.
* `Game.positions` is now public
* Contains a dictionary of all positions in the game by `MoveTree.Index`, including variations

#### Removed
### Removed
* `Game.annotateMove`
* Modify `Move.assessment` and `Move.comment` directly instead
* `MovePair`
Loading