Skip to content

♟️ The µ-Max C Chess engine to play Chess games. Built as multi-platform Swift Package for iOS, visionOS, macOS

License

Notifications You must be signed in to change notification settings

mesqueeb/MicroMaxOnAppleSilicon

Repository files navigation

Micro-Max On Apple Silicon ♟️

.package(url: "https://github.com/mesqueeb/MicroMaxOnAppleSilicon", from: "2.1.0")

Micro-Max On Apple Silicon is the µ-Max C Chess engine by H.G. Muller to play Chess games. Built as multi-platform XCframework for iOS, macOS and visionOS. Wrapped as a modernised Swift Package that can be included in any Swift project and can build on all Apple platforms.

Installation

You can add MicroMaxOnAppleSilicon by adding it as a dependency to your Package.swift or add it via Xcode by searching for the name.

The library currently relies on a certain file existing in your project's Bundle Resources, so you will need to manually add that before the engine can be used, otherwise you will hit an error:

fmax.ini not found in the framework bundle.

The fmax.ini file is bundled with the files that will get installed with this package:

You then have to copy paste this file into your project's directory and add it to the Bundle Resources of your target:

That's all! Now you can use the engine in your project.

Usage

import MicroMaxOnAppleSilicon

let bridge = MicroMaxBridge()

bridge.connectToEngine()

/// You need to feed the engine FEN state strings to be able to request moves
let fenState: String = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

do {
  let (from, to) = try await bridge.requestAiMove(fenState: inputText)
  guard let from, let to else { throw fatalError("no result") }

  print("MicroMax moves from \(from) to \(to)") // Eg. from "B7" to "B6"
} catch {
  print("something went wrong... error:", error)
}

The library comes with some useful types and helper functions, be sure to check out the Swift wrapper's source code here.

Sample Project

There is a sample Xcode project provided as part of the repo that you reference here: MicroMaxTestApp.

Documentation

See the documentation for more info.

Other Projects

Also check out Fuego on Apple Silicon ⚫️⚪️, the Fuego Go engine wrapped for Apple Silicon.

github.com/mesqueeb/FuegoOnAppleSilicon

About

♟️ The µ-Max C Chess engine to play Chess games. Built as multi-platform Swift Package for iOS, visionOS, macOS

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published