https://github.com/aprowe/life-and-death-bot
A Bot for Riddles.io
https://github.com/aprowe/life-and-death-bot
Last synced: over 1 year ago
JSON representation
A Bot for Riddles.io
- Host: GitHub
- URL: https://github.com/aprowe/life-and-death-bot
- Owner: aprowe
- Created: 2018-04-30T04:05:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-15T06:34:42.000Z (about 8 years ago)
- Last Synced: 2025-01-04T21:19:38.406Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 148 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Life and Death Bot
[Riddles.io API](https://docs.riddles.io/game-of-life-and-death/api)
## To install
This project recommends using `pipenv`
In the project folder, simply run
```
pipenv install
```
### Commands
```
./bin/run.sh
./bin/test.sh
./bin/benchmark.sh
./bin/build.sh
```
## TODO
### Optimize and Benchmark
Numpy needs to be utilized wherever possible to speed up everything
A numpy method in place of a native python iterator over the board sped up
the function call by **1000%**
### Prune getMoves to not count useless actions:
#### Ignore 'kill' actions where it's neighbors neighbor count is less than 3.
for example, the one in the middle need not be explored to kill:
Board:
```
0 1 0 0 1
0 0 0 0 0
0 0 1 0 0
1 0 0 0 1
0 0 0 0 0
```
Neighbors:
```
1 0 1 1 0
1 2 2 2 1
1 2 0 2 1
0 2 1 2 0
1 1 0 1 1
```
Since the cell only neighbors cells with a 2 max, it can have no effect on the board.
Another Scenario:
Board:
```
0 0 0 0 0
0 0 0 0 1
0 0 1 0 0
0 0 0 0 1
0 0 0 0 0
```
Neighbors:
```
0 0 0 1 1
0 1 1 2 0
0 1 0 3 2
0 1 1 2 0
0 0 0 1 1
```
Since this cell has max 3 on it's surrounding neighbors, it must be considered to be killed or not
#### Birth Optimizing
Likewise, cells that have max neighbor count of 2 do not need to be considered to birth to.
Cells that are in these regions should be first picks for sacrificing.