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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7548152c98402edb0786f8979e4e598e9040f714
4
- data.tar.gz: a32befbfdc45523cf8dc6de5c5b766ff91ddb661
3
+ metadata.gz: 5a66178276a668be74f9c0f35655e8a882df0e0d
4
+ data.tar.gz: 452ab361b0b202921ca7d8ce14e486bd2f130cd2
5
5
  SHA512:
6
- metadata.gz: 7940bb425ec1ee96e9fc686311396c877386f92f75f91a565d24b7e5f85a75edd9e46671bc1db15e9a457626626c798180ebd18302cacdb014af06f5611f77ee
7
- data.tar.gz: b1efb2cda94491d9f558f0fde0faeb98654ce281b4fed23e1ffa81c29abae77dd6b175dc2d43aef3d48b3857dc728879f7e84330889ef6f00368229b89d34dbf
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
- TODO: Write usage instructions here
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 winning?
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.winning?
62
+ hand.win?
63
63
  }
64
64
  end
65
65
 
@@ -1,3 +1,3 @@
1
1
  module TenpaiWakaruMan
2
- VERSION = "1.0.1"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -4,26 +4,13 @@ require "tenpai_wakaru_man/parser"
4
4
  require "tenpai_wakaru_man/calculator"
5
5
 
6
6
  module TenpaiWakaruMan
7
- class Detector
8
- class << self
9
- def winning?(str)
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?(tiles)
26
- Parser.parse(tiles).ready?
12
+ def ready?(str)
13
+ Parser.parse(str).ready?
27
14
  end
28
15
  end
29
16
  end
data/stackprof.rb CHANGED
@@ -5,5 +5,5 @@ require 'stackprof'
5
5
  require 'tenpai_wakaru_man'
6
6
 
7
7
  StackProf.run(mode: :cpu, out: 'tmp/stackprof-cpu-myapp.dump') do
8
- TenpaiWakaruMan::Detector.winning?("11122233445555m")
8
+ TenpaiWakaruMan::Detector.win?("11122233445555m")
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenpai_wakaru_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - flada-auxv