Anooj commited on
Commit
878b9a9
1 Parent(s): 1d57795

working board demo

Browse files
Files changed (1) hide show
  1. app.jl +29 -9
app.jl CHANGED
@@ -12,15 +12,17 @@ const C = Chess
12
  output::R{String} = ""
13
  input::R{String} = ""
14
  boardstr::R{String} = repr(C.startboarddark())
 
15
  board::R{Board} = C.startboarddark()
16
  end
17
 
18
  function handlers(model)
19
  on(model.process) do _
20
  if (model.process[])
21
- model.output[] = model.input[] |> reverse
22
  model.board[] = C.domove(model.board[!], model.input[!])
23
  model.boardstr[] = repr(model.board[!])
 
24
  model.process[] = false
25
  end
26
  end
@@ -28,8 +30,16 @@ function handlers(model)
28
  if (model.reset[])
29
  model.board[] = C.startboarddark()
30
  model.boardstr[] = repr(model.board[!])
 
31
  model.reset[] = false
32
  end
 
 
 
 
 
 
 
33
 
34
  end
35
 
@@ -38,6 +48,8 @@ end
38
 
39
  function ui(model)
40
  page(model, class="container", [
 
 
41
  p([
42
  "Input Move in UCI format (e.g \"d2d4\") == Move(SQ_D2, SQ_D4)"
43
  input("", @bind(:input), @on("keyup.enter", "process = true"))
@@ -48,19 +60,27 @@ function ui(model)
48
  ])
49
 
50
  p([
51
- "Output: "
52
- span("", @text(:output))
53
  ])
54
- p([
55
- "{{ boardstr }}"
56
- ])
 
 
 
 
 
 
57
  p([
58
  button("Reset Game",@click("reset = true"))
59
- ])
 
60
  p([
61
  button("CESPF Greedy Rollout", @click("rollout = true"))
62
- ])
63
- ]
 
64
  )
65
  end
66
 
 
12
  output::R{String} = ""
13
  input::R{String} = ""
14
  boardstr::R{String} = repr(C.startboarddark())
15
+ boardhtml::R{String} = repr(C.MIME.html(C.startboarddark()))
16
  board::R{Board} = C.startboarddark()
17
  end
18
 
19
  function handlers(model)
20
  on(model.process) do _
21
  if (model.process[])
22
+ model.output[] = model.input[]
23
  model.board[] = C.domove(model.board[!], model.input[!])
24
  model.boardstr[] = repr(model.board[!])
25
+ model.boardhtml[] = repr(C.MIME.html(model.board[!]))
26
  model.process[] = false
27
  end
28
  end
 
30
  if (model.reset[])
31
  model.board[] = C.startboarddark()
32
  model.boardstr[] = repr(model.board[!])
33
+ model.boardhtml[] = repr(C.MIME.html(model.board[!]))
34
  model.reset[] = false
35
  end
36
+ end
37
+ on(model.rollout) do _
38
+ if (model.rollout[])
39
+ model.board[], _ = ImpCatcher.simulate_rollout(model.board[!], ImpCatcher.CESPF, 0)
40
+ model.boardhtml[] = repr(C.MIME.html(model.board[!]))
41
+ model.rollout[] = false
42
+ end
43
 
44
  end
45
 
 
48
 
49
  function ui(model)
50
  page(model, class="container", [
51
+ h1("Building Dark Chess Engines for SOTA Performance")
52
+ h3("By Anooj Patel")
53
  p([
54
  "Input Move in UCI format (e.g \"d2d4\") == Move(SQ_D2, SQ_D4)"
55
  input("", @bind(:input), @on("keyup.enter", "process = true"))
 
60
  ])
61
 
62
  p([
63
+ "Last Move Processed"
64
+ pre("", @text(:output))
65
  ])
66
+ span(
67
+ var"v-html" = "boardhtml" # magic to summon vue js
68
+ )
69
+ #p([
70
+ # model.boardhtml[!]
71
+ # ], @on("keyup.enter"," boardhtml = repr(C.MIME.html(model))")
72
+ #p([
73
+ # pre("{{ boardstr }}")
74
+ #])
75
  p([
76
  button("Reset Game",@click("reset = true"))
77
+ ])
78
+ "CESPF is a Capture / Escape, Stronger Piece First Heuristic when trying to roll out perfect information chess boards."
79
  p([
80
  button("CESPF Greedy Rollout", @click("rollout = true"))
81
+ ])
82
+ ],
83
+ @iif(:isready)
84
  )
85
  end
86