Skip to content

aperechnev/ChessKit

Repository files navigation

ChessKit

Tests

A lightweight and fast chess framework written in Swift.

ChessKit is a core library used in Ladoga chess engine.

Installation

ChessKit framework is avalable for installation via Swift Package Manager.

Add a dependency to the Xcode project by linking to https://github.com/aperechnev/ChessKit, or directly in your Package.swift file:

import PackageDescription

let package = Package(
    name: "MyPackage",
    platforms: [
        .macOS(.v10_12),
    ],
    dependencies: [
        .package(url: "https://github.com/aperechnev/ChessKit.git", from: "2.0.0"),
    ],
    targets: [
        .target(name: "MyPackage", dependencies: ["ChessKit"]),
    ]
)

Getting Started

ChessKit is well covered by documentation. However, here you can find an example that describes how to start working with ChessKit.

import ChessKit

let fenSerializer = FenSerialization()
let italianGameFen = "r1bqk1nr/pppp1ppp/2n5/2b1p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 4 4"
let italianGamePosition = fenSerializer.deserialize(fen: italianGameFen)
let game = Game(position: italianGamePosition)

print("Number of available moves: \(game.legalMoves.count)")

game.make(move: "b2b4")
let evansGambitFen = fenSerializer.serialize(position: game.position)
print("Evans gambit fen: \(evansGambitFen)")

game.make(move: Move(string: "c5b4"))
let evansGambitAcceptedFen = fenSerializer.serialize(position: game.position)
print("Evans gambit accepted fen: \(evansGambitAcceptedFen)")

print("List of moves in game: \(game.movesHistory)")
print("List of pieces on board: \(game.position.board.enumeratedPieces())")

Versioning

We use semantic versioning.

License

ChessKit is released under the MIT license. See LICENSE for details.

About

Lightweight and fast chess framework written in Swift.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages