.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.
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.
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.
There is a sample Xcode project provided as part of the repo that you reference here: MicroMaxTestApp.
See the documentation for more info.
Also check out Fuego on Apple Silicon ⚫️⚪️, the Fuego Go engine wrapped for Apple Silicon.