mjai-manue 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mjai/manue/danger_estimator.rb +151 -121
- data/lib/mjai/manue/mjai_manue_command.rb +1 -1
- data/lib/mjai/manue/player.rb +17 -12
- data/share/danger_tree.all.json +1 -0
- data/share/game_stats.json +1 -0
- metadata +12 -5
@@ -4,6 +4,8 @@ require "set"
|
|
4
4
|
require "optparse"
|
5
5
|
|
6
6
|
require "mjai/pai"
|
7
|
+
require "mjai/archive"
|
8
|
+
require "mjai/confidence_interval"
|
7
9
|
|
8
10
|
|
9
11
|
module Mjai
|
@@ -15,26 +17,6 @@ module Mjai
|
|
15
17
|
|
16
18
|
class Scene
|
17
19
|
|
18
|
-
URASUJI_INV_MAP = {
|
19
|
-
1 => [5],
|
20
|
-
2 => [1, 6],
|
21
|
-
3 => [2, 7],
|
22
|
-
4 => [3, 5, 8],
|
23
|
-
5 => [1, 4, 6, 9],
|
24
|
-
6 => [2, 5, 7],
|
25
|
-
7 => [3, 8],
|
26
|
-
8 => [4, 9],
|
27
|
-
9 => [5],
|
28
|
-
}
|
29
|
-
|
30
|
-
SENKISUJI_INV_MAP = {
|
31
|
-
3 => [1, 8],
|
32
|
-
4 => [2, 9],
|
33
|
-
5 => [3, 7],
|
34
|
-
6 => [1, 8],
|
35
|
-
7 => [2, 9],
|
36
|
-
}
|
37
|
-
|
38
20
|
@@feature_names = []
|
39
21
|
|
40
22
|
def self.define_feature(name, &block)
|
@@ -46,35 +28,39 @@ module Mjai
|
|
46
28
|
return @@feature_names
|
47
29
|
end
|
48
30
|
|
49
|
-
def initialize(
|
31
|
+
def initialize(params)
|
50
32
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
33
|
+
if params[:game]
|
34
|
+
params = params.dup()
|
35
|
+
# Adds params[:dapai] because the game object points to the scene after the dapai.
|
36
|
+
params[:tehais] = params[:me].tehais + (params[:dapai] ? [params[:dapai]] : [])
|
37
|
+
params[:anpais] = params[:reacher].anpais
|
38
|
+
params[:doras] = params[:game].doras
|
39
|
+
params[:bakaze] = params[:game].bakaze
|
40
|
+
params[:reacher_kaze] = params[:reacher].jikaze
|
41
|
+
params[:visible] = []
|
42
|
+
params[:visible] += params[:game].dora_markers
|
43
|
+
params[:visible] += params[:me].tehais
|
44
|
+
for player in params[:game].players
|
45
|
+
params[:visible] += player.ho + player.furos.map(){ |f| f.pais }.flatten()
|
46
|
+
end
|
47
|
+
end
|
56
48
|
|
57
|
-
|
58
|
-
|
59
|
-
@anpai_set = to_pai_set(
|
60
|
-
@
|
61
|
-
@
|
62
|
-
@
|
63
|
-
@
|
64
|
-
@tehai_set = to_pai_set(tehais)
|
49
|
+
prereach_sutehais = params[:prereach_sutehais]
|
50
|
+
@tehai_set = to_pai_set(params[:tehais])
|
51
|
+
@anpai_set = to_pai_set(params[:anpais])
|
52
|
+
@visible_set = to_pai_set(params[:visible])
|
53
|
+
@dora_set = to_pai_set(params[:doras])
|
54
|
+
@bakaze = params[:bakaze]
|
55
|
+
@reacher_kaze = params[:reacher_kaze]
|
65
56
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
@visible_set = to_pai_set(visible)
|
57
|
+
@prereach_sutehai_set = to_pai_set(prereach_sutehais)
|
58
|
+
@early_sutehai_set = to_pai_set(prereach_sutehais[0...(prereach_sutehais.size / 2)])
|
59
|
+
@late_sutehai_set = to_pai_set(prereach_sutehais[(prereach_sutehais.size / 2)..-1])
|
60
|
+
# prereach_sutehais can be empty in unit tests.
|
61
|
+
@reach_pai = prereach_sutehais[-1] ? prereach_sutehais[-1].remove_red() : nil
|
73
62
|
|
74
|
-
@candidates =
|
75
|
-
map(){ |pai| pai.remove_red() }.
|
76
|
-
uniq().
|
77
|
-
select(){ |pai| !@anpai_set.has_key?(pai) }
|
63
|
+
@candidates = @tehai_set.keys.select(){ |pai| !@anpai_set.has_key?(pai) }
|
78
64
|
|
79
65
|
end
|
80
66
|
|
@@ -103,29 +89,23 @@ module Mjai
|
|
103
89
|
return pai.type == "t"
|
104
90
|
end
|
105
91
|
|
92
|
+
# 表筋 or 中筋
|
106
93
|
define_feature("suji") do |pai|
|
107
|
-
|
108
|
-
return false
|
109
|
-
else
|
110
|
-
return get_suji_numbers(pai).all?(){ |n| @anpai_set.has_key?(Pai.new(pai.type, n)) }
|
111
|
-
end
|
94
|
+
return suji_of(pai, @anpai_set)
|
112
95
|
end
|
113
96
|
|
114
97
|
# 片筋 or 筋
|
115
98
|
define_feature("weak_suji") do |pai|
|
116
|
-
return
|
99
|
+
return weak_suji_of(pai, @anpai_set)
|
117
100
|
end
|
118
101
|
|
102
|
+
# リーチ牌の筋。1pリーチに対する4pなども含む。
|
119
103
|
define_feature("reach_suji") do |pai|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
return suji_numbers.all?(){ |n| @prereach_sutehai_set.include?(Pai.new(pai.type, n)) } &&
|
126
|
-
suji_numbers.include?(reach_pai.number) &&
|
127
|
-
@prereach_sutehai_set[reach_pai] == 1
|
128
|
-
end
|
104
|
+
return weak_suji_of(pai, to_pai_set([@reach_pai]))
|
105
|
+
end
|
106
|
+
|
107
|
+
define_feature("prereach_suji") do |pai|
|
108
|
+
return suji_of(pai, @prereach_sutehai_set)
|
129
109
|
end
|
130
110
|
|
131
111
|
# http://ja.wikipedia.org/wiki/%E7%AD%8B_(%E9%BA%BB%E9%9B%80)#.E8.A3.8F.E3.82.B9.E3.82.B8
|
@@ -138,7 +118,11 @@ module Mjai
|
|
138
118
|
end
|
139
119
|
|
140
120
|
define_feature("reach_urasuji") do |pai|
|
141
|
-
return urasuji_of(pai, to_pai_set([
|
121
|
+
return urasuji_of(pai, to_pai_set([@reach_pai]))
|
122
|
+
end
|
123
|
+
|
124
|
+
define_feature("urasuji_of_5") do |pai|
|
125
|
+
return urasuji_of(pai, @prereach_sutehai_set.select(){ |pai, f| pai.type != "t" && pai.number == 5 })
|
142
126
|
end
|
143
127
|
|
144
128
|
# http://ja.wikipedia.org/wiki/%E7%AD%8B_(%E9%BA%BB%E9%9B%80)#.E9.96.93.E5.9B.9B.E9.96.93
|
@@ -160,10 +144,18 @@ module Mjai
|
|
160
144
|
return matagisuji_of(pai, @prereach_sutehai_set)
|
161
145
|
end
|
162
146
|
|
147
|
+
define_feature("early_matagisuji") do |pai|
|
148
|
+
return matagisuji_of(pai, @early_sutehai_set)
|
149
|
+
end
|
150
|
+
|
163
151
|
define_feature("late_matagisuji") do |pai|
|
164
152
|
return matagisuji_of(pai, @late_sutehai_set)
|
165
153
|
end
|
166
154
|
|
155
|
+
define_feature("reach_matagisuji") do |pai|
|
156
|
+
return matagisuji_of(pai, to_pai_set([@reach_pai]))
|
157
|
+
end
|
158
|
+
|
167
159
|
# http://ja.wikipedia.org/wiki/%E7%AD%8B_(%E9%BA%BB%E9%9B%80)#.E7.96.9D.E6.B0.97.E3.82.B9.E3.82.B8
|
168
160
|
define_feature("senkisuji") do |pai|
|
169
161
|
return senkisuji_of(pai, @prereach_sutehai_set)
|
@@ -187,9 +179,24 @@ module Mjai
|
|
187
179
|
end
|
188
180
|
end
|
189
181
|
|
182
|
+
# 自分から見て何枚見えているか。自分の手牌も含む。出そうとしている牌自身は含まない。
|
190
183
|
(1..3).each() do |i|
|
191
184
|
define_feature("visible>=%d" % i) do |pai|
|
192
|
-
|
185
|
+
# i + 出そうとしている牌
|
186
|
+
return visible_n_or_more(pai, i + 1)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# その牌の筋の牌のうち1つがi枚以下しか見えていない。
|
191
|
+
# その牌自身はカウントしない。
|
192
|
+
# 5pの場合は「2pと8pのどちらかがi枚以下しか見えていない」であり、「2pと8pが合計でi枚以下しか見えていない」ではない。
|
193
|
+
(0..3).each() do |i|
|
194
|
+
define_feature("suji_visible<=#{i}") do |pai|
|
195
|
+
if pai.type == "t"
|
196
|
+
return false
|
197
|
+
else
|
198
|
+
return get_suji_numbers(pai).any?(){ |n| !visible_n_or_more(Pai.new(pai.type, n), i + 1) }
|
199
|
+
end
|
193
200
|
end
|
194
201
|
end
|
195
202
|
|
@@ -204,7 +211,7 @@ module Mjai
|
|
204
211
|
end
|
205
212
|
|
206
213
|
define_feature("dora_suji") do |pai|
|
207
|
-
return
|
214
|
+
return weak_suji_of(pai, @dora_set)
|
208
215
|
end
|
209
216
|
|
210
217
|
define_feature("dora_matagi") do |pai|
|
@@ -217,7 +224,10 @@ module Mjai
|
|
217
224
|
end
|
218
225
|
end
|
219
226
|
|
220
|
-
|
227
|
+
# その牌の筋の牌のうち1つをi枚以上持っている。
|
228
|
+
# その牌自身はカウントしない。
|
229
|
+
# 5pの場合は「2pと8pのどちらかをi枚以上持っている」であり、「2pと8pを合計i枚以上持っている」ではない。
|
230
|
+
(1..4).each() do |i|
|
221
231
|
define_feature("suji_in_tehais>=#{i}") do |pai|
|
222
232
|
if pai.type == "t"
|
223
233
|
return false
|
@@ -277,11 +287,11 @@ module Mjai
|
|
277
287
|
end
|
278
288
|
|
279
289
|
define_feature("bakaze") do |pai|
|
280
|
-
return pai == @
|
290
|
+
return pai == @bakaze
|
281
291
|
end
|
282
292
|
|
283
293
|
define_feature("jikaze") do |pai|
|
284
|
-
return pai == @
|
294
|
+
return pai == @reacher_kaze
|
285
295
|
end
|
286
296
|
|
287
297
|
def n_outer_prereach_sutehai(pai, n)
|
@@ -308,6 +318,14 @@ module Mjai
|
|
308
318
|
end
|
309
319
|
|
310
320
|
def suji_of(pai, target_pai_set)
|
321
|
+
if pai.type == "t"
|
322
|
+
return false
|
323
|
+
else
|
324
|
+
return get_suji_numbers(pai).all?(){ |n| target_pai_set.has_key?(Pai.new(pai.type, n)) }
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
def weak_suji_of(pai, target_pai_set)
|
311
329
|
if pai.type == "t"
|
312
330
|
return false
|
313
331
|
else
|
@@ -319,6 +337,18 @@ module Mjai
|
|
319
337
|
return [pai.number - 3, pai.number + 3].select(){ |n| (1..9).include?(n) }
|
320
338
|
end
|
321
339
|
|
340
|
+
# Uses the first pai to represent the suji. e.g. 1p for 14p suji
|
341
|
+
def get_possible_sujis(pai)
|
342
|
+
if pai.type == "t"
|
343
|
+
return []
|
344
|
+
else
|
345
|
+
ns = [pai.number - 3, pai.number].select() do |n|
|
346
|
+
[n, n + 3].all?(){ |m| (1..9).include?(m) && !@anpai_set.include?(Pai.new(pai.type, m)) }
|
347
|
+
end
|
348
|
+
return ns.map(){ |n| Pai.new(pai.type, n) }
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
322
352
|
def n_chance_or_less(pai, n)
|
323
353
|
if pai.type == "t" || (4..6).include?(pai.number)
|
324
354
|
return false
|
@@ -335,16 +365,15 @@ module Mjai
|
|
335
365
|
end
|
336
366
|
|
337
367
|
def visible_n_or_more(pai, n)
|
338
|
-
|
339
|
-
return @visible_set[pai] >= n + 1
|
368
|
+
return @visible_set[pai] >= n
|
340
369
|
end
|
341
370
|
|
342
371
|
def urasuji_of(pai, target_pai_set)
|
343
372
|
if pai.type == "t"
|
344
373
|
return false
|
345
374
|
else
|
346
|
-
|
347
|
-
return
|
375
|
+
sujis = get_possible_sujis(pai)
|
376
|
+
return sujis.any?(){ |s| target_pai_set.has_key?(s.next(-1)) || target_pai_set.has_key?(s.next(4)) }
|
348
377
|
end
|
349
378
|
end
|
350
379
|
|
@@ -352,9 +381,8 @@ module Mjai
|
|
352
381
|
if pai.type == "t"
|
353
382
|
return false
|
354
383
|
else
|
355
|
-
|
356
|
-
return
|
357
|
-
senkisuji_numbers.any?(){ |n| target_pai_set.has_key?(Pai.new(pai.type, n)) }
|
384
|
+
sujis = get_possible_sujis(pai)
|
385
|
+
return sujis.any?(){ |s| target_pai_set.has_key?(s.next(-2)) || target_pai_set.has_key?(s.next(5)) }
|
358
386
|
end
|
359
387
|
end
|
360
388
|
|
@@ -362,14 +390,8 @@ module Mjai
|
|
362
390
|
if pai.type == "t"
|
363
391
|
return false
|
364
392
|
else
|
365
|
-
|
366
|
-
|
367
|
-
matagisuji_numbers += [pai.number - 2, pai.number - 1]
|
368
|
-
end
|
369
|
-
if pai.number <= 6
|
370
|
-
matagisuji_numbers += [pai.number + 1, pai.number + 2]
|
371
|
-
end
|
372
|
-
return matagisuji_numbers.any?(){ |n| target_pai_set.has_key?(Pai.new(pai.type, n)) }
|
393
|
+
sujis = get_possible_sujis(pai)
|
394
|
+
return sujis.any?(){ |s| target_pai_set.has_key?(s.next(1)) || target_pai_set.has_key?(s.next(2)) }
|
373
395
|
end
|
374
396
|
end
|
375
397
|
|
@@ -382,15 +404,11 @@ module Mjai
|
|
382
404
|
end
|
383
405
|
end
|
384
406
|
|
385
|
-
def reach_pai
|
386
|
-
return @prereach_sutehais[-1]
|
387
|
-
end
|
388
|
-
|
389
407
|
def fanpai_fansu(pai)
|
390
408
|
if pai.type == "t" && pai.number >= 5
|
391
409
|
return 1
|
392
410
|
else
|
393
|
-
return (pai == @
|
411
|
+
return (pai == @bakaze ? 1 : 0) + (pai == @reacher_kaze ? 1 : 0)
|
394
412
|
end
|
395
413
|
end
|
396
414
|
|
@@ -430,7 +448,8 @@ module Mjai
|
|
430
448
|
attr_accessor(:verbose)
|
431
449
|
attr_accessor(:min_gap)
|
432
450
|
|
433
|
-
def extract_features_from_files(input_paths, output_path)
|
451
|
+
def extract_features_from_files(input_paths, output_path, listener = nil)
|
452
|
+
require "with_progress"
|
434
453
|
$stderr.puts("%d files." % input_paths.size)
|
435
454
|
open(output_path, "wb") do |f|
|
436
455
|
meta_data = {
|
@@ -443,13 +462,13 @@ module Mjai
|
|
443
462
|
Marshal.dump(@stored_kyokus, f)
|
444
463
|
@stored_kyokus.clear()
|
445
464
|
end
|
446
|
-
extract_features_from_file(path)
|
465
|
+
extract_features_from_file(path, listener)
|
447
466
|
end
|
448
467
|
Marshal.dump(@stored_kyokus, f)
|
449
468
|
end
|
450
469
|
end
|
451
470
|
|
452
|
-
def extract_features_from_file(input_path)
|
471
|
+
def extract_features_from_file(input_path, listener)
|
453
472
|
begin
|
454
473
|
stored_kyoku = nil
|
455
474
|
reacher = nil
|
@@ -483,14 +502,26 @@ module Mjai
|
|
483
502
|
|
484
503
|
when :dahai
|
485
504
|
next if skip || !reacher || action.actor.reach?
|
486
|
-
scene = Scene.new(
|
505
|
+
scene = Scene.new({
|
506
|
+
:game => archive,
|
507
|
+
:me => action.actor,
|
508
|
+
:dapai => action.pai,
|
509
|
+
:reacher => reacher,
|
510
|
+
:prereach_sutehais => prereach_sutehais,
|
511
|
+
})
|
487
512
|
stored_scene = StoredScene.new([])
|
488
513
|
#p [:candidates, action.actor, reacher, scene.candidates.join(" ")]
|
489
514
|
puts("reacher: %d" % reacher.id) if self.verbose
|
515
|
+
candidates = []
|
490
516
|
for pai in scene.candidates
|
491
517
|
hit = waited.include?(pai)
|
492
518
|
feature_vector = scene.feature_vector(pai)
|
493
519
|
stored_scene.candidates.push([feature_vector, hit])
|
520
|
+
candidates.push({
|
521
|
+
:pai => pai,
|
522
|
+
:hit => hit,
|
523
|
+
:feature_vector => feature_vector,
|
524
|
+
})
|
494
525
|
if self.verbose
|
495
526
|
puts("candidate %s: hit=%d, %s" % [
|
496
527
|
pai,
|
@@ -499,6 +530,14 @@ module Mjai
|
|
499
530
|
end
|
500
531
|
end
|
501
532
|
stored_kyoku.scenes.push(stored_scene)
|
533
|
+
if listener
|
534
|
+
listener.on_dahai({
|
535
|
+
:game => archive,
|
536
|
+
:action => action,
|
537
|
+
:reacher => reacher,
|
538
|
+
:candidates => candidates,
|
539
|
+
})
|
540
|
+
end
|
502
541
|
|
503
542
|
end
|
504
543
|
end
|
@@ -570,14 +609,31 @@ module Mjai
|
|
570
609
|
end
|
571
610
|
end
|
572
611
|
end
|
612
|
+
|
613
|
+
def node_to_hash(node)
|
614
|
+
if node
|
615
|
+
return {
|
616
|
+
"average_prob" => node.average_prob,
|
617
|
+
"conf_interval" => node.conf_interval,
|
618
|
+
"num_samples" => node.num_samples,
|
619
|
+
"feature_name" => node.feature_name,
|
620
|
+
"negative" => node_to_hash(node.negative),
|
621
|
+
"positive" => node_to_hash(node.positive),
|
622
|
+
}
|
623
|
+
else
|
624
|
+
return nil
|
625
|
+
end
|
626
|
+
end
|
573
627
|
|
574
628
|
def calculate_probabilities(features_path, criteria)
|
575
629
|
create_kyoku_probs_map(features_path, criteria)
|
576
|
-
|
630
|
+
return aggregate_probabilities(criteria)
|
577
631
|
end
|
578
632
|
|
579
633
|
def create_kyoku_probs_map(features_path, criteria)
|
580
634
|
|
635
|
+
require "with_progress"
|
636
|
+
|
581
637
|
@kyoku_probs_map = {}
|
582
638
|
|
583
639
|
criterion_masks = {}
|
@@ -586,6 +642,7 @@ module Mjai
|
|
586
642
|
negative_ary = [true] * Scene.feature_names.size
|
587
643
|
for name, value in criterion
|
588
644
|
index = Scene.feature_names.index(name)
|
645
|
+
raise("no such feature: %p" % name) if !index
|
589
646
|
if value
|
590
647
|
positive_ary[index] = true
|
591
648
|
else
|
@@ -618,16 +675,16 @@ module Mjai
|
|
618
675
|
|
619
676
|
end
|
620
677
|
|
621
|
-
def
|
678
|
+
def aggregate_probabilities(criteria)
|
622
679
|
result = {}
|
623
680
|
for criterion in criteria
|
624
681
|
kyoku_probs = @kyoku_probs_map[criterion.object_id]
|
625
682
|
next if !kyoku_probs
|
626
683
|
result[criterion] = node = DecisionNode.new(
|
627
684
|
kyoku_probs.inject(:+) / kyoku_probs.size,
|
628
|
-
|
685
|
+
ConfidenceInterval.calculate(kyoku_probs, :min => 0.0, :max => 1.0),
|
629
686
|
kyoku_probs.size)
|
630
|
-
|
687
|
+
print("%p\n %.2f [%.2f, %.2f] (%d samples)\n\n" %
|
631
688
|
[criterion,
|
632
689
|
node.average_prob * 100.0,
|
633
690
|
node.conf_interval[0] * 100.0,
|
@@ -672,33 +729,6 @@ module Mjai
|
|
672
729
|
(feature_vector | negative_mask) == negative_mask
|
673
730
|
end
|
674
731
|
|
675
|
-
# Uses bootstrap resampling.
|
676
|
-
def confidence_interval(samples, conf_level = 0.95)
|
677
|
-
num_tries = 1000
|
678
|
-
averages = []
|
679
|
-
num_tries.times() do
|
680
|
-
sum = 0.0
|
681
|
-
(samples.size + 2).times() do
|
682
|
-
idx = rand(samples.size + 2)
|
683
|
-
case idx
|
684
|
-
when samples.size
|
685
|
-
sum += 0.0
|
686
|
-
when samples.size + 1
|
687
|
-
sum += 1.0
|
688
|
-
else
|
689
|
-
sum += samples[idx]
|
690
|
-
end
|
691
|
-
end
|
692
|
-
averages.push(sum / (samples.size + 2))
|
693
|
-
end
|
694
|
-
averages.sort!()
|
695
|
-
margin = (1.0 - conf_level) / 2
|
696
|
-
return [
|
697
|
-
averages[(num_tries * margin).to_i()],
|
698
|
-
averages[(num_tries * (1.0 - margin)).to_i()],
|
699
|
-
]
|
700
|
-
end
|
701
|
-
|
702
732
|
def self.bool_array_to_bit_vector(bool_array)
|
703
733
|
vector = 0
|
704
734
|
bool_array.reverse_each() do |value|
|
data/lib/mjai/manue/player.rb
CHANGED
@@ -70,14 +70,14 @@ module Mjai
|
|
70
70
|
raise("unknown score_type")
|
71
71
|
end
|
72
72
|
if eval.prob_info.progress_prob > 0.0
|
73
|
-
log("%s: ept=%d ppr=%.3f hpr=%.3f apt=%d (%s)\n" % [
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
])
|
73
|
+
# log("%s: ept=%d ppr=%.3f hpr=%.3f apt=%d (%s)\n" % [
|
74
|
+
# pai,
|
75
|
+
# eval.expected_points,
|
76
|
+
# eval.prob_info.progress_prob,
|
77
|
+
# eval.prob_info.hora_prob,
|
78
|
+
# eval.points_estimate.average_points,
|
79
|
+
# eval.points_estimate.yaku_debug_str,
|
80
|
+
# ])
|
81
81
|
end
|
82
82
|
@evals[pai] = eval
|
83
83
|
end
|
@@ -150,8 +150,13 @@ module Mjai
|
|
150
150
|
if player != self && player.reach?
|
151
151
|
#p [:reacher, player, @prereach_sutehais_map[player]]
|
152
152
|
has_reacher = true
|
153
|
-
scene = DangerEstimator::Scene.new(
|
154
|
-
self.game,
|
153
|
+
scene = DangerEstimator::Scene.new({
|
154
|
+
:game => self.game,
|
155
|
+
:me => self,
|
156
|
+
:dapai => nil,
|
157
|
+
:reacher => player,
|
158
|
+
:prereach_sutehais => @prereach_sutehais_map[player],
|
159
|
+
})
|
155
160
|
for pai in safe_probs.keys
|
156
161
|
if scene.anpai?(pai)
|
157
162
|
safe_prob = 1.0
|
@@ -164,7 +169,7 @@ module Mjai
|
|
164
169
|
end
|
165
170
|
if has_reacher
|
166
171
|
for pai, safe_prob in safe_probs
|
167
|
-
log("%s: safe_prob=%.3f\n" % [pai, safe_prob])
|
172
|
+
#log("%s: safe_prob=%.3f\n" % [pai, safe_prob])
|
168
173
|
end
|
169
174
|
end
|
170
175
|
max_safe_prob = safe_probs.values.max
|
@@ -256,7 +261,7 @@ module Mjai
|
|
256
261
|
|
257
262
|
def get_scene(params)
|
258
263
|
visible = []
|
259
|
-
visible += self.game.
|
264
|
+
visible += self.game.dora_markers
|
260
265
|
visible += self.tehais
|
261
266
|
for player in self.game.players
|
262
267
|
visible += player.ho + player.furos.map(){ |f| f.pais }.flatten()
|
@@ -0,0 +1 @@
|
|
1
|
+
{"average_prob":0.0977659128413358,"conf_interval":[0.09699083321177084,0.09864226119626654],"num_samples":20632,"feature_name":"fonpai","negative":{"average_prob":0.10018062523357114,"conf_interval":[0.09941735684682464,0.10104638792901802],"num_samples":20632,"feature_name":"sangenpai","negative":{"average_prob":0.10235136631429993,"conf_interval":[0.10151202100607147,0.10332445912734464],"num_samples":20631,"feature_name":"suji","negative":{"average_prob":0.1131854445492974,"conf_interval":[0.11207409620732552,0.11437554838914007],"num_samples":20631,"feature_name":"chances<=0","negative":{"average_prob":0.11530858800732842,"conf_interval":[0.11416868449372367,0.11652437829638682],"num_samples":20631,"feature_name":"outer_early_sutehai","negative":{"average_prob":0.11728675757173902,"conf_interval":[0.11607765435516033,0.11859005157336949],"num_samples":20628,"feature_name":"1_outer_prereach_sutehai","negative":{"average_prob":0.12077154080190736,"conf_interval":[0.11940119428457707,0.12222823816336795],"num_samples":20624,"feature_name":"2_outer_prereach_sutehai","negative":{"average_prob":0.12340982722131649,"conf_interval":[0.12204685859556105,0.12511547034191628],"num_samples":20603,"feature_name":"weak_suji","negative":{"average_prob":0.13547181241162093,"conf_interval":[0.13344151342491126,0.1374945090749546],"num_samples":20553,"feature_name":"chances<=1","negative":{"average_prob":0.13849326854389366,"conf_interval":[0.13630414196402746,0.14069086669952918],"num_samples":20523,"feature_name":"2<=n<=8","negative":{"average_prob":0.09867081478758176,"conf_interval":[0.09454895886459852,0.10282606891698144],"num_samples":15326,"feature_name":"suji_in_tehais>=4","negative":{"average_prob":0.0986406469157249,"conf_interval":[0.09469675339259163,0.10287329265478931],"num_samples":15325,"feature_name":"suji_in_tehais>=3","negative":{"average_prob":0.09815101860536685,"conf_interval":[0.09407944689659486,0.10232765176523113],"num_samples":15268,"feature_name":"dora_suji","negative":{"average_prob":0.09848426132298586,"conf_interval":[0.09432826028123964,0.10239622664235556],"num_samples":15059,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.06428836863619472,"conf_interval":[0.048943270300333706,0.08231368186874305],"num_samples":897,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.14221218961625282,"conf_interval":[0.11235955056179775,0.1797752808988764],"num_samples":443,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.3,"conf_interval":[0.13636363636363635,0.5],"num_samples":20,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.13964563671451002,"conf_interval":[0.13750235270584443,0.14205845622723504],"num_samples":20458,"feature_name":"+-2_in_prereach_sutehais>=2","negative":{"average_prob":0.14078708498279657,"conf_interval":[0.1387251352044091,0.14343423202442573],"num_samples":20230,"feature_name":"1_inner_prereach_sutehai","negative":{"average_prob":0.1424684577175747,"conf_interval":[0.13995677348588795,0.14528683665896114],"num_samples":19877,"feature_name":"in_tehais>=4","negative":{"average_prob":0.1422315159618395,"conf_interval":[0.1397285141060151,0.1448102471629269],"num_samples":19875,"feature_name":"2_inner_prereach_sutehai","negative":{"average_prob":0.14466118042862383,"conf_interval":[0.14172569781228386,0.14760075585542354],"num_samples":19103,"feature_name":"3<=n<=7","negative":{"average_prob":0.10682853783107253,"conf_interval":[0.10250322935950926,0.11093547985339708],"num_samples":16487,"feature_name":"early_urasuji","negative":{"average_prob":0.10497697439385134,"conf_interval":[0.10124577125564789,0.10890413222518636],"num_samples":16250,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.16144997324772606,"conf_interval":[0.1356,0.1952],"num_samples":623,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.14957142108102345,"conf_interval":[0.1463023489418222,0.15307384013474976],"num_samples":18826,"feature_name":"chances<=3","negative":{"average_prob":0.15450045920017969,"conf_interval":[0.1505850618946997,0.1584804610827456],"num_samples":18118,"feature_name":"+-2_in_prereach_sutehais>=1","negative":{"average_prob":0.15935236598617158,"conf_interval":[0.15481256535563193,0.16353982145311335],"num_samples":15787,"feature_name":"4<=n<=6","negative":{"average_prob":0.11704998966904358,"conf_interval":[0.10941178194087713,0.12485386853904629],"num_samples":6000,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.16043128939282186,"conf_interval":[0.15578445718233117,0.16480456584287784],"num_samples":15391,"feature_name":"reach_urasuji","negative":{"average_prob":0.1601941934747866,"conf_interval":[0.1555880971728387,0.16498696119813036],"num_samples":14858,"feature_name":"dora","negative":{"average_prob":0.16055103494647321,"conf_interval":[0.1563153535742823,0.1652217231942112],"num_samples":14738,"feature_name":"5<=n<=5","negative":{"average_prob":0.15572826885720453,"conf_interval":[0.1506534166862541,0.16130725037900775],"num_samples":13725,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.13133469745733814,"conf_interval":[0.12581025529416773,0.13740180325807103],"num_samples":10783,"feature_name":"same_type_in_prereach>=2","negative":{"average_prob":0.1271038541328988,"conf_interval":[0.1211832738271493,0.13339719282103749],"num_samples":10107,"feature_name":"suji_in_tehais>=3","negative":{"average_prob":0.126686539732979,"conf_interval":[0.12028825259691062,0.13268059028117454],"num_samples":10028,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.18097345132743362,"conf_interval":[0.14713656387665197,0.21541850220264316],"num_samples":452,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.17148760330578514,"conf_interval":[0.14845360824742268,0.19510309278350516],"num_samples":968,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.12549361207897794,"conf_interval":[0.10743274582560297,0.14366883116883117],"num_samples":1230,"feature_name":"suji_in_tehais>=4","negative":{"average_prob":0.12549361207897794,"conf_interval":[0.10876623376623376,0.1431470315398887],"num_samples":1230,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.6666666666666666,"conf_interval":[0.2,1.0],"num_samples":3,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.11480730223123732,"conf_interval":[0.10174300770166193,0.1272800972841508],"num_samples":2465,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.11299176198533151,"conf_interval":[0.10587835219743148,0.11967348013768818],"num_samples":7284,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.11374554320396123,"conf_interval":[0.10969478153974124,0.11795272681730654],"num_samples":15295,"feature_name":"suji_in_tehais>=3","negative":{"average_prob":0.11351067688296056,"conf_interval":[0.10940593878426275,0.11763951557391956],"num_samples":15238,"feature_name":"in_tehais>=3","negative":{"average_prob":0.11237185066556213,"conf_interval":[0.10805411269237093,0.11689954309632845],"num_samples":15084,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.1467296827466319,"conf_interval":[0.1275464845232287,0.17129343524692361],"num_samples":944,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.15803995144023839,"conf_interval":[0.12897196261682242,0.19109400769653656],"num_samples":533,"feature_name":null,"negative":null,"positive":null}}}},"positive":{"average_prob":0.1057989364001028,"conf_interval":[0.1015548721791112,0.11053154642547867],"num_samples":13889,"feature_name":"urasuji","negative":{"average_prob":0.09837684374627009,"conf_interval":[0.09353847567364047,0.10342634373011264],"num_samples":11934,"feature_name":"in_tehais>=3","negative":{"average_prob":0.09746345866685946,"conf_interval":[0.0924746839502671,0.1026654264044598],"num_samples":11763,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.13887176325524045,"conf_interval":[0.116389913899139,0.16328413284132842],"num_samples":811,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.12808999898470272,"conf_interval":[0.11801043583195395,0.13850890658390155],"num_samples":3597,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.23161764705882354,"conf_interval":[0.1796116504854369,0.2924757281553398],"num_samples":204,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.10411717921286896,"conf_interval":[0.10020705662476356,0.10869625403378073],"num_samples":16201,"feature_name":"aida4ken","negative":{"average_prob":0.09784536747482481,"conf_interval":[0.0934212003933615,0.10231896924966324],"num_samples":14710,"feature_name":"suji_in_tehais>=4","negative":{"average_prob":0.0977785107948049,"conf_interval":[0.09363028822153988,0.10233360149320471],"num_samples":14709,"feature_name":"5<=n<=5","negative":{"average_prob":0.09359660275059009,"conf_interval":[0.08943025692046858,0.0978139563931959],"num_samples":13928,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.12593377804528055,"conf_interval":[0.1112205644461419,0.14241595445448155],"num_samples":1666,"feature_name":"in_tehais>=3","negative":{"average_prob":0.12348391198653386,"conf_interval":[0.1082220059492787,0.13843503234950605],"num_samples":1626,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.24719101123595505,"conf_interval":[0.16483516483516483,0.34065934065934067],"num_samples":89,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.26666666666666666,"conf_interval":[0.11764705882352941,0.5294117647058824],"num_samples":15,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.13257278167400294,"conf_interval":[0.12150448877096959,0.14463400979940808],"num_samples":3449,"feature_name":"in_tehais>=3","negative":{"average_prob":0.13224014817559324,"conf_interval":[0.12190433639059192,0.14433535553929314],"num_samples":3363,"feature_name":"4<=n<=6","negative":{"average_prob":0.11509895720569326,"conf_interval":[0.10418765415674631,0.12787496851333735],"num_samples":2680,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.1550129850919722,"conf_interval":[0.13909793144660543,0.17295173617763],"num_samples":1844,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.20463320463320464,"conf_interval":[0.16091954022988506,0.26053639846743293],"num_samples":259,"feature_name":null,"negative":null,"positive":null}}}},"positive":{"average_prob":0.10117368079140103,"conf_interval":[0.0950851246852043,0.1075637056955202],"num_samples":7431,"feature_name":"aida4ken","negative":{"average_prob":0.09242893943897554,"conf_interval":[0.08537097645742933,0.09969790467867547],"num_samples":6112,"feature_name":"senkisuji","negative":{"average_prob":0.05259200633161852,"conf_interval":[0.035982008995502246,0.07196401799100449],"num_samples":665,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.09300238059438379,"conf_interval":[0.08611422939755503,0.10080966415618323],"num_samples":5946,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.13756139149442462,"conf_interval":[0.12260108338169859,0.15485086228339276],"num_samples":1721,"feature_name":"in_tehais>=4","negative":{"average_prob":0.13655797252001442,"conf_interval":[0.12101906422069118,0.15384362635234222],"num_samples":1719,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.75,"conf_interval":[0.3333333333333333,1.0],"num_samples":4,"feature_name":null,"negative":null,"positive":null}}}}},"positive":{"average_prob":0.09562360144891122,"conf_interval":[0.09169361411372577,0.10005270940734637],"num_samples":13166,"feature_name":"suji_in_tehais>=4","negative":{"average_prob":0.09545485633137676,"conf_interval":[0.09131310041213968,0.10005761132108662],"num_samples":13165,"feature_name":"suji_in_tehais>=3","negative":{"average_prob":0.0949596284709186,"conf_interval":[0.09103098594725065,0.0994297733631742],"num_samples":13138,"feature_name":"2<=n<=8","negative":{"average_prob":0.07516033740698516,"conf_interval":[0.0687027448917026,0.08162830348164538],"num_samples":6172,"feature_name":"suji_in_tehais>=2","negative":{"average_prob":0.07208313283111047,"conf_interval":[0.06602880776415096,0.07862968111734686],"num_samples":5864,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.12259443065894678,"conf_interval":[0.10119636963696371,0.14643839383938392],"num_samples":806,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.09900234456941656,"conf_interval":[0.09418125788547363,0.10356889827205316],"num_samples":11301,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.15840252152521525,"conf_interval":[0.12986366421568626,0.1904871323529412],"num_samples":542,"feature_name":"in_tehais>=4","negative":{"average_prob":0.15840252152521525,"conf_interval":[0.13020833333333331,0.193359375],"num_samples":542,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":1.0,"conf_interval":[0.25,1.0],"num_samples":2,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.29411764705882354,"conf_interval":[0.16666666666666666,0.4444444444444444],"num_samples":34,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.08689547618456497,"conf_interval":[0.08432160984073278,0.08951301356217871],"num_samples":19605,"feature_name":"in_tehais>=4","negative":{"average_prob":0.08677795580154878,"conf_interval":[0.08442329386108786,0.08940708506059264],"num_samples":19601,"feature_name":"in_tehais>=3","negative":{"average_prob":0.08620819565866088,"conf_interval":[0.08373873969471071,0.0887712825547495],"num_samples":19535,"feature_name":"late_matagisuji","negative":{"average_prob":0.09018007303000625,"conf_interval":[0.08681212387663892,0.09349413520881501],"num_samples":17506,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.0713054478044018,"conf_interval":[0.06766273558011707,0.07516956205769516],"num_samples":13895,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.1118266733778412,"conf_interval":[0.10201037104446194,0.12328819914047184],"num_samples":3254,"feature_name":"+-2_in_prereach_sutehais>=3","negative":{"average_prob":0.11052584189770823,"conf_interval":[0.10122813957874274,0.12042003731224268],"num_samples":3231,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.25,"conf_interval":[0.13333333333333333,0.43333333333333335],"num_samples":28,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.19753086419753085,"conf_interval":[0.14634146341463414,0.2621951219512195],"num_samples":162,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.06896413645827343,"conf_interval":[0.0649229158925298,0.07347586785103234],"num_samples":11843,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.0665644301092036,"conf_interval":[0.06367060183663989,0.06971146817557637],"num_samples":16534,"feature_name":"chances<=3","negative":{"average_prob":0.09649636221570713,"conf_interval":[0.08961559547818393,0.10359261153891423],"num_samples":5188,"feature_name":"weak_suji","negative":{"average_prob":0.11336590198015373,"conf_interval":[0.10463344250110662,0.12209586146057583],"num_samples":4129,"feature_name":"2_inner_prereach_sutehai","negative":{"average_prob":0.12443503156876065,"conf_interval":[0.11466071277858247,0.1347324668087282],"num_samples":3452,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.06585875488485932,"conf_interval":[0.053086059742034085,0.0809341409281265],"num_samples":1245,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.06293043684824629,"conf_interval":[0.05536332108152828,0.06991655193276283],"num_samples":3760,"feature_name":"in_tehais>=4","negative":{"average_prob":0.06219617298761923,"conf_interval":[0.05560614551081934,0.06981221033661965],"num_samples":3757,"feature_name":"suji_in_tehais>=3","negative":{"average_prob":0.061667100741001304,"conf_interval":[0.05476864780151818,0.06899067705836602],"num_samples":3731,"feature_name":"in_tehais>=3","negative":{"average_prob":0.06054602476989849,"conf_interval":[0.053828555162680564,0.06735107283325668],"num_samples":3649,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.11029411764705882,"conf_interval":[0.08035714285714286,0.14853896103896103],"num_samples":306,"feature_name":"same_type_in_prereach>=4","negative":{"average_prob":0.13392857142857142,"conf_interval":[0.09448818897637795,0.18110236220472442],"num_samples":252,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.0,"conf_interval":[0.0,0.05357142857142857],"num_samples":54,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.1310344827586207,"conf_interval":[0.08163265306122448,0.19727891156462585],"num_samples":145,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.2777777777777778,"conf_interval":[0.1,0.5],"num_samples":18,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.05737347614681787,"conf_interval":[0.05409448351544743,0.06084441757963882],"num_samples":14338,"feature_name":"suji_in_tehais>=3","negative":{"average_prob":0.05721843195299052,"conf_interval":[0.053871014360656944,0.06082173943445034],"num_samples":14285,"feature_name":"+-2_in_prereach_sutehais>=3","negative":{"average_prob":0.055207938554543666,"conf_interval":[0.05199681449388742,0.05901820799340854],"num_samples":13903,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.09289940828402367,"conf_interval":[0.07454323995127893,0.11595615103532278],"num_samples":819,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.10526315789473684,"conf_interval":[0.07713498622589532,0.14325068870523416],"num_samples":361,"feature_name":"dora_suji","negative":{"average_prob":0.09455587392550144,"conf_interval":[0.06552706552706553,0.13105413105413105],"num_samples":349,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.4166666666666667,"conf_interval":[0.14285714285714285,0.7142857142857143],"num_samples":12,"feature_name":null,"negative":null,"positive":null}}}}},"positive":{"average_prob":0.04499342355219704,"conf_interval":[0.041131393939851386,0.04904761847919076],"num_samples":7487,"feature_name":"matagisuji","negative":{"average_prob":0.15794625913404195,"conf_interval":[0.13051555171577092,0.1920055100179324],"num_samples":481,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.04412427210650013,"conf_interval":[0.04025338808869159,0.04836795020949821],"num_samples":7479,"feature_name":"4<=n<=6","negative":{"average_prob":0.040159419898008676,"conf_interval":[0.03634756297833933,0.04420072231166206],"num_samples":7370,"feature_name":"dora","negative":{"average_prob":0.03897034059379465,"conf_interval":[0.03551036565661122,0.04330913592435245],"num_samples":7231,"feature_name":"dora_matagi","negative":{"average_prob":0.0377556076445668,"conf_interval":[0.03409423753609602,0.04206404241046513],"num_samples":7100,"feature_name":"early_urasuji","negative":{"average_prob":0.0336879691050831,"conf_interval":[0.03006456542072155,0.038047550536009035],"num_samples":6503,"feature_name":"3<=n<=7","negative":{"average_prob":0.027187433015851737,"conf_interval":[0.02309101051040992,0.03145917938198706],"num_samples":5426,"feature_name":"+-2_in_prereach_sutehais>=3","negative":{"average_prob":0.026675747923663434,"conf_interval":[0.022964423158903607,0.031201949508580365],"num_samples":5397,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.11627906976744186,"conf_interval":[0.044444444444444446,0.24444444444444444],"num_samples":43,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.052294960356817376,"conf_interval":[0.04423284518115134,0.061860221172360674],"num_samples":2007,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.06475392282833002,"conf_interval":[0.05195626822157434,0.0790505344995141],"num_samples":1223,"feature_name":"same_type_in_prereach>=6","negative":{"average_prob":0.0639250527797326,"conf_interval":[0.051050936768149875,0.0780747462919594],"num_samples":1218,"feature_name":"+-2_in_prereach_sutehais>=2","negative":{"average_prob":0.11993506493506495,"conf_interval":[0.09218346253229975,0.15583548664944014],"num_samples":385,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.03931487397941072,"conf_interval":[0.028692879914984058,0.053489195890896214],"num_samples":939,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.3333333333333333,"conf_interval":[0.125,0.75],"num_samples":6,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.07990506329113924,"conf_interval":[0.054245283018867926,0.11320754716981132],"num_samples":316,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.0893371757925072,"conf_interval":[0.06303724928366762,0.12320916905444126],"num_samples":347,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.1104661615927519,"conf_interval":[0.09646642448728594,0.12794203421449862],"num_samples":1125,"feature_name":"same_type_in_prereach>=2","negative":{"average_prob":0.19689018621130874,"conf_interval":[0.15300874228238662,0.25305623131625604],"num_samples":164,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.09637709140418119,"conf_interval":[0.08304754519996539,0.11432696994617689],"num_samples":969,"feature_name":null,"negative":null,"positive":null}}}}},"positive":{"average_prob":0.03373017198338657,"conf_interval":[0.03083507152976407,0.03731747122953493],"num_samples":8830,"feature_name":"dora_matagi","negative":{"average_prob":0.029498377324423716,"conf_interval":[0.02631407506646785,0.03277825731009987],"num_samples":8148,"feature_name":"+-2_in_prereach_sutehais>=1","negative":{"average_prob":0.05010539838967525,"conf_interval":[0.04282009859153059,0.05845545781009959],"num_samples":2625,"feature_name":"early_senkisuji","negative":{"average_prob":0.0481420841398482,"conf_interval":[0.040776776359389436,0.05634991060883102],"num_samples":2582,"feature_name":"2<=n<=8","negative":{"average_prob":0.020338773491592483,"conf_interval":[0.013641975308641975,0.0291358024691358],"num_samples":1348,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.06998601086413497,"conf_interval":[0.05880231407288255,0.08200248651594085],"num_samples":1596,"feature_name":"suji_in_tehais>=2","negative":{"average_prob":0.06237165315490772,"conf_interval":[0.05067072234975135,0.07479758884007032],"num_samples":1481,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.1284722222222222,"conf_interval":[0.09664694280078896,0.16617357001972385],"num_samples":336,"feature_name":"dora_suji","negative":{"average_prob":0.11941056910569105,"conf_interval":[0.08787878787878788,0.1595959595959596],"num_samples":328,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.5,"conf_interval":[0.2,0.8],"num_samples":8,"feature_name":null,"negative":null,"positive":null}}}},"positive":{"average_prob":0.1746031746031746,"conf_interval":[0.09230769230769231,0.27692307692307694],"num_samples":63,"feature_name":"in_tehais>=3","negative":{"average_prob":0.15254237288135594,"conf_interval":[0.08196721311475409,0.26229508196721313],"num_samples":59,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.6,"conf_interval":[0.2857142857142857,0.8571428571428571],"num_samples":5,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.023517955726752103,"conf_interval":[0.020409117584426085,0.02694313565784287],"num_samples":6667,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.06398507153224132,"conf_interval":[0.05330314009661836,0.07719806763285023],"num_samples":1378,"feature_name":"matagisuji","negative":{"average_prob":0.08464366699060577,"conf_interval":[0.06818181818181818,0.10548555921690249],"num_samples":735,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.04019230769230769,"conf_interval":[0.027096114519427405,0.057387525562372185],"num_samples":650,"feature_name":null,"negative":null,"positive":null}}}},"positive":{"average_prob":0.04231389757259139,"conf_interval":[0.040328947687596324,0.044395288585558974],"num_samples":18810,"feature_name":"+-1_in_prereach_sutehais>=1","negative":{"average_prob":0.04723124010342176,"conf_interval":[0.04504567531894471,0.04959726276671639],"num_samples":17586,"feature_name":"2<=n<=8","negative":{"average_prob":0.02234930003173784,"conf_interval":[0.019313733444303125,0.025213639121943764],"num_samples":8055,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.05048873115152772,"conf_interval":[0.04783983814481271,0.05318734983567623],"num_samples":16835,"feature_name":"4<=n<=6","negative":{"average_prob":0.057658521062971334,"conf_interval":[0.05414120612660209,0.0611392884698965],"num_samples":13673,"feature_name":"outer_early_sutehai","negative":{"average_prob":0.05868921876389584,"conf_interval":[0.05541729343515227,0.06235252900067027],"num_samples":13273,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.03324470921180732,"conf_interval":[0.024339232078554263,0.04426999272912137],"num_samples":905,"feature_name":null,"negative":null,"positive":null}},"positive":{"average_prob":0.033523618217723254,"conf_interval":[0.030353311866161043,0.03705185958907726],"num_samples":9912,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.023515355047009755,"conf_interval":[0.02105625692658216,0.02607503229360008],"num_samples":11719,"feature_name":"dora","negative":{"average_prob":0.021750662819893584,"conf_interval":[0.019590209205913624,0.02409291449094838],"num_samples":11497,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.06744302949061662,"conf_interval":[0.05080213903743316,0.08597927807486631],"num_samples":746,"feature_name":"outer_prereach_sutehai","negative":{"average_prob":0.025547445255474453,"conf_interval":[0.010869565217391304,0.050724637681159424],"num_samples":274,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.09176377118644068,"conf_interval":[0.06816983122362869,0.12302215189873418],"num_samples":472,"feature_name":null,"negative":null,"positive":null}}}}},"positive":{"average_prob":0.027436769912159303,"conf_interval":[0.025091310265050074,0.029914913884686877],"num_samples":14456,"feature_name":"in_tehais>=3","negative":{"average_prob":0.028815347774298117,"conf_interval":[0.026122941591669214,0.03156962572070274],"num_samples":13998,"feature_name":null,"negative":null,"positive":null},"positive":{"average_prob":0.0018808777429467085,"conf_interval":[0.0006261740763932373,0.005009392611145898],"num_samples":1595,"feature_name":null,"negative":null,"positive":null}}},"positive":{"average_prob":0.02336508484195712,"conf_interval":[0.02135843124124106,0.025510050399443273],"num_samples":15726,"feature_name":null,"negative":null,"positive":null}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"numTurnsDistribution":[0,0,0,0.011111111111111112,0,0.022222222222222223,0.022222222222222223,0.05555555555555555,0.03333333333333333,0.07777777777777778,0.08888888888888889,0.12222222222222222,0.14444444444444443,0.06666666666666667,0.1,0.06666666666666667,0.011111111111111112,0.17777777777777778],"averageHoraPoints":6265.333333333333}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mjai-manue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mjai
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 0.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.1
|
25
30
|
description: Japanese Mahjong AI.
|
26
31
|
email:
|
27
32
|
- gimite+github@gmail.com
|
@@ -37,6 +42,8 @@ files:
|
|
37
42
|
- lib/mjai/manue/hora_points_estimate.rb
|
38
43
|
- lib/mjai/manue/danger_estimator.rb
|
39
44
|
- share/hora_prob.marshal
|
45
|
+
- share/game_stats.json
|
46
|
+
- share/danger_tree.all.json
|
40
47
|
- share/danger.all.tree
|
41
48
|
homepage: https://github.com/gimite/mjai-manue
|
42
49
|
licenses: []
|
@@ -58,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
65
|
version: '0'
|
59
66
|
requirements: []
|
60
67
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.8.
|
68
|
+
rubygems_version: 1.8.23
|
62
69
|
signing_key:
|
63
70
|
specification_version: 3
|
64
71
|
summary: Japanese Mahjong AI.
|