-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.jl
24 lines (21 loc) · 896 Bytes
/
config.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# CONFIG
function configure(; ties=:coinflip, nodeformat=:combined)
global coinflip
if ties == :coinflip
coinflip() = Int(rand(Bool))
elseif ties == :loss
coinflip() = 0
elseif ties == :win
coinflip() = 1
else
nothing
end
if nodeformat == :combined
Base.show(io::IO, x::Node) = print(io, "Node($(x.wins+x.winsAMAF)/$(x.sims+x.simsAMAF), $(length(x.children))$(x.parent == nothing ? ", root" : ""))")
elseif nodeformat == :sum
Base.show(io::IO, x::Node) = print(io, "Node($(x.wins)+$(x.winsAMAF)/$(x.sims)+$(x.simsAMAF), $(length(x.children))$(x.parent == nothing ? ", root" : ""))")
elseif nodeformat == :separate
Base.show(io::IO, x::Node) = print(io, "Node($(x.wins)/$(x.sims), amaf: $(x.winsAMAF)/$(x.simsAMAF) $(length(x.children))$(x.parent == nothing ? ", root" : ""))")
end
nothing
end