qi 6.1.0 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -4
  3. data/lib/qi/position.rb +40 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cee3167f3c32021191d7cb31829437f5d33c186314d8ebdeb6ce271ca25f9651
4
- data.tar.gz: 2802d9e46a694d78d476251e2a194a2de725fc984e5181ff48a9c6cd9512a0e9
3
+ metadata.gz: 6d85f0a7a03ecc612c24bf29363b843fb88fa0572b8f74bf955eb92039314a54
4
+ data.tar.gz: ee40f146832333bf952ba810d1d95fafeabc8e6dc17905e39310b7c746faeb5f
5
5
  SHA512:
6
- metadata.gz: 34dd51e3c9179833ccebcbee0a99df78144e4a6867b30f2d9b404b166bc6f5fb039ee922b939056e2f07b80588271e94e627765622cc0e65434c1fefd402a120
7
- data.tar.gz: bfbe4d8074dcf3c5a196c257f1126e29dcde90bbd0af4221a67a58cd94e93893cccd065ec058c5d3016c2fa5f39946d074f203532e9c13294459195544821b85
6
+ metadata.gz: 1310f61417a533fb3c6f19350b759f1831d1b9e7afc04ac4946ac36850cd53eea5ed27942af0f9132d93871047f888217f265d6db782e2d153453ec34c4c80fd
7
+ data.tar.gz: a2c2ca62646b82063b132d69a2f5fc15b062500a23daa6c5953154b23c798fdbbe9c4c6d4f3406be8b01b07c9737a0570c4d6fa0c27f69021c41a4fba79abb3d
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # <span lang="zh"><ruby>棋<rt>Qi</rt></ruby></span>.rb
1
+ # Qi.rb
2
2
 
3
3
  [![Build Status](https://travis-ci.org/sashite/qi.rb.svg?branch=master)](https://travis-ci.org/sashite/qi.rb)
4
4
  [![Gem Version](https://badge.fury.io/rb/qi.svg)][gem]
5
5
  [![Inline docs](https://inch-ci.org/github/sashite/qi.rb.svg?branch=master)][inchpages]
6
6
  [![Documentation](https://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
7
7
 
8
- > Instantiate [Portable Chess Notation](https://developer.sashite.com/specs/portable-chess-notation)'s positions and apply [Portable Move Notation](https://developer.sashite.com/specs/portable-move-notation)'s moves.
8
+ > `Qi` () is an abstraction for initializing and updating positions of chess variants (including Chess, Janggi, Markruk, Shogi, Xiangqi).
9
9
 
10
10
  ## Installation
11
11
 
@@ -56,6 +56,7 @@ starting_position.bottomside_in_hand_pieces # => []
56
56
  starting_position.in_hand_pieces # => []
57
57
  starting_position.turn_to_topside? # => false
58
58
 
59
+ # List of moves in Portable Move Notation (https://developer.sashite.com/specs/portable-move-notation) format.
59
60
  moves = [
60
61
  [ 56, 47, 'P' ],
61
62
  [ 3, 11, 'g' ],
@@ -150,11 +151,11 @@ last_position.turn_to_topside? # => true
150
151
 
151
152
  ## License
152
153
 
153
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
154
+ The code is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
154
155
 
155
156
  ## About Sashite
156
157
 
157
- The `qi` gem is maintained by [Sashite](https://sashite.com/).
158
+ This [gem](https://rubygems.org/gems/qi) is maintained by [Sashite](https://sashite.com/).
158
159
 
159
160
  With some [lines of code](https://github.com/sashite/), let's share the beauty of Chinese, Japanese and Western cultures through the game of chess!
160
161
 
@@ -30,7 +30,31 @@ module Qi
30
30
  # @param bottomside_in_hand_pieces [Array] The list of bottom-side's pieces in hand.
31
31
  # @param topside_in_hand_pieces [Array] The list of top-side's pieces in hand.
32
32
  #
33
- # @example The Shogi's starting position
33
+ # @example Chess's starting position
34
+ # Position.new(
35
+ # '♜', '♞', '♝', '♛', '♚', '♝', '♞', '♜',
36
+ # '♟', '♟', '♟', '♟', '♟', '♟', '♟', '♟',
37
+ # nil, nil, nil, nil, nil, nil, nil, nil,
38
+ # nil, nil, nil, nil, nil, nil, nil, nil,
39
+ # nil, nil, nil, nil, nil, nil, nil, nil,
40
+ # nil, nil, nil, nil, nil, nil, nil, nil,
41
+ # '♙', '♙', '♙', '♙', '♙', '♙', '♙', '♙',
42
+ # '♖', '♘', '♗', '♕', '♔', '♗', '♘', '♖'
43
+ # )
44
+ #
45
+ # @example Makruk's starting position
46
+ # Position.new(
47
+ # '♜', '♞', '♝', '♛', '♚', '♝', '♞', '♜',
48
+ # nil, nil, nil, nil, nil, nil, nil, nil,
49
+ # '♟', '♟', '♟', '♟', '♟', '♟', '♟', '♟',
50
+ # nil, nil, nil, nil, nil, nil, nil, nil,
51
+ # nil, nil, nil, nil, nil, nil, nil, nil,
52
+ # '♙', '♙', '♙', '♙', '♙', '♙', '♙', '♙',
53
+ # nil, nil, nil, nil, nil, nil, nil, nil,
54
+ # '♖', '♘', '♗', '♔', '♕', '♗', '♘', '♖'
55
+ # )
56
+ #
57
+ # @example Shogi's starting position
34
58
  # Position.new(
35
59
  # 'l', 'n', 's', 'g', 'k', 'g', 's', 'n', 'l',
36
60
  # nil, 'r', nil, nil, nil, nil, nil, 'b', nil,
@@ -42,6 +66,20 @@ module Qi
42
66
  # nil, 'B', nil, nil, nil, nil, nil, 'R', nil,
43
67
  # 'L', 'N', 'S', 'G', 'K', 'G', 'S', 'N', 'L'
44
68
  # )
69
+ #
70
+ # @example Xiangqi's starting position
71
+ # Position.new(
72
+ # '車', '馬', '象', '士', '將', '士', '象', '馬', '車',
73
+ # nil, nil, nil, nil, nil, nil, nil, nil, nil,
74
+ # nil, '砲', nil, nil, nil, nil, nil, '砲', nil,
75
+ # '卒', nil, '卒', nil, '卒', nil, '卒', nil, '卒',
76
+ # nil, nil, nil, nil, nil, nil, nil, nil, nil,
77
+ # nil, nil, nil, nil, nil, nil, nil, nil, nil,
78
+ # '兵', nil, '兵', nil, '兵', nil, '兵', nil, '兵',
79
+ # nil, '炮', nil, nil, nil, nil, nil, '炮', nil,
80
+ # nil, nil, nil, nil, nil, nil, nil, nil, nil,
81
+ # '俥', '傌', '相', '仕', '帥', '仕', '相', '傌', '俥'
82
+ # )
45
83
  def initialize(*squares, is_turn_to_topside: false, bottomside_in_hand_pieces: [], topside_in_hand_pieces: [])
46
84
  @squares = squares
47
85
  @is_turn_to_topside = is_turn_to_topside
@@ -53,6 +91,7 @@ module Qi
53
91
 
54
92
  # Apply a move in PMN (Portable Move Notation) format.
55
93
  #
94
+ # @param move [Array] The move to play.
56
95
  # @see https://developer.sashite.com/specs/portable-move-notation
57
96
  # @return [Position] The new position.
58
97
  def call(move)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qi
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-26 00:00:00.000000000 Z
11
+ date: 2020-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brutal