Skip to content

Commit 65ab5b4

Browse files
committed
Refactoring and comments
1 parent 482bdef commit 65ab5b4

File tree

2 files changed

+17
-27
lines changed

2 files changed

+17
-27
lines changed

src/renderer/components/AnalysisEvalRow.vue

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@ export default {
1616
name: 'AnalysisEvalRow',
1717
data () {
1818
return {
19-
dropdownSelection: {},
20-
arrayOfObjects: [{
21-
id: 1,
22-
name: '🐟 Multi-Variant Stockfish 10'
23-
},
24-
{
25-
id: 2,
26-
name: '🐠 Fairy Stockfish 10'
27-
},
28-
{
29-
id: 3,
30-
name: '🦜 CrazyAra 0.8.1'
31-
}],
32-
object: {
33-
name: '🐟 Multi-Variant Stockfish 10'
34-
},
3519
engines:
3620
{chess: [
3721
'Multi-Variant Stockfish 10',
@@ -46,10 +30,6 @@ export default {
4630
'CrazyAra 0.8.1'
4731
],
4832
selected: 'Multi-Variant Stockfish 10',
49-
selected_obj: {
50-
id: 1,
51-
name: '🐟 Multi-Variant Stockfish 10'
52-
},
5333
engineBinaries: {
5434
'Multi-Variant Stockfish 10': 'stockfish',
5535
'CrazyAra 0.8.1': 'CrazyAra',

src/server/index.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ffish['onRuntimeInitialized'] = () => {
88
console.log(`ffish.info(): ${ffish.info()}`)
99
}
1010

11+
// TODO: Maybe get rid of WebSocket server all together and communicate with vuex-store directly
1112
const wss = new WebSocket.Server({
1213
port: 8082
1314
})
@@ -55,8 +56,8 @@ Converts a string given uci pv line into a string of san move notation.
5556
*/
5657
function extractPV (gameFEN, rawPV) {
5758
let movesStr = rawPV.split(' ')
59+
// TODO: Make this variant specific
5860
let board = new ffish.Board('crazyhouse', gameFEN)
59-
// let board = new ffish.Board('chess', gameFEN);
6061
let sanPV = board.variationSan(rawPV)
6162
board.delete()
6263

@@ -70,7 +71,6 @@ class CLICreator {
7071
this.idAuthor = null
7172
this.stdIO = []
7273
this.child = null
73-
// this.ourWs = null
7474
this.multipv = [{
7575
depth: 0,
7676
seldepth: 0,
@@ -155,31 +155,42 @@ class CLICreator {
155155
}
156156
}
157157
/*
158-
Sends the move destinations via WebSocket
158+
Sends the move destinations via WebSocket.
159159
*/
160160
sendMoveDestinations () {
161161
ourWs.send(JSON.stringify({
162162
destinations: this.destinations
163163
}))
164164
}
165+
/*
166+
Sends 'isready', 'go infinite' commands to the engine.
167+
*/
165168
goEngine () {
166169
let message
167170
message = 'isready' + os.EOL
168171
this.child.stdin.write(message)
169-
// message = 'go movetime 1000' + os.EOL;
170172
message = 'go infinite' + os.EOL
171173

172174
this.child.stdin.write(message)
173175
this.stdIO.push('>' + message)
174176
}
177+
/*
178+
Resets the current member variables.
179+
*/
175180
reset () {
176181
this.update = false
177182
this.curPVLines = 0
178183
this.stdIO = []
179184
}
185+
/*
186+
Closes the active engine.
187+
*/
180188
closeEngine () {
181189
this.child.stdin.write('close')
182190
}
191+
/*
192+
Starts the engine binrary and parses the UCI replies.
193+
*/
183194
startEngine () {
184195
console.log(`this.engineBinary: ${this.engineBinary}`)
185196
this.child = childProcess.exec('./' + this.engineBinary, {
@@ -203,11 +214,10 @@ class CLICreator {
203214
output: this.child.stdin
204215
})
205216

217+
// parse a PV-line e.g.:
218+
// info depth 17 seldepth 27 multipv 1 score cp 60 nodes 1008782 nps 1007774 hashfull 468 tbhits 0 time 1001 pv e2e4 e7e5
206219
this.rl.on('line', (line) => {
207220
line = line.trim()
208-
// console.log(line)
209-
// let re = /cp (\d+)/;
210-
// <info depth 17 seldepth 27 multipv 1 score cp 60 nodes 1008782 nps 1007774 hashfull 468 tbhits 0 time 1001 pv e2e4 e7e5
211221

212222
if (line.startsWith('info ')) {
213223
let re = new RegExp('multipv (\\d+)')

0 commit comments

Comments
 (0)