Skip to content

Commit ff780bf

Browse files
committed
solver should use output or color * output? hmm
1 parent b3ee22e commit ff780bf

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

cpu.h

+4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ class Cpu {
140140
n++;
141141
}
142142

143+
// for (auto & m : moves) {
144+
// cout << m.move << ": " << m.score << endl;
145+
// }
146+
143147
return moves[rand() % n];
144148
}
145149

gamesolver.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ class GameSolver {
6868
}
6969
}
7070

71-
data[game.getTuples()] = color * output;
72-
tt[game.getHash()] = color * output;
71+
// or = color * output? need to think about it. either way it works o.O
72+
data[game.getTuples()] = output;
73+
tt[game.getHash()] = output;
7374

7475
return output;
7576
}

main.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void generateTrainingData() {
1919
auto solverData = gameSolver.getData();
2020
trainingData = vector<pair<vector<int>,float>>(solverData.begin(),solverData.end());
2121
cout << "there are " << trainingData.size() << " positions" << endl;
22+
gameSolver.solveAllStates();
2223
}
2324

2425
void trainNetwork() {
@@ -206,5 +207,12 @@ int main() {
206207
networkCpuVsCpuPly3();
207208
networkCpuVsPerfectCpu();
208209

210+
// Game game;
211+
// for (auto & m : game.getMoves()) {
212+
// game.makeMove(m);
213+
// cout << network.predict(game.getTuples()) << endl;
214+
// game.undoMove();
215+
// }
216+
209217
return 0;
210218
}

tictactoe-ntuple.pro.user

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE QtCreatorProject>
3-
<!-- Written by QtCreator 4.14.1, 2021-04-08T17:03:46. -->
3+
<!-- Written by QtCreator 4.14.1, 2021-04-09T23:23:53. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>

0 commit comments

Comments
 (0)