mesqueeb/micromaxonapplesilicon
```
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.
Usage
You can use WinBoard protocol commands to interact with the engine.
import MicroMaxOnAppleSilicon
let bridge = MicroMaxBridge()
do {
_ = try await bridge.startEngine()
print(await bridge.sendCommand("xboard")) // nil
print(await bridge.sendCommand("new")) // nil
print(await bridge.sendCommand("white")) // nil
print(await bridge.sendCommand("force")) // nil
print(await bridge.sendCommand("st 1")) // nil
print(await bridge.sendCommand("go")) // "move c2c4"
} catch {
print("something went wrong... error:", error)
}
// Don't forget to stop the engine when done
await bridge.stopEngine()The library comes with some useful types and helper functions, be sure to check out the Swift wrapper's source code here.
One example is that you can use FEN state strings to request moves from the engine:
let fenState: String = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
do {
let (from, to) = try await bridge.requestAiMove(fenState: fenState)
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)
}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.
Advanced Implementation via fmax.ini customizations
The library uses an fmax.ini file bundled with the package to configure the engine's behavior. If you're familiar with C and Chess, you can customize this file to modify how the engine plays.
Currently, the engine always uses the fmax.ini file from the package bundle. To use a custom fmax.ini from your app's Bundle Resources, modify startEngine() in MicroMaxBridge.swift to check Bundle.main before falling back to Bundle.module. PRs welcome!
Development
Open the workspace MicroMaxOnAppleSilicon.xcworkspace in Xcode to run the test apps and XCTests.
Other Projects
Also check out Fuego on Apple Silicon ⚫️⚪️, the Fuego Go engine wrapped for Apple Silicon.
Package Metadata
Repository: mesqueeb/micromaxonapplesilicon
Default branch: main
README: README.md