Skip to content

Commit 654e842

Browse files
Update README.md
1 parent b0c54da commit 654e842

File tree

1 file changed

+63
-26
lines changed

1 file changed

+63
-26
lines changed

README.md

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,63 @@
1-
# Mastermind: Weighted Entropy Heuristic Implementations
2-
3-
This repository contains three standalone programs implementing a weighted entropy-based heuristic for the Mastermind game, achieving an average number of guesses 4.3488:
4-
- `kernel.cu`: CUDA-accelerated optimizer for computing stage-based weights, optimized for NVIDIA GPUs.
5-
- `treeGenFixedWeights.cpp`: CPU-based program generating a full game tree using fixed weights.
6-
- `treeGenStageWeights.cpp`: CPU-based program generating a full game tree using stage-based weights.
7-
8-
See author's paper for details on the heuristic and its performance.
9-
10-
## Prerequisites
11-
- **Windows**:
12-
- NVIDIA CUDA Toolkit 11.8 (download from [NVIDIA](https://developer.nvidia.com/cuda-11-8-0-download-archive)).
13-
- MinGW-w64 with `g++` (install via MSYS2: `pacman -S mingw-w64-x86_64-gcc`).
14-
- NVIDIA GPU with compute capability 6.1 or higher (e.g., GTX 1080, RTX 2080, RTX 3090).
15-
- **Linux**:
16-
- NVIDIA CUDA Toolkit 11.8 (install via NVIDIA’s `.run` installer or `apt`).
17-
- `g++` (install via `sudo apt-get install g++`).
18-
- NVIDIA GPU with compute capability 6.1 or higher.
19-
20-
## Building the Programs
21-
22-
### Windows
23-
1. Clone the repository:
24-
```bash
25-
git clone https://github.com/obsessivecompulsiveaudiophile/mastermind.git
26-
cd mastermind
1+
# Mastermind: Weighted-Entropy Heuristic Implementations
2+
3+
This repository contains three standalone programs that implement a **weighted-entropy heuristic** for the classic *Mastermind* game, achieving an average of **4.3488 guesses per game**.
4+
5+
| Program | Purpose | Hardware |
6+
|---------|---------|----------|
7+
| `kernel.cu` | CUDA-accelerated optimiser that computes stage-based weights | NVIDIA GPU |
8+
| `treeGenFixedWeights.cpp` | CPU-based generator using **fixed** weights | any x86-64 CPU |
9+
| `treeGenStageWeights.cpp` | CPU-based generator using **stage-based** weights | any x86-64 CPU |
10+
11+
> See the author’s paper for a full description of the algorithm and benchmarks.
12+
13+
---
14+
15+
## 🚀 Quick start (most users)
16+
17+
Pre-compiled binaries are attached to every [GitHub release](https://github.com/obsessivecompulsiveaudiophile/mastermind/releases/latest):
18+
19+
| Archive | Contents |
20+
|---------|----------|
21+
| `mastermind-windows.zip` | Windows 10/11 64-bit executables (CUDA 12.4, built for compute ≥ 5.2) |
22+
| `mastermind-linux.tar.gz` | Linux x86-64 executables (CUDA 11.8, glibc ≥ 2.35) |
23+
24+
1. Download & extract.
25+
2. Run `mastermind_cuda_windows.exe` (Win) or `mastermind_cuda_linux` (Linux).
26+
27+
---
28+
29+
## 🛠️ Building from source
30+
31+
### Prerequisites
32+
33+
| OS | Required tool-chain | GPU driver |
34+
|--|--|--|
35+
| **Windows** | [CUDA Toolkit **12.4**](https://developer.nvidia.com/cuda-downloads) + Visual Studio 2022 (MSVC 14.4x) | NVIDIA driver ≥ 531 |
36+
| **Linux** | [CUDA Toolkit **11.8**](https://developer.nvidia.com/cuda-11-8-0-download-archive) + GCC 11+ | NVIDIA driver ≥ 470 |
37+
38+
### Clone
39+
40+
```bash
41+
git clone https://github.com/obsessivecompulsiveaudiophile/mastermind.git
42+
cd mastermind
43+
44+
Windows (Visual Studio Developer Prompt)
45+
46+
cmd
47+
:: CUDA program
48+
nvcc -arch=sm_52 -O3 -o mastermind_cuda_windows.exe kernel.cu
49+
Replace -arch=sm_52 with -arch=sm_86 (or your GPU’s compute capability) for maximum performance on newer cards.
50+
51+
:: CPU programs
52+
cl /EHsc /O2 treeGenFixedWeights.cpp /Fe:treeGenFixedWeights_windows.exe
53+
cl /EHsc /O2 treeGenStageWeights.cpp /Fe:treeGenStageWeights_windows.exe
54+
55+
Linux
56+
57+
bash
58+
# CUDA program
59+
nvcc -arch=sm_52 -O3 -o mastermind_cuda_linux kernel.cu
60+
61+
# CPU programs
62+
g++ -O3 -std=c++17 treeGenFixedWeights.cpp -o treeGenFixedWeights_linux
63+
g++ -O3 -std=c++17 treeGenStageWeights.cpp -o treeGenStageWeights_linux

0 commit comments

Comments
 (0)