shogi-ruby 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -1
- data/lib/shogi/game.rb +1 -3
- data/lib/shogi/piece.rb +2 -2
- data/lib/shogi/version.rb +1 -1
- data/shogi-ruby.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df666d38d7091b47266ccb065bb5fa8918acaf2a
|
4
|
+
data.tar.gz: d6bbc4857ef9075ca146d38f04068d7c16bc8479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d8089031138f42cb3292af645e17138c3a77c09ddb4c6338c424d52e72bf298a578d145b2d533c85bdbe40a3e55dd1ff1b4c3ebfe8490c9e008e4b888f3db6
|
7
|
+
data.tar.gz: d9edcb039864648abf3182318f37a9990cdec2a05057fc4f75f6b104686ac7b354f13eecb3de758c919c9b9f66acb3077bb1201e5b12ae199792a13e83e35f80
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Shogi Library for Ruby [![Build Status](https://secure.travis-ci.org/myokoym/shogi-ruby.png?branch=master)](http://travis-ci.org/myokoym/shogi-ruby)
|
2
2
|
|
3
|
-
Ruby用の将棋ライブラリです。
|
3
|
+
Ruby用の将棋ライブラリです。CSA形式に対応しています。
|
4
4
|
|
5
5
|
## 用途
|
6
6
|
### 向いていること
|
@@ -59,6 +59,20 @@ Ruby 2.0.0 or later. (and 1.9.3)
|
|
59
59
|
P+
|
60
60
|
P-
|
61
61
|
|
62
|
+
board.move("+7776FU", :csa)
|
63
|
+
puts board.to_csa
|
64
|
+
#=> P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
|
65
|
+
P2 * -HI * * * * * -KA *
|
66
|
+
P3-FU-FU-FU-FU-FU-FU-FU-FU-FU
|
67
|
+
P4 * * * * * * * * *
|
68
|
+
P5 * * * * * * * * *
|
69
|
+
P6 * * +FU * * * * * *
|
70
|
+
P7+FU+FU * +FU+FU+FU+FU+FU+FU
|
71
|
+
P8 * +KA * * * * * +HI *
|
72
|
+
P9+KY+KE+GI+KI+OU+KI+GI+KE+KY
|
73
|
+
P+
|
74
|
+
P-
|
75
|
+
|
62
76
|
game = Shogi::Game.new
|
63
77
|
puts game.to_csa
|
64
78
|
#=> P1-KY-KE-GI-KI-OU-KI-GI-KE-KY
|
data/lib/shogi/game.rb
CHANGED
@@ -10,7 +10,6 @@ module Shogi
|
|
10
10
|
@board = Shogi::Board.new(@default_format)
|
11
11
|
@turn = turn
|
12
12
|
@kifu = []
|
13
|
-
@states_of_the_game = [] << Marshal.dump(self)
|
14
13
|
end
|
15
14
|
|
16
15
|
def to_csa
|
@@ -23,7 +22,6 @@ module Shogi
|
|
23
22
|
@board.move(movement, format)
|
24
23
|
@kifu << movement
|
25
24
|
@turn = (@turn == "+") ? "-" : "+"
|
26
|
-
@states_of_the_game << Marshal.dump(self)
|
27
25
|
end
|
28
26
|
self
|
29
27
|
end
|
@@ -42,7 +40,7 @@ module Shogi
|
|
42
40
|
end
|
43
41
|
|
44
42
|
def at(num_of_moves)
|
45
|
-
|
43
|
+
Shogi::Game.new.move(@kifu[0, num_of_moves].join("\n") << "\n")
|
46
44
|
end
|
47
45
|
end
|
48
46
|
end
|
data/lib/shogi/piece.rb
CHANGED
@@ -33,7 +33,7 @@ module Shogi
|
|
33
33
|
PROMOTER = NK
|
34
34
|
|
35
35
|
def initialize
|
36
|
-
super(CSA_NAME, USI_NAME, MOVEMENTS)
|
36
|
+
super(CSA_NAME, USI_NAME, MOVEMENTS, PROMOTER)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -48,7 +48,7 @@ module Shogi
|
|
48
48
|
PROMOTER = NG
|
49
49
|
|
50
50
|
def initialize
|
51
|
-
super(CSA_NAME, USI_NAME, MOVEMENTS)
|
51
|
+
super(CSA_NAME, USI_NAME, MOVEMENTS, PROMOTER)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
data/lib/shogi/version.rb
CHANGED
data/shogi-ruby.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Masafumi Yokoyama"]
|
10
10
|
spec.email = ["myokoym@gmail.com"]
|
11
11
|
spec.summary = %q{Shogi Library for Ruby}
|
12
|
-
spec.description = %q{Shogi library for Ruby. It supports CSA
|
12
|
+
spec.description = %q{Shogi library for Ruby. It supports CSA format.}
|
13
13
|
spec.homepage = "https://github.com/myokoym/shogi-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shogi-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description: Shogi library for Ruby. It supports CSA
|
83
|
+
description: Shogi library for Ruby. It supports CSA format.
|
84
84
|
email:
|
85
85
|
- myokoym@gmail.com
|
86
86
|
executables: []
|