-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathideas.txt
81 lines (77 loc) · 2.42 KB
/
ideas.txt
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# wargon
Playing around with computer chess in julia
```julia
include("wargon.jl")
```
"""
To do:
- Provide take moves before move moves -> faster alphabeta cutoff?
- With bitboards, can keep things immutable: generate a new board. Easily track castling etc.
- bitboard is giving about 40,000,000 movesearch + move [+ takeback] per second
- Never make a list of available moves. Just generate them and search straight away.
- Pawn structure evaluator idea: just play pawns forward without pieces.
- Generate dictionary of knight moves in advance.
===========================
julia> try
x == 2
catch err
f = open("/tmp/bad","w")
serialize(f, (1,2))
close(f)
throw(err)
end
ERROR: UndefVarError: x not defined
julia> open(deserialize, "/tmp/bad")
===========================
- immutable Moose
a::Int
end
- import Base.+
- +(m1::Moose, m2::Moose) = Moose(m1.a * m2.a)
- m = Moose(2)
- n = Moose(4)
- m+n
- @code_native m+n
- @code_warntype m+n
===========================
immutable Pieces
p::UInt8
end
immutable BitBoard
b::UInt64
end
x = reinterpret(Int, pawns.b)
923847392231271730
pawns = BitBoard(255 << 8)
x = reinterpret(Int, pawns.b)
for inc=1:64
print(x % 2)
x = div(x,2)
end
reverse(bin(pawns.b,64))
Use bitwise operators e.g. << to shift pieces around...
===========================
import AMPSPdfs.DTPDFS.PDF
f=PDF([1.],[6],[5 2 .5 1])
function samplevariancetest(f)
s=Float64[]
for i=1:1000000
push!(s,quantile(f,rand()))
end
return abs(var(f)/var(s)-1)<0.01
end
samplevariancetest(f)
using ProfileView
@profile samplevariancetest(f)
ProfileView.view()
===========================
- apply! and takeback! update board piece points for potential speedup. Also update board hash,
- Hash function idea: each piece/square combination is assigned a random hash at the start. For each board configuration, all true contingencies gives you a set of hashes. Bitwise or these together. Can then update this function on the fly, much like board points.
- Pawn structure, castling, ratio of points and king/rook unmoved board points
- Blocking pieces and no need to check square is in range
- En passent + Three-in-a-row rule...
- Serialize board -> hash table - https://en.wikipedia.org/wiki/Hash_table
- Get parallel threads running + computer thinking while human is thinking.
- Null moves + quiescence search
- Neural net static evaluator
"""