-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathpace.rb
56 lines (49 loc) · 1.26 KB
/
pace.rb
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
Targets = %q(
.byte $0,$0,$0,$0
.byte $68,$1,$4B,$0 ; 1
.byte $F8,$2,$6E,$0 ; 2
.byte $7E,$4,$9A,$0 ; 3
.byte $E6,$5,$E5,$0 ; 4
.byte $6C,$7,$12,$1 ; 5
.byte $CA,$8,$67,$1 ; 6
.byte $5A,$A,$89,$1 ; 7
.byte $B8,$B,$DE,$1 ; 8
.byte $3E,$D,$B,$2 ; 9
.byte $F2,$E,$A,$2 ; A
.byte $2C,$10,$83,$2 ; B
.byte $94,$11,$CD,$2 ; C
.byte $38,$13,$DC,$2 ; D
.byte $B4,$14,$13,$3 ; E
.byte $08,$16,$72,$3
)
.scan(/\$(.+),\$(.+),\$(.+),\$([0-9A-F]+)( |$)/i)
.map.with_index { |a, i|
[
i.to_s(16).upcase,
(a[1].to_i(16) << 8) + a[0].to_i(16),
(a[3].to_i(16) << 8) + a[2].to_i(16)
]
}
def print_pace(threshold, target, range, step = 1)
_, base, mult = Targets[target]
for i in range
index = i * step
if index <= threshold
points = base
else
points = base + (((index-threshold) / (230.0-threshold)) * mult)
end
print "
T: #{target.to_s(16).upcase}\
L: #{index}\
M: #{points.floor}\
P: #{(points * index).floor}\
"
# print "| #{target.to_s(16).upcase} | #{(points * index).floor} |\n"
end
end
# pp targets
for target in 0..0xF
# print_pace 110, target, 130..130, 1
end
print_pace 110, 0xA, 1..23, 10