Comments (5)
The opening book class is read-only in normal usage. You can find an example of how to generate the internal TranspositionTable of the opening book in the function generate_opening_book() of generator.cpp.
This generator is fed with lines containing position and score separated by a space. You simply have to send it a line with an empty position (actually 0 characters) followed by a space (delimiter) and its score. for example, if you want to assign score 1 to an empty position send it the line " 1" (note the initial space)
The solver is returning 1 for the 7x6 board using the opening book I provided. When you say that the solver gives a zero score to an empty position, are you using a different board size or a different opening book that the one I provided?
from connect4.
I'm using my own opening book created from generator.cpp, and feeding it to the solver. I renamed 7x6_small.book to 7x6.book which the solver expects it to be loaded as. The board size is at the standard 7x6. I did exactly what you suggested, and it still gave zeroes. I haven't modified any of the code if you're wondering, I just compiled it and ran it on Cygwin64 to experiment additional features you made to your solver.
Text output from Cygwin64:
TTC@TTCW7 /cygdrive/c/Users/TTC/Downloads/connect4-master/connect4-master
$ g++ -O3 -std=c++11 generator.cpp -oag
TTC@TTCW7 /cygdrive/c/Users/TTC/Downloads/connect4-master/connect4-master
$ ./ag
1
A A
TTC@TTCW7 /cygdrive/c/Users/TTC/Downloads/connect4-master/connect4-master
$ ./a
Loading opening book from file: 7x6.book. done
0 2 0
41
TTC@TTCW7 /cygdrive/c/Users/TTC/Downloads/connect4-master/connect4-master
$
from connect4.
I just fixed the generator such that it directly generate a file named "7x6.book"
Unfortunately, I am unable to reproduce your issue. I get the correct score 1 on the empty position using an opening book that only contains the empty position. Here are the 3 exact commands I made from this commit 754d3b8
$ make c4solver generator
g++ --std=c++11 -W -Wall -O3 -DNDEBUG -c -o Solver.o Solver.cpp
g++ --std=c++11 -W -Wall -O3 -DNDEBUG -c -o main.o main.cpp
g++ -o c4solver main.o Solver.o
g++ --std=c++11 -W -Wall -O3 -DNDEBUG -c -o generator.o generator.cpp
g++ -o generator generator.o
$ echo " 1" | ./generator
$ echo "" | ./c4solver
Loading opening book from file: 7x6.book. done
1 2 2
from connect4.
Run the opening book generator first. You then input some arbitrary score to the empty position within the generator and then press Enter. After that, type any two non-numeric characters with spaces in between the characters then press the Enter key to create the book. This will produce a zero score on the empty position while it does not when you input a position of played moves.
Using your method above, the problem actually goes away! This is the consequence of me being more familiar with the Windows command prompt than the Unix terminal. However, I still think this minor oversight needs fixing to fulfill with others not so advanced with consoles.
from connect4.
I now understand what happened, when you were typing "A A", the parsing of the position "A" identified that the first char is invalid and stopped parsing, leading to the empty position.
As well, when parsing invalid score "A", the score 0 was actually taken into account.
I improved robustness of the generator against invalid input in my last commit: d7acbd6
You can now also stop the input of the generator with an empty line in addition to EOF
from connect4.
Related Issues (20)
- Compilation and Inputs HOT 2
- How to Generate Good Opening Book HOT 3
- Cannot compile on raspberry 3 ( g++ (Raspbian 8.3.0-6+rpi1) 8.3.0 ) HOT 2
- Performance trap solver.reset() HOT 3
- How to implement that in a real Connect 4 game ?
- Getting started HOT 2
- Generate a 6x9 HEIGHTxWIDTH Opening Book
- How to reproduce the benchmarks
- Predict who will win
- Using this with python
- How to create 8x8 Opening Book?
- Trying to compile on Windows with g++ doesn't work
- Not optimal Position.compute_winning_position HOT 1
- How do I download the opening book?
- key3() doesn't work correctly with __int128
- Transposition table is not cache friendly HOT 1
- Incorrect node score HOT 1
- Is there a way to return next possible moves with their scores efficiently? HOT 3
- is there a Java version? HOT 1
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 connect4.