You must have go installed as well as dep.
Built with the following:
% go version
go version go1.10 linux/amd64
% dep version
dep:
version : v0.4.1
build date : 2018-01-24
git hash : 37d9ea0a
go version : go1.9.1
go compiler : gc
platform : linux/amd64Refer to the following for installation:
You must also get a tool before continuing:
go get -v -u github.com/asticode/go-astilectron-bundler/...
This should drop in an executable at $GOPATH/bin called astilectron-bundler.
Now you can build the actual application.
- Move the directory to your
$GOPATH
% mkdir -p $GOPATH/src/
# assuming directory is called project
% mv project $GOPATH/src/- Move to the directory
cd $GOPATH/src/project- Pull down the dependency
% dep ensure- Run the bundler (this is required to build at all as it will generate embedded binary data as well as some missing methods)
- This step only has to be run once unless the data that gets embedded changes (which it won't since you will be just building and not modifying)
% $GOPATH/bin/astilectron-bundler -v && chmod +x - [OPTIONAL] Build it - this should place an executable in your directory with the same name as the directory
% go build- Run it
- Linux:
build/linux-amd64/Checkers - MacOS:
build/darwin-amd64/Checkers - Windows:
build/windows-amd64/Checkers
- Linux:
# again assuming the directory was called project and that you're going to run it on the current commputer
% ./project
# OR for bundled packages for different operating systems (tested only on Linux)
% ./build/linux-amd64/Checkers As stated above, there are several different outputs you can use. First and foremost is the output generated by go build. This will place an executable in the directory with name corresponding to the directory's name e.g. if you are in project and build it then it will result in an executable called project inside the project directory. This will be specific to the machine you build it on.
You can also use the builds provided by the bundler, which bundles together a binary for Linux, Windows, and MacOS. This will be in build/$OS-amd64/Checkers where $OS is one of linux, darwin, or windows. Be sure to use the proper executable for the proper operating system.
It's recommended that you run the bundler first and then just use the output of go build.
The executable will show the different options available.
% ./project --help
Usage of ./project:
-debug
Debug mode
-depth int
Depth of minimax (default 16)
-difficulty int
Difficulty indicated from 1 - 3 with 3 being the hardest (default 3)
-first uint
Who should go first, 2 for human and 1 for ai (default 2)
-gui
Initialize with a GUI
-logger-app-name string
the logger's app name
-v if true, then log level is debug
Simply import the engine.
import (
"github.com/jwoos/go_checkers/engine"
)