Comments (4)
And... it's done.
Novel: https://github.com/greg-kennedy/ChessBook/blob/master/sample/novel.md
Code (repo): https://github.com/greg-kennedy/ChessBook
Preview
from 2017.
So, a couple things to note about this.
First, I tried to make this novel "interesting" by using a Mate-in-2 problem, so that White would have an ending to search for instead of just a quiescent position. The actual position I used was from a real game in 2017, "Monika Socko vs Laura Unuk, Riga, 2017". See if you can find the best move : )
Second, if you're unfamiliar with chess algorithms: The Minimax algorithm is a simple recursive algorithm paired with a static evaluation function. Essentially, for each board position, try making every possible move - and then, if you are not deep enough, try every resulting move from there. At the bottom, "calculate" how good you think the position is. Simply, you can assign point values to each piece, and count up the "score" of the board.
The intent of Minimax is to minimize the damage that the opponent will do at every move. You should make the move that results in the "maximum" of all possible opponent "minimums". For Chess, you can assign a massive value to capturing a King, and the engine will automatically seek out attacks and checkmates.
Unfortunately, Minimax alone is highly inefficient. This simple position resulted in 370,000+ words for just a 3-ply search. One improvement comes from Alpha-Beta pruning, which cuts branches of the tree when the outcome is guaranteed equal-or-worse than some already evaluated position. The improvement is dramatic, and its development made chess engines actually viable competitors. In my case, Alpha-Beta was actually TOO efficient and I ended up less than 50,000 words... so, the novel code includes a 10% chance to skip pruning if a position is deemed equally as good as another previously seen. The final sample comes to approximately 51,000 words or so.
There are other scripts in the repository: an Engine module, which can be attached to a Chess state and "play" as Harold. And there is play.pl which can be used to play against the engine. This being NaNoGenMo, I ran out of time for some of the engine features I wanted: castling and en-passant are not supported. It turned out not to matter for my test position.
from 2017.
This is a very interesting take on suspense. I look forward to reading it!
from 2017.
I love this idea! Did you see the entry by @nothings from 2014 that turned a similar (but deterministic) problem into a story?
from 2017.
Related Issues (20)
- Dial "S" for Sudoku HOT 2
- Grammar-based Generation HOT 1
- Shakespeare Summarizes Everything HOT 6
- Hard West Turn HOT 5
- Every Novel Generator HOT 5
- A Picture is Worth N Words HOT 1
- Tillman, Victor Lima, KOD HOT 5
- Emic Automata HOT 6
- views on an object -- kr pipkin & v21
- 2d Markov HOT 2
- What is Trump? by @hugovk
- The Infinite Fight Scene HOT 6
- LSTM-based Leo Tolstoy text generator
- Thematic Automata HOT 2
- Pride, Prejudice by @hugovk HOT 13
- The Edward Lear Limerick Generator HOT 4
- Frequency transforms of text HOT 4
- Icebox by @hugovk
- NaNoGenMo/Creative NLP Slack channel? HOT 7
- Language survey 2017 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2017.