Anooj commited on
Commit
1aeb84a
1 Parent(s): 4610fe2
Files changed (2) hide show
  1. Manifest.toml +1 -1
  2. app.jl +27 -1
Manifest.toml CHANGED
@@ -43,7 +43,7 @@ version = "0.1.4"
43
 
44
  [[deps.Chess]]
45
  deps = ["Crayons", "Dates", "DefaultApplication", "Hiccup", "JSON", "Printf", "Random", "Revise", "SQLite", "StaticArrays", "StatsBase", "UUIDs"]
46
- git-tree-sha1 = "25dd5d7d76a48dade714e68361b50926a0cd77c9"
47
  repo-rev = "master"
48
  repo-url = "https://github.com/anoojpatel/Chess.jl.git"
49
  uuid = "717200cc-f167-4fd3-b4bf-b5e480529844"
 
43
 
44
  [[deps.Chess]]
45
  deps = ["Crayons", "Dates", "DefaultApplication", "Hiccup", "JSON", "Printf", "Random", "Revise", "SQLite", "StaticArrays", "StatsBase", "UUIDs"]
46
+ git-tree-sha1 = "f1d6573338fd6ebadd8b2b6dd24eeb4559d6006b"
47
  repo-rev = "master"
48
  repo-url = "https://github.com/anoojpatel/Chess.jl.git"
49
  uuid = "717200cc-f167-4fd3-b4bf-b5e480529844"
app.jl CHANGED
@@ -1,20 +1,37 @@
1
  module App # Needed for Genie to use loadapp()
2
 
3
  using Genie.Renderer.Html, Stipple, StippleUI
 
 
4
 
 
5
  @reactive mutable struct Model <: ReactiveModel
6
  process::R{Bool} = false
 
 
7
  output::R{String} = ""
8
  input::R{String} = ""
 
 
9
  end
10
 
11
  function handlers(model)
12
  on(model.process) do _
13
  if (model.process[])
14
  model.output[] = model.input[] |> reverse
 
 
15
  model.process[] = false
16
  end
17
  end
 
 
 
 
 
 
 
 
18
 
19
  model
20
  end
@@ -22,7 +39,7 @@ end
22
  function ui(model)
23
  page(model, class="container", [
24
  p([
25
- "Input "
26
  input("", @bind(:input), @on("keyup.enter", "process = true"))
27
  ])
28
 
@@ -34,6 +51,15 @@ function ui(model)
34
  "Output: "
35
  span("", @text(:output))
36
  ])
 
 
 
 
 
 
 
 
 
37
  ]
38
  )
39
  end
 
1
  module App # Needed for Genie to use loadapp()
2
 
3
  using Genie.Renderer.Html, Stipple, StippleUI
4
+ using ImpCatcher
5
+ using Chess
6
 
7
+ const C = Chess
8
  @reactive mutable struct Model <: ReactiveModel
9
  process::R{Bool} = false
10
+ rollout::R{Bool} = false
11
+ reset::R{Bool} = false
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
27
+ on(model.reset) do _
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
 
36
  model
37
  end
 
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"))
44
  ])
45
 
 
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