- Notifications
You must be signed in to change notification settings - Fork0
⚫️⚪️ The Fuego C++ Go engine to play and analyse Go games. Built as multi-platform XCframework for iOS, visionOS, macOS
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
mesqueeb/FuegoOnAppleSilicon
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
.package(url: "https://github.com/mesqueeb/FuegoOnAppleSilicon", from: "1.0.0")
Fuego On Apple Silicon is the Fuego C++ Go engine to play and analyse Go 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.
This project
- Modernised the original C++ source code to compile with modern (20+) C++ standard
- No longer requires the entire Boost library to be built, but now relies only on the Boost header libraries and is compatible with the latest Boost version (1.85)
- Migrated to a CMake-based build system so the project can be supported with a more modern IDEs
- Created a newSH build script that builds XCframeworks for iOS, macOS, visionOS (xrOS), and related simulators
- Wrapped everything nicely into a Swift Package that includes the pre-compiled binaries, has a Swift bridge class so that it can be easily used in any Swift project
It builds upon a fork of both the originalFuego C++ code on Source Forge and theFuego on iOS repository. (Fuego on iOS only compiles to iOS and relies on GNU++98 & Boost 1.75.0)
When installing the package via Xcode 14.x you might run into the error:
invalid archive returned fromhttps://github.com/...
The fix (fromStack Overflow) is to remove the dependency, quit Xcode, and execute:
rm -rf$HOME/Library/Caches/org.swift.swiftpm/
Then re-open Xcode, re-add the package again and it should install correctly. Sadly you'll need to do thisevery time you need to update this package, (until Xcode fixes this issue with packages that uses binary targets).
import FuegoOnAppleSiliconletbridge=FuegoBridge()do{tryawait bridge.startEngine() // You need to feed the engine GTP (Go Text Protocol) strings to be able to request movestryawait bridge.submitCommand("boardsize 19")tryawait bridge.submitCommand("clear_board")tryawait bridge.submitCommand("komi 6.5")tryawait bridge.submitCommand("play b D16") iflet whiteMove=tryawait bridge.submitCommand("genmove w"){print("Fuego plays white:", whiteMove) // Eg. "Q4"} if let boardState=tryawait bridge.submitCommand("showboard"){print("Fuego shows the board:", boardState)} // Stop the engine when you're done: bridge.stopEngine()}catch{print("Something went wrong... error:", error)}
The library comes with some useful types and helper functions, be sure to check out theSwift wrapper's source code here
There is a sample Xcode project provided as part of the repo that you reference here:FuegoTestApp
See the rendereddocumentation on Swift Package Index for more info.
./build-xcframework.sh
This script buildsgtpengine
,smartgame
,go
andgouct
libraries, merges them into a single lib (per platform), and packs libs from different platforms into./build/Fuego.xcframework
.
This script also downloads Boost (before building), however, now there is no need to build Boost libraries because the Boost libraries that need to be built are no longer used for these fuego subprojects. Onlyfuegomain
andfuegotest
depend on theboost.program_options
library that needs to be built. But they are not part ofFuego.xcframework
.
You can check this build file and enable / disable output by togglingif true; then
toif false; then
. Currently it is set to build:
- xros-simulator arm64,x86_64
- xros arm64
- ios arm64
- ios simulator arm64,x86_64
- osx arm64,x86_64
build-xcframework.sh
is a multipurpose build script. It also creates anotherFuegoTest.xcframework
by merging thesimpleplayers
andunittestmain
subprojects. Whileunittestmain
is intended to be an executable, it's built as a static library where themain
method is renamed torun_unit_tests
with the same signature. So any iOS/macOS/visionOS application is able to run Fuego unit tests just by embedding thisFuegoTest.xcframework
(in addition toFuego.xcframework
) and calling therun_unit_tests
method. An example of such an application is xcode\FuegoTest\FuegoTest.xcodeproj, which represents a simple SwitUI application where tests are started when a button is clicked.
TheFuego on iOS repository was a source of inspiration which gave birth to this library.
Modernising the C++ code and build scripts was done with the help ofAlexander Pototskiy.
Thank you, everybody!
Also check out Micro-Max on Apple Silicon ♟️, the µ-Max Chess engine wrapped for Apple Silicon.
→github.com/mesqueeb/MicroMaxOnAppleSilicon
Description===========Fuego is a collection of C++ libraries for developing software for thegame of Go. It includes a Go player using Monte-Carlo tree search.The initial version of the code was released by the Computer Go group atthe University of Alberta and is based in parts on the previous projectsSmart Game Board and Explorer.Contact=======Fuego project page:http://sourceforge.net/projects/fuego/Fuego Trac and Wiki:http://sourceforge.net/apps/trac/fuego/Copyright=========See AUTHORS for the list of copyright holders on Fuego.License=======Fuego is free software: you can redistribute it and/or modifyit under the terms of the GNU Lesser General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.Fuego is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU Lesser General Public License for more details.You should have received a copy of the GNU Lesser General Public Licensealong with Fuego. If not, see<http://www.gnu.org/licenses/>.Compilation===========See INSTALL for generic compilation instructions from GNU Automake.The file doc/doxygen/general/pages/autotools.cpp contains additional andFuego specific documentation.Documentation=============The developer documentation for the libraries and applications can becreated with Doxygen (http://www.doxygen.org). There is a makefile indoc/doxygen/Makefile.The user manual for the main Go player is in doc/manual/AUTHORS=======Fuego authors=============Martin MuellerMarkus EnzenbergerFan XiePrevious authors================Anders Kierulf (original Smart Game Board code)Contributors============David Silver (SpDumbTactic player, improvements to SgHash)Xiaozhen Niu (parts of GoRegionUtil, GoSafetyUtil)Broderick Arneson (autobook; many enhancements)Richard Segal (improvements to parallel search)Chris Rosin (additive knowledge, Greenpeep-style patterns)Timothy Yau (Greenpeep-style patterns)Saradha Sankaran (deterministic mode; build improvements)Aja HuangJakub Pawlewicz (better hash table; df-pn code)
About
⚫️⚪️ The Fuego C++ Go engine to play and analyse Go games. Built as multi-platform XCframework for iOS, visionOS, macOS