-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
executable file
·67 lines (54 loc) · 1.56 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
'use strict'
const express = require('express')
const app = express()
// app.set("view engine", "html");
const Board = require('./board.js')
const MonteCarlo = require('./monte-carlo.js')
var letterBoard5_nat = [
'W', 'Y', 'P', 'R', 'L',
'D', 'B', 'N', 'N', 'H',
'J', 'E', 'Y', 'O', 'M',
'E', 'T', 'I', 'A', 'S',
'S', 'B', 'E', 'H', 'M' ]
var letterBoard5 = [
'U', 'I', 'T', 'A', 'C',
'E', 'V', 'I', 'H', 'T',
'S', 'A', 'K', 'E', 'L',
'W', 'R', 'S', 'R', 'H',
'N', 'T', 'D', 'H', 'M' ]
var letterBoard4 = [
'U', 'I', 'T', 'A',
'E', 'V', 'I', 'H',
'S', 'A', 'K', 'E',
'W', 'R', 'S', 'R' ]
var letterBoard3 = [
'U', 'I', 'T',
'E', 'V', 'I',
'S', 'A', 'K' ]
var letterBoard2 = [
'P', 'I',
'E', 'T' ]
var letterBoard0 = [
'C', 'O', 'O',
'O', 'L', 'C' ]
// var board = new Board(letterBoard5_nat, 5, 5, 1)
// var board = new Board(letterBoard5, 5, 5, 1)
// var board = new Board(letterBoard4, 4, 4, 1)
var board = new Board(letterBoard3, 3, 3, 1)
// var board = new Board(letterBoard2, 2, 2, 1)
// var board = new Board(letterBoard0, 2, 3, 1)
var state = board.start()
console.log('legal plays : ' + board.legalPlays(state).length)
var mc = new MonteCarlo(board, 100)
mc.update(state)
var play = mc.getPlay(5)
if (play)
console.log('best play : ' + play.word + ' at ' + play.cells)
else
console.log('INSUFFICIENT DATA FOR MEANINGFUL ANSWER.')
app.get('/', function(request, response) {
response.send('hi')
})
// app.listen(3000, function() {
// console.log('listening on port 3000...')
// })