aboutsummaryrefslogtreecommitdiff
path: root/solvitaire/README.md
blob: 8644da4669bc3a2a96004ab5878f33656198e79b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Solvitaire: A general solver for perfect-information solitaire games

## Install

The easiest way to install (and run) Solvitaire is by using the supplied
Docker image. For more information about installing Docker, head to 
<https://www.docker.com/get-started>

With Docker installed, simply run:

```
$ ./docker-install.sh
```

This command downloads a docker image containing an environment in which
Solvitaire can be built and run, without the user needing to worry about having
the correct dependencies/versions.

It also adds a pre-made CMake build system and a built binary to your directory
so you don't have to wait for an initial build to compile. Rather convenient!

The downside to this approach is that the Docker image is unfortunately quite
large, and pulling it may take a minute or two (although you only have to do
this once!) If you don't wish to use docker, the steps contained in
_Dockerfile_ should be a good guide to the required dependencies, although bear
in mind that on older Linux systems the required versions of dependencies may
not be available through _rpm_ / _deb_.

(Note: on one system I had to run `sudo usermod -aG docker $USER`
and then restart my machine before docker would allow me sufficient
permissions. Just making a note of this here in case others encounter a similar
problem)

## Using the Docker image

To use the docker image, simply run:

```
$ ./enter-container.sh
```

This command will start the docker container and enter an interactive session
within the container's filesystem. The files you'll see there are simply a
mounted version of the root directory, so any changes you make in the
container will be reflected in your filesystem, and vice versa. When
you exit the interactive session the container will automatically be stopped.

If you don't wish to enter an interactive session, you can run:

```
$ ./enter-container.sh "command_to_be_run"
```

This will spin up a container, run the command, and tear the container down,
with no noticeable overhead. Combining this with the fact that the repo's
files are mounted in the Docker image, means that a user can edit
Solvitaire's files on their local system using their own tools/editor, and
then build/execute Solvitaire in the controlled Docker environment - the
best of both worlds!

For more information on Docker images, see
<https://docs.docker.com/get-started/part2/#recap-and-cheat-sheet-optional>

## Build

If the above instructions have been followed, you should already have a
built binary in the root directory. 

To (re-)build Solvitaire within the container, simply run:

```
$ ./build.sh [--release|--debug] [--solvitaire|--unit-tests]
(default args = "--release" "--solvitaire")
```

If you wish to run a build from outside the container, run:

```
$ ./enter-container.sh ./build.sh
```

For more build information and options, examine _build.sh_ and
_CMakeLists.txt._

## Run

To run Solvitaire from within the container, simply run either:

```
$ ./solvitaire
$ ./solvitaire-debug
```

and for the unit tests (note, these must be
run inside src/test for the integration tests to pass):

```
$ cd src/test
$ ../../unit-tests
$ ../../unit-tests-debug
```

Or from outside the container:

```
$ ./enter-container.sh "cd src/test; ../../unit-tests"
```

## Help

If you have any problems getting these steps to work, don't hesitate to get in
touch via <thecharlesblake@live.co.uk>