tenpai_wakaru_man 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +57 -1
- data/lib/tenpai_wakaru_man/hand.rb +2 -2
- data/lib/tenpai_wakaru_man/version.rb +1 -1
- data/lib/tenpai_wakaru_man.rb +5 -18
- data/stackprof.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a66178276a668be74f9c0f35655e8a882df0e0d
|
4
|
+
data.tar.gz: 452ab361b0b202921ca7d8ce14e486bd2f130cd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30dfa05f6415aaf77639c5bd4ef736f00cab57e74c0f550d723247bacba88db36ce95a9e39a666b64e5bf3acc62bb07e423373000ee4f4a5c5e5fbcaab968faf
|
7
|
+
data.tar.gz: b85020e805a170b7c27a9e3fc4bcca7a75e0c00e8f1e9eef70fbb8ff8ed99d870816f7b626e504d290fe267a6ccb88090a21ded6c858f00c0b3fc558b104c232
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# TenpaiWakaruMan
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/tenpai_wakaru_man.svg)](https://badge.fury.io/rb/tenpai_wakaru_man)
|
2
3
|
[![Build Status](https://travis-ci.org/flada-auxv/tenpai_wakaru_man.svg?branch=master)](https://travis-ci.org/flada-auxv/tenpai_wakaru_man)
|
3
4
|
|
4
5
|
## Installation
|
@@ -19,7 +20,62 @@ Or install it yourself as:
|
|
19
20
|
|
20
21
|
## Usage
|
21
22
|
|
22
|
-
|
23
|
+
```ruby
|
24
|
+
# ready(聴牌) or not
|
25
|
+
TenpaiWakaruMan.ready?('123m123p23sSSSwPPd') # => true
|
26
|
+
|
27
|
+
# win(和了) or not
|
28
|
+
TenpaiWakaruMan.win?('234m234m234m222p55m') # => true
|
29
|
+
|
30
|
+
# You can also like this
|
31
|
+
TenpaiWakaruMan.win?('222333444455m222p') # => true
|
32
|
+
```
|
33
|
+
<table>
|
34
|
+
<tr>
|
35
|
+
<td>🀀</td><td>Ew</td>
|
36
|
+
<td>🀁</td><td>Sw</td>
|
37
|
+
<td>🀂</td><td>Ww</td>
|
38
|
+
<td>🀃</td><td>Nw</td>
|
39
|
+
</tr>
|
40
|
+
<tr>
|
41
|
+
<td>🀄</td><td>Cd</td>
|
42
|
+
<td>🀅</td><td>Fd</td>
|
43
|
+
<td>🀆</td><td>Pd</td>
|
44
|
+
</tr>
|
45
|
+
<tr>
|
46
|
+
<td>🀇</td><td>1m</td>
|
47
|
+
<td>🀈</td><td>2m</td>
|
48
|
+
<td>🀉</td><td>3m</td>
|
49
|
+
<td>🀊</td><td>4m</td>
|
50
|
+
<td>🀋</td><td>5m</td>
|
51
|
+
<td>🀌</td><td>6m</td>
|
52
|
+
<td>🀍</td><td>7m</td>
|
53
|
+
<td>🀎</td><td>8m</td>
|
54
|
+
<td>🀏</td><td>9m</td>
|
55
|
+
</tr>
|
56
|
+
<tr>
|
57
|
+
<td>🀐</td><td>1s</td>
|
58
|
+
<td>🀑</td><td>2s</td>
|
59
|
+
<td>🀒</td><td>3s</td>
|
60
|
+
<td>🀓</td><td>4s</td>
|
61
|
+
<td>🀔</td><td>5s</td>
|
62
|
+
<td>🀕</td><td>6s</td>
|
63
|
+
<td>🀖</td><td>7s</td>
|
64
|
+
<td>🀗</td><td>8s</td>
|
65
|
+
<td>🀘</td><td>9s</td>
|
66
|
+
</tr>
|
67
|
+
<tr>
|
68
|
+
<td>🀙</td><td>1p</td>
|
69
|
+
<td>🀚</td><td>2p</td>
|
70
|
+
<td>🀛</td><td>3p</td>
|
71
|
+
<td>🀜</td><td>4p</td>
|
72
|
+
<td>🀝</td><td>5p</td>
|
73
|
+
<td>🀞</td><td>6p</td>
|
74
|
+
<td>🀟</td><td>7p</td>
|
75
|
+
<td>🀠</td><td>8p</td>
|
76
|
+
<td>🀡</td><td>9p</td>
|
77
|
+
</tr>
|
78
|
+
</table>
|
23
79
|
|
24
80
|
## Development
|
25
81
|
|
@@ -41,7 +41,7 @@ module TenpaiWakaruMan
|
|
41
41
|
end
|
42
42
|
alias :to_s :to_msp_notation
|
43
43
|
|
44
|
-
def
|
44
|
+
def win?
|
45
45
|
!winning_hands.empty?
|
46
46
|
end
|
47
47
|
|
@@ -59,7 +59,7 @@ module TenpaiWakaruMan
|
|
59
59
|
TILES.each_key.any? {|tile|
|
60
60
|
hand = dup
|
61
61
|
hand.tiles << tile
|
62
|
-
hand.
|
62
|
+
hand.win?
|
63
63
|
}
|
64
64
|
end
|
65
65
|
|
data/lib/tenpai_wakaru_man.rb
CHANGED
@@ -4,26 +4,13 @@ require "tenpai_wakaru_man/parser"
|
|
4
4
|
require "tenpai_wakaru_man/calculator"
|
5
5
|
|
6
6
|
module TenpaiWakaruMan
|
7
|
-
class
|
8
|
-
|
9
|
-
|
10
|
-
new.winning?(str)
|
11
|
-
end
|
12
|
-
|
13
|
-
def ready?(str)
|
14
|
-
new.ready?(str)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
end
|
20
|
-
|
21
|
-
def winning?(tiles)
|
22
|
-
Parser.parse(tiles).winning?
|
7
|
+
class << self
|
8
|
+
def win?(str)
|
9
|
+
Parser.parse(str).win?
|
23
10
|
end
|
24
11
|
|
25
|
-
def ready?(
|
26
|
-
Parser.parse(
|
12
|
+
def ready?(str)
|
13
|
+
Parser.parse(str).ready?
|
27
14
|
end
|
28
15
|
end
|
29
16
|
end
|
data/stackprof.rb
CHANGED