From fa076ba748165b42bcad909c0ce0ed057a51cc84 Mon Sep 17 00:00:00 2001 From: Cyril Kato Date: Tue, 25 Apr 2023 23:22:02 +0200 Subject: [PATCH] feat(PiecesInHand): reduction of the length of serialized strings When several occurrences of the same piece is present, it is grouped via a "*" sign and the number of occurrences. --- .rubocop.yml | 2 + Gemfile.lock | 2 +- README.md | 60 +- VERSION.semver | 2 +- brutal/feen/dumper_brutal.yaml | 18 +- brutal/feen/parser_brutal.yaml | 20 +- brutal/feen/test_dumper.rb | 1832 ++++++++--------- brutal/feen/test_parser.rb | 36 +- lib/feen.rb | 40 +- lib/feen/dumper.rb | 39 +- .../dumper/{square.rb => piece_placement.rb} | 16 +- .../dumper/{in_hand.rb => pieces_in_hand.rb} | 17 +- lib/feen/dumper/turn.rb | 18 - lib/feen/parser.rb | 29 +- lib/feen/parser/{shape.rb => board_shape.rb} | 16 +- .../parser/{square.rb => piece_placement.rb} | 20 +- .../parser/{in_hand.rb => pieces_in_hand.rb} | 21 +- lib/feen/parser/turn.rb | 19 - 18 files changed, 1106 insertions(+), 1101 deletions(-) rename lib/feen/dumper/{square.rb => piece_placement.rb} (84%) rename lib/feen/dumper/{in_hand.rb => pieces_in_hand.rb} (57%) delete mode 100644 lib/feen/dumper/turn.rb rename lib/feen/parser/{shape.rb => board_shape.rb} (67%) rename lib/feen/parser/{square.rb => piece_placement.rb} (74%) rename lib/feen/parser/{in_hand.rb => pieces_in_hand.rb} (56%) delete mode 100644 lib/feen/parser/turn.rb diff --git a/.rubocop.yml b/.rubocop.yml index 7809d14..af1633a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,6 +18,8 @@ AllCops: - doc/ + - pkg/ + - test.rb - config/**/* diff --git a/Gemfile.lock b/Gemfile.lock index b6b4f41..e149846 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - feen (4.0.3) + feen (5.0.0.beta0) GEM remote: https://rubygems.org/ diff --git a/README.md b/README.md index 7fe7934..499a71c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# FEEN.rb +# Feen.rb [![Version](https://img.shields.io/github/v/tag/sashite/feen.rb?label=Version&logo=github)](https://github.com/sashite/feen.rb/releases) [![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/sashite/feen.rb/main) @@ -10,7 +10,13 @@ ## Overview -This is an implementation of [FEEN](https://developer.sashite.com/specs/fen-easy-extensible-notation), a generic format that can be used for serializing and deserializing chess positions. +This is an implementation of [FEEN](https://developer.sashite.com/specs/fen-easy-extensible-notation), a generic format that can be used for serializing and deserializing positions. + +A __FEEN__ string consists of a single line of ASCII text containing three data fields, separated by a space. These are: + +1. Piece placement +2. Side to move +3. Pieces in hand The main chess variants may be supported, including [Chess](https://en.wikipedia.org/wiki/Chess), [Janggi](https://en.wikipedia.org/wiki/Janggi), [Makruk](https://en.wikipedia.org/wiki/Makruk), [Shogi](https://en.wikipedia.org/wiki/Shogi), [Xiangqi](https://en.wikipedia.org/wiki/Xiangqi). @@ -23,7 +29,7 @@ More exotic variants may be also supported, like: [Dai dai shogi](https://en.wik Add this line to your application's Gemfile: ```ruby -gem "feen" +gem "feen", ">= 5.0.0.beta0" ``` And then execute: @@ -35,20 +41,32 @@ bundle install Or install it yourself as: ```sh -gem install feen +gem install feen --pre ``` ## Usage +### Serialization + +A position can be serialized by filling in these fields: + +- **Piece placement**: Describes the placement of pieces on the board with a hash that references each piece on the board. The keys could be numbers, or strings of characters representing coordinates. +- **Side to move**: A char that indicates who moves next. In chess, "`w`" would mean that White must move, and "`b`" that Black must move. In Shogi, "`s`" could mean that Sente must move, and "`g`" that Gote must move. In Xiangqi, "`r`" could mean that Red must move, and "`b`" that Black must move. +- **Pieces in hand**: An array of all captured pieces that remain _in hand_, like in Shogi. +- **Board shape**: An array of integers. For instance, it would be `[10, 9]` in Xiangqi. And it would be `[8, 8]` in Chess. + +#### Examples + +##### A classic Tsume Shogi problem + ```ruby require "feen" -# Dump a classic Tsume Shogi problem -FEEN.dump( - in_hand: %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], - shape: [9, 9], - side_id: 0, - square: { +Feen.dump( + side_to_move: "s", + pieces_in_hand: %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], + board_shape: [9, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", @@ -56,11 +74,25 @@ FEEN.dump( 43 => "+B" } ) -# => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s" +# => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 s S,b,g*4,n*4,p*17,r*2,s" +``` + +### Deserialization + +Serialized positions can be converted back to fields. + +#### Examples + +##### A classic Tsume Shogi problem + +```ruby +require "feen" -# Parse a classic Tsume Shogi problem -FEEN.parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s") -# => {:square=>{3=>"s", 4=>"k", 5=>"s", 22=>"+P", 43=>"+B"}, :shape=>[9, 9], :in_hand=>["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], :side_id=>0} +Feen.parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 s S,b,g*4,n*4,p*17,r*2,s") +# {:board_shape=>[9, 9], +# :pieces_in_hand=>["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], +# :piece_placement=>{3=>"s", 4=>"k", 5=>"s", 22=>"+P", 43=>"+B"}, +# :side_to_move=>"s"} ``` ## License diff --git a/VERSION.semver b/VERSION.semver index c4e41f9..2756c9a 100644 --- a/VERSION.semver +++ b/VERSION.semver @@ -1 +1 @@ -4.0.3 +5.0.0.beta0 diff --git a/brutal/feen/dumper_brutal.yaml b/brutal/feen/dumper_brutal.yaml index d1d38ef..ffa3dfe 100644 --- a/brutal/feen/dumper_brutal.yaml +++ b/brutal/feen/dumper_brutal.yaml @@ -16,18 +16,18 @@ header: | end subject: | - FEEN.dump( - in_hand: %{in_hand}, - shape: %{shape}, - side_id: %{side_id}, - square: %{square} + Feen.dump( + side_to_move: %{side_to_move}, + pieces_in_hand: %{pieces_in_hand}, + board_shape: %{board_shape}, + piece_placement: %{piece_placement} ) contexts: - in_hand: + pieces_in_hand: - [] - [S, r, r, b, g, g, s, n, n, p] - shape: + board_shape: - - 8 - 8 @@ -38,12 +38,12 @@ contexts: - - 14 - 14 - side_id: + side_to_move: - 0 - 1 - 2 - 3 - square: + piece_placement: - {} - 3: "yR" diff --git a/brutal/feen/parser_brutal.yaml b/brutal/feen/parser_brutal.yaml index ccf2e0b..a7392b7 100644 --- a/brutal/feen/parser_brutal.yaml +++ b/brutal/feen/parser_brutal.yaml @@ -16,19 +16,19 @@ header: | end subject: | - FEEN.parse("%{string}") + Feen.parse("%{string}") contexts: string: - - 8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 - - - 3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 - - - ♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0 - - - ♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 1 - - - ♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,1,♟,♟,♟/8/4,♟,3/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0 - - - ♜,♞,♝,♛,♚,♝,♞,♜/8/♟,♟,♟,♟,♟,♟,♟,♟/8/8/♙,♙,♙,♙,♙,♙,♙,♙/8/♖,♘,♗,♔,♕,♗,♘,♖ 0 - - - l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L 0 - - - 3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s - - 車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 - + - 8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 + - 3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 + - ♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0 + - ♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 1 + - ♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,1,♟,♟,♟/8/4,♟,3/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0 + - ♜,♞,♝,♛,♚,♝,♞,♜/8/♟,♟,♟,♟,♟,♟,♟,♟/8/8/♙,♙,♙,♙,♙,♙,♙,♙/8/♖,♘,♗,♔,♕,♗,♘,♖ 0 + - l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L 0 + - 3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g*4,n*4,p*17,r*2,s + - 車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 actuals: - "%{subject}.to_h" diff --git a/brutal/feen/test_dumper.rb b/brutal/feen/test_dumper.rb index 56aa25b..b248983 100644 --- a/brutal/feen/test_dumper.rb +++ b/brutal/feen/test_dumper.rb @@ -17,14 +17,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 0, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0" raise end @@ -34,14 +34,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 0, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1" raise end @@ -51,14 +51,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 0, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2" raise end @@ -68,14 +68,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 0, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3" raise end @@ -85,14 +85,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 0, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -102,14 +102,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 0, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -119,14 +119,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 1, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -136,14 +136,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 1, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: {} ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 -" +if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -153,14 +153,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 1, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0" raise end @@ -170,14 +170,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 1, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1" raise end @@ -187,14 +187,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 1, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2" raise end @@ -204,14 +204,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 1, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3" raise end @@ -221,14 +221,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 2, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -238,14 +238,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 2, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -255,14 +255,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 2, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -272,14 +272,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 2, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -289,14 +289,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 2, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0" raise end @@ -306,14 +306,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 2, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1" raise end @@ -323,14 +323,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 3, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2" raise end @@ -340,14 +340,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 3, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3" raise end @@ -357,14 +357,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 3, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -374,14 +374,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 3, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -391,14 +391,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 3, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -408,14 +408,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [8, 8, 8], - side_id: 3, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -425,14 +425,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 0, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 0 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0" + raise +end # Finishing a test @@ -440,14 +442,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 0, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 0 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1" raise end @@ -457,14 +459,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 0, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 0 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2" + raise +end # Finishing a test @@ -472,14 +476,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 0, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 0 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3" raise end @@ -489,14 +493,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 0, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 0 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -504,14 +510,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 0, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -521,14 +527,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 1, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 1 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -536,14 +544,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 1, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 1 -" +if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -553,14 +561,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 1, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 1 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0" + raise +end # Finishing a test @@ -568,14 +578,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 1, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 1 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1" raise end @@ -585,14 +595,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 1, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 1 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2" + raise +end # Finishing a test @@ -600,14 +612,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 1, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 1 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3" raise end @@ -617,14 +629,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 2, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 2 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -632,14 +646,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 2, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 2 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -649,14 +663,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 2, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 2 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -664,14 +680,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 2, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 2 -" +if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -681,14 +697,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 2, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 2 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0" + raise +end # Finishing a test @@ -696,14 +714,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 2, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 2 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1" raise end @@ -713,14 +731,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 3, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 3 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2" + raise +end # Finishing a test @@ -728,14 +748,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 3, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 3 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3" raise end @@ -745,14 +765,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 3, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 3 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -760,14 +782,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 3, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 3 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -777,14 +799,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 3, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 3 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -792,14 +816,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [10, 9], - side_id: 3, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [8, 8, 8], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 3 -" +if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -809,14 +833,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 0, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: {} ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 0 -" +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 0" # Finishing a test @@ -824,16 +848,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 0, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: {} ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 -" - raise -end +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 1" # Finishing a test @@ -841,16 +863,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 0, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: {} ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 0 -" - raise -end +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 2" # Finishing a test @@ -858,16 +878,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 0, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: {} ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 0 -" - raise -end +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 3" # Finishing a test @@ -875,14 +893,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 0, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: {} ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 0 -" +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 0 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -890,16 +908,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 0, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: {} ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 0 -" - raise -end +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 1 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -907,14 +923,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 1, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: {} ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 1 -" +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 2 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -922,16 +938,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 1, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: {} ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 1 -" - raise -end +raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 3 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -939,14 +953,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 1, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 0" raise end @@ -956,14 +970,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 1, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 1" raise end @@ -973,14 +987,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 1, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 2" + raise +end # Finishing a test @@ -988,14 +1004,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 1, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 1 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 3" raise end @@ -1005,14 +1021,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 2, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 0 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -1020,14 +1038,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 2, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -1037,14 +1055,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 2, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -1054,14 +1072,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 2, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 2 -" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -1071,14 +1089,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 2, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 2 -" +raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 0" # Finishing a test @@ -1086,16 +1104,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 2, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 2 -" - raise -end +raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 1" # Finishing a test @@ -1103,14 +1119,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 3, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 3 -" +raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 2" # Finishing a test @@ -1118,16 +1134,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 3, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 3 -" - raise -end +raise if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 3" # Finishing a test @@ -1135,14 +1149,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 3, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -1152,14 +1166,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 3, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -1169,14 +1183,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 3, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -1184,14 +1200,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: [], - shape: [14, 14], - side_id: 3, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 3 -" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -1201,14 +1217,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 0, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 0" raise end @@ -1218,14 +1234,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 0, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 1" raise end @@ -1235,14 +1251,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 0, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 2" raise end @@ -1252,14 +1268,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 0, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 3" raise end @@ -1269,14 +1285,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 0, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -1286,14 +1302,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 0, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -1303,14 +1319,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 1, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -1320,14 +1336,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 1, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -1337,16 +1353,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 1, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 0" # Finishing a test @@ -1354,16 +1368,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 1, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 1" # Finishing a test @@ -1371,16 +1383,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 1, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 2" # Finishing a test @@ -1388,16 +1398,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 1, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 3" # Finishing a test @@ -1405,16 +1413,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 2, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 0 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1422,16 +1428,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 2, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 1 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1439,16 +1443,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 2, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 2 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1456,16 +1458,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 2, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 3 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1473,14 +1473,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 2, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0" raise end @@ -1490,14 +1490,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 2, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 1" raise end @@ -1507,14 +1507,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 3, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 2" raise end @@ -1524,14 +1524,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 3, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ/yB,yN,yR,5/1,yP,yP,yP,yP,yP,yP,yP/yP,7/8/2,bR,bP,4/6,gP,gR/bN,bP,6//4,gP,gN,bB,bP/8/2,gP,gB,bK,bP,2/8/gP,gQ,bQ,bP,4/6,gP,gK/bB,bP,6/4,gP,gB,bN,bP//8/2,gP,gN,bR,bP,2/8/gP,gR,6/8/3,rP,rP,rP,rP,rP/rP,rP,rP,5/1,rR,rN,rB,rQ,rK,rB,rN//rR,7/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 3" raise end @@ -1541,14 +1541,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 3, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -1558,14 +1558,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 3, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "l,n,s,g,k,g,s,n/l,1,r,5/b,1,p,p,p,p,p,p/p,p,p,5/8/8/6,P,P/P,P,P,P,P,P,P,1//B,5,R,1/L,N,S,G,K,G,S,N/L,7/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -1575,14 +1575,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 3, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "3,s,k,s,2/8/6,+P,1/8/8/3,+B,4/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -1592,14 +1592,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [8, 8, 8], - side_id: 3, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [10, 9], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬/車,7/3,砲,4/1,砲,1,卒,1,卒,1,卒/1,卒,1,卒,4/8/6,兵,1/兵,1,兵,1,兵,1,兵,1//炮,5,炮,1/8/1,俥,傌,相,仕,帥,仕,相/傌,俥,6/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -1609,14 +1609,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 0, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: {} ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 0 S,b,g,g,n,n,p,r,r,s" +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 0" # Finishing a test @@ -1624,16 +1624,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 0, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: {} ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 0 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 1" # Finishing a test @@ -1641,16 +1639,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 0, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: {} ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 0 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 2" # Finishing a test @@ -1658,16 +1654,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 0, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: {} ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 0 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 3" # Finishing a test @@ -1675,14 +1669,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 0, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: {} ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 0 S,b,g,g,n,n,p,r,r,s" +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 0 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1690,16 +1684,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 0, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: {} ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 1 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1707,14 +1699,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 1, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: {} ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 1 S,b,g,g,n,n,p,r,r,s" +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 2 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1722,16 +1714,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 1, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: {} ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 3 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -1739,14 +1729,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 1, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0" raise end @@ -1756,14 +1746,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 1, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 1" raise end @@ -1773,14 +1763,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 1, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 2" + raise +end # Finishing a test @@ -1788,14 +1780,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 1, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 3" raise end @@ -1805,14 +1797,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 2, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -1820,14 +1814,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 2, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -1837,14 +1831,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 2, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 2 S,b,g*2,n*2,p,r*2,s" raise end @@ -1854,14 +1848,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 2, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -1871,14 +1865,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 2, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 0" + raise +end # Finishing a test @@ -1886,14 +1882,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 2, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 1" raise end @@ -1903,14 +1899,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 3, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -raise if actual.itself != "9/9/9/9/9/9/9/9/9/9 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 2" + raise +end # Finishing a test @@ -1918,14 +1916,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 3, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB/yN,yR,6,yP/yP,yP,yP,yP,yP,yP,yP,2/9/6,bR,bP,1/9/gP,gR,bN,bP,5/5,gP,gN,bB,bP/9/1,gP,gB,bK,bP,4 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 3" raise end @@ -1935,14 +1933,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 3, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟/♟,♟,♟,♟,♟,♟,♟,2/9/9/9/3,♙,♙,♙,♙,♙,♙/♙,♙,♖,♘,♗,♕,♔,♗,♘/♖,8/9/9 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -1952,14 +1950,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 3, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L/9 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -1969,14 +1967,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 3, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -raise if actual.itself != "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9/9 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -1984,14 +1984,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [10, 9], - side_id: 3, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -2001,14 +2001,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 0, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 0" + raise +end # Finishing a test @@ -2016,14 +2018,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 0, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 1" raise end @@ -2033,14 +2035,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 0, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 2" raise end @@ -2050,14 +2052,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 0, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 3" raise end @@ -2067,14 +2069,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 0, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 0 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -2082,14 +2086,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 0, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 0 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -2099,14 +2103,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 1, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -2114,14 +2120,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 1, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 1 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 3 S,b,g*2,n*2,p,r*2,s" raise end @@ -2131,16 +2137,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 1, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 0" # Finishing a test @@ -2148,16 +2152,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 1, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 1" # Finishing a test @@ -2165,14 +2167,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 1, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 1 S,b,g,g,n,n,p,r,r,s" +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 2" # Finishing a test @@ -2180,16 +2182,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 1, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 1 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 3" # Finishing a test @@ -2197,14 +2197,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 2, - square: {} +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 2 S,b,g,g,n,n,p,r,r,s" +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 0 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -2212,16 +2212,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 2, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 1 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -2229,16 +2227,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 2, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 2 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -2246,16 +2242,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 2, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 2 S,b,g,g,n,n,p,r,r,s" - raise -end +raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 3 S,b,g*2,n*2,p,r*2,s" # Finishing a test @@ -2263,14 +2257,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 2, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 0" + raise +end # Finishing a test @@ -2278,14 +2274,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 2, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 2 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 1" raise end @@ -2295,14 +2291,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 3, - square: {} +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "14/14/14/14/14/14/14/14/14/14/14/14/14/14 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 2" + raise +end # Finishing a test @@ -2310,14 +2308,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 3, - square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 56 => "bN", 70 => "bB", 84 => "bK", 98 => "bQ", 112 => "bB", 126 => "bN", 140 => "bR", 43 => "bP", 57 => "bP", 71 => "bP", 85 => "bP", 99 => "bP", 113 => "bP", 127 => "bP", 141 => "bP", 55 => "gR", 69 => "gN", 83 => "gB", 97 => "gQ", 111 => "gK", 125 => "gB", 139 => "gN", 153 => "gR", 54 => "gP", 68 => "gP", 82 => "gP", 96 => "gP", 110 => "gP", 124 => "gP", 138 => "gP", 152 => "gP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: [], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 3" raise end @@ -2327,14 +2325,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 3, - square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } +actual = Feen.dump( + side_to_move: 0, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "♜,♞,♝,♛,♚,♝,♞,♜,♟,♟,♟,♟,♟,♟/♟,♟,12/14/6,♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖,6/14/14/14/14/14/14/14/14/14 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 0 S,b,g*2,n*2,p,r*2,s" raise end @@ -2344,14 +2342,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 3, - square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } +actual = Feen.dump( + side_to_move: 1, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "l,n,s,g,k,g,s,n,l,1,r,3/2,b,1,p,p,p,p,p,p,p,p,p,1/14/12,P,P/P,P,P,P,P,P,P,1,B,5/R,1,L,N,S,G,K,G,S,N,L,3/14/14/14/14/14/14/14/14 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 1 S,b,g*2,n*2,p,r*2,s" raise end @@ -2361,14 +2359,16 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 3, - square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } +actual = Feen.dump( + side_to_move: 2, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -raise if actual.itself != "3,s,k,s,8/8,+P,5/14/1,+B,12/14/14/14/14/14/14/14/14/14/14 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 2 S,b,g*2,n*2,p,r*2,s" + raise +end # Finishing a test @@ -2376,14 +2376,14 @@ # Starting a test -actual = FEEN.dump( - in_hand: %w[S r r b g g s n n p], - shape: [14, 14], - side_id: 3, - square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } +actual = Feen.dump( + side_to_move: 3, + pieces_in_hand: %w[S r r b g g s n n p], + board_shape: [14, 14], + piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } ) -if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 3 S,b,g,g,n,n,p,r,r,s" +if actual.itself != "車,馬,象,士,將,士,象,馬,車,5/5,砲,5,砲,1,卒/1,卒,1,卒,1,卒,1,卒,6/12,兵,1/兵,1,兵,1,兵,1,兵,1,炮,5/炮,10,俥,傌,相/仕,帥,仕,相,傌,俥,8/14/14/14/14/14/14/14 3 S,b,g*2,n*2,p,r*2,s" raise end diff --git a/brutal/feen/test_parser.rb b/brutal/feen/test_parser.rb index 6c5f2c2..9251a69 100644 --- a/brutal/feen/test_parser.rb +++ b/brutal/feen/test_parser.rb @@ -17,9 +17,9 @@ # Starting a test -actual = FEEN.parse("8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0 -") +actual = Feen.parse("8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8//8/8/8/8/8/8/8/8 0") -raise if actual.to_h != { in_hand: [], shape: [3, 8, 8], side_id: 0, square: {} } +raise if actual.to_h != { board_shape: [3, 8, 8], pieces_in_hand: nil, piece_placement: {}, side_to_move: "0" } # Finishing a test @@ -27,9 +27,9 @@ # Starting a test -actual = FEEN.parse("3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0 -") +actual = Feen.parse("3,yR,yN,yB,yK,yQ,yB,yN,yR,3/3,yP,yP,yP,yP,yP,yP,yP,yP,3/14/bR,bP,10,gP,gR/bN,bP,10,gP,gN/bB,bP,10,gP,gB/bK,bP,10,gP,gQ/bQ,bP,10,gP,gK/bB,bP,10,gP,gB/bN,bP,10,gP,gN/bR,bP,10,gP,gR/14/3,rP,rP,rP,rP,rP,rP,rP,rP,3/3,rR,rN,rB,rQ,rK,rB,rN,rR,3 0") -if actual.to_h != { in_hand: [], shape: [14, 14], side_id: 0, square: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 43 => "bP", 54 => "gP", 55 => "gR", 56 => "bN", 57 => "bP", 68 => "gP", 69 => "gN", 70 => "bB", 71 => "bP", 82 => "gP", 83 => "gB", 84 => "bK", 85 => "bP", 96 => "gP", 97 => "gQ", 98 => "bQ", 99 => "bP", 110 => "gP", 111 => "gK", 112 => "bB", 113 => "bP", 124 => "gP", 125 => "gB", 126 => "bN", 127 => "bP", 138 => "gP", 139 => "gN", 140 => "bR", 141 => "bP", 152 => "gP", 153 => "gR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR" } } +if actual.to_h != { board_shape: [14, 14], pieces_in_hand: nil, piece_placement: { 3 => "yR", 4 => "yN", 5 => "yB", 6 => "yK", 7 => "yQ", 8 => "yB", 9 => "yN", 10 => "yR", 17 => "yP", 18 => "yP", 19 => "yP", 20 => "yP", 21 => "yP", 22 => "yP", 23 => "yP", 24 => "yP", 42 => "bR", 43 => "bP", 54 => "gP", 55 => "gR", 56 => "bN", 57 => "bP", 68 => "gP", 69 => "gN", 70 => "bB", 71 => "bP", 82 => "gP", 83 => "gB", 84 => "bK", 85 => "bP", 96 => "gP", 97 => "gQ", 98 => "bQ", 99 => "bP", 110 => "gP", 111 => "gK", 112 => "bB", 113 => "bP", 124 => "gP", 125 => "gB", 126 => "bN", 127 => "bP", 138 => "gP", 139 => "gN", 140 => "bR", 141 => "bP", 152 => "gP", 153 => "gR", 171 => "rP", 172 => "rP", 173 => "rP", 174 => "rP", 175 => "rP", 176 => "rP", 177 => "rP", 178 => "rP", 185 => "rR", 186 => "rN", 187 => "rB", 188 => "rQ", 189 => "rK", 190 => "rB", 191 => "rN", 192 => "rR" }, side_to_move: "0" } raise end @@ -39,9 +39,9 @@ # Starting a test -actual = FEEN.parse("♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0 -") +actual = Feen.parse("♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/8/8/♙,♙,♙,♙,♙,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0") -if actual.to_h != { in_hand: [], shape: [8, 8], side_id: 0, square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } } +if actual.to_h != { board_shape: [8, 8], pieces_in_hand: nil, piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 52 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" }, side_to_move: "0" } raise end @@ -51,9 +51,9 @@ # Starting a test -actual = FEEN.parse("♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 1 -") +actual = Feen.parse("♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,♟,♟,♟,♟/8/8/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 1") -if actual.to_h != { in_hand: [], shape: [8, 8], side_id: 1, square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 36 => "♙", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } } +if actual.to_h != { board_shape: [8, 8], pieces_in_hand: nil, piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 12 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 36 => "♙", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" }, side_to_move: "1" } raise end @@ -63,9 +63,9 @@ # Starting a test -actual = FEEN.parse("♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,1,♟,♟,♟/8/4,♟,3/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0 -") +actual = Feen.parse("♜,♞,♝,♛,♚,♝,♞,♜/♟,♟,♟,♟,1,♟,♟,♟/8/4,♟,3/4,♙,3/8/♙,♙,♙,♙,1,♙,♙,♙/♖,♘,♗,♕,♔,♗,♘,♖ 0") -if actual.to_h != { in_hand: [], shape: [8, 8], side_id: 0, square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 28 => "♟", 36 => "♙", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" } } +if actual.to_h != { board_shape: [8, 8], pieces_in_hand: nil, piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 8 => "♟", 9 => "♟", 10 => "♟", 11 => "♟", 13 => "♟", 14 => "♟", 15 => "♟", 28 => "♟", 36 => "♙", 48 => "♙", 49 => "♙", 50 => "♙", 51 => "♙", 53 => "♙", 54 => "♙", 55 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♕", 60 => "♔", 61 => "♗", 62 => "♘", 63 => "♖" }, side_to_move: "0" } raise end @@ -75,9 +75,9 @@ # Starting a test -actual = FEEN.parse("♜,♞,♝,♛,♚,♝,♞,♜/8/♟,♟,♟,♟,♟,♟,♟,♟/8/8/♙,♙,♙,♙,♙,♙,♙,♙/8/♖,♘,♗,♔,♕,♗,♘,♖ 0 -") +actual = Feen.parse("♜,♞,♝,♛,♚,♝,♞,♜/8/♟,♟,♟,♟,♟,♟,♟,♟/8/8/♙,♙,♙,♙,♙,♙,♙,♙/8/♖,♘,♗,♔,♕,♗,♘,♖ 0") -if actual.to_h != { in_hand: [], shape: [8, 8], side_id: 0, square: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 16 => "♟", 17 => "♟", 18 => "♟", 19 => "♟", 20 => "♟", 21 => "♟", 22 => "♟", 23 => "♟", 40 => "♙", 41 => "♙", 42 => "♙", 43 => "♙", 44 => "♙", 45 => "♙", 46 => "♙", 47 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♔", 60 => "♕", 61 => "♗", 62 => "♘", 63 => "♖" } } +if actual.to_h != { board_shape: [8, 8], pieces_in_hand: nil, piece_placement: { 0 => "♜", 1 => "♞", 2 => "♝", 3 => "♛", 4 => "♚", 5 => "♝", 6 => "♞", 7 => "♜", 16 => "♟", 17 => "♟", 18 => "♟", 19 => "♟", 20 => "♟", 21 => "♟", 22 => "♟", 23 => "♟", 40 => "♙", 41 => "♙", 42 => "♙", 43 => "♙", 44 => "♙", 45 => "♙", 46 => "♙", 47 => "♙", 56 => "♖", 57 => "♘", 58 => "♗", 59 => "♔", 60 => "♕", 61 => "♗", 62 => "♘", 63 => "♖" }, side_to_move: "0" } raise end @@ -87,9 +87,9 @@ # Starting a test -actual = FEEN.parse("l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L 0 -") +actual = Feen.parse("l,n,s,g,k,g,s,n,l/1,r,5,b,1/p,p,p,p,p,p,p,p,p/9/9/9/P,P,P,P,P,P,P,P,P/1,B,5,R,1/L,N,S,G,K,G,S,N,L 0") -if actual.to_h != { in_hand: [], shape: [9, 9], side_id: 0, square: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" } } +if actual.to_h != { board_shape: [9, 9], pieces_in_hand: nil, piece_placement: { 0 => "l", 1 => "n", 2 => "s", 3 => "g", 4 => "k", 5 => "g", 6 => "s", 7 => "n", 8 => "l", 10 => "r", 16 => "b", 18 => "p", 19 => "p", 20 => "p", 21 => "p", 22 => "p", 23 => "p", 24 => "p", 25 => "p", 26 => "p", 54 => "P", 55 => "P", 56 => "P", 57 => "P", 58 => "P", 59 => "P", 60 => "P", 61 => "P", 62 => "P", 64 => "B", 70 => "R", 72 => "L", 73 => "N", 74 => "S", 75 => "G", 76 => "K", 77 => "G", 78 => "S", 79 => "N", 80 => "L" }, side_to_move: "0" } raise end @@ -99,9 +99,9 @@ # Starting a test -actual = FEEN.parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s") +actual = Feen.parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g*4,n*4,p*17,r*2,s") -if actual.to_h != { in_hand: %w[S b g g g g n n n n p p p p p p p p p p p p p p p p p r r s], shape: [9, 9], side_id: 0, square: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" } } +if actual.to_h != { board_shape: [9, 9], pieces_in_hand: %w[S b g g g g n n n n p p p p p p p p p p p p p p p p p r r s], piece_placement: { 3 => "s", 4 => "k", 5 => "s", 22 => "+P", 43 => "+B" }, side_to_move: "0" } raise end @@ -111,9 +111,9 @@ # Starting a test -actual = FEEN.parse("車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0 -") +actual = Feen.parse("車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥 0") -if actual.to_h != { in_hand: [], shape: [10, 9], side_id: 0, square: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" } } +if actual.to_h != { board_shape: [10, 9], pieces_in_hand: nil, piece_placement: { 0 => "車", 1 => "馬", 2 => "象", 3 => "士", 4 => "將", 5 => "士", 6 => "象", 7 => "馬", 8 => "車", 19 => "砲", 25 => "砲", 27 => "卒", 29 => "卒", 31 => "卒", 33 => "卒", 35 => "卒", 54 => "兵", 56 => "兵", 58 => "兵", 60 => "兵", 62 => "兵", 64 => "炮", 70 => "炮", 81 => "俥", 82 => "傌", 83 => "相", 84 => "仕", 85 => "帥", 86 => "仕", 87 => "相", 88 => "傌", 89 => "俥" }, side_to_move: "0" } raise end diff --git a/lib/feen.rb b/lib/feen.rb index d99e22b..fa92e48 100644 --- a/lib/feen.rb +++ b/lib/feen.rb @@ -7,20 +7,20 @@ # deserialization in FEEN format. # # @see https://developer.sashite.com/specs/fen-easy-extensible-notation -module FEEN +module Feen # Dumps position params into a FEEN string. # - # @param in_hand [Array] The list of pieces in hand. - # @param shape [Array] The shape of the board. - # @param side_id [Integer] The identifier of the player who must play. - # @param square [Hash] The index of each piece on the board. + # @param pieces_in_hand [Array, nil] The list of pieces in hand. + # @param board_shape [Array] The shape of the board. + # @param side_to_move [String] The identifier of the player who must play. + # @param piece_placement [Hash] The index of each piece on the board. # # @example Dump a classic Tsume Shogi problem # dump( - # "in_hand": %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], - # "shape": [9, 9], - # "side_id": 0, - # "square": { + # "side_to_move": "s", + # "pieces_in_hand": %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], + # "board_shape": [9, 9], + # "piece_placement": { # 3 => "s", # 4 => "k", # 5 => "s", @@ -28,15 +28,15 @@ module FEEN # 43 => "+B" # } # ) - # # => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s" + # # => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 s S,b,g*4,n*4,p*17,r*2,s" # # @return [String] The FEEN string representing the position. - def self.dump(in_hand:, shape:, side_id:, square:) + def self.dump(board_shape:, side_to_move:, piece_placement:, pieces_in_hand: nil) Dumper.call( - in_hand:, - shape:, - side_id:, - square: + pieces_in_hand:, + board_shape:, + side_to_move:, + piece_placement: ) end @@ -45,12 +45,12 @@ def self.dump(in_hand:, shape:, side_id:, square:) # @param feen [String] The FEEN string representing a position. # # @example Parse a classic Tsume Shogi problem - # parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s") + # parse("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 s S,b,g*4,n*4,p*17,r*2,s") # # => { - # # "in_hand": ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], - # # "shape": [9, 9], - # # "side_id": 0, - # # "square": { + # # "pieces_in_hand": ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], + # # "board_shape": [9, 9], + # # "side_to_move": "s", + # # "piece_placement": { # # 3 => "s", # # 4 => "k", # # 5 => "s", diff --git a/lib/feen/dumper.rb b/lib/feen/dumper.rb index 8935b6c..144d37a 100644 --- a/lib/feen/dumper.rb +++ b/lib/feen/dumper.rb @@ -1,25 +1,24 @@ # frozen_string_literal: true -require_relative File.join("dumper", "in_hand") -require_relative File.join("dumper", "square") -require_relative File.join("dumper", "turn") +require_relative File.join("dumper", "piece_placement") +require_relative File.join("dumper", "pieces_in_hand") -module FEEN +module Feen # The dumper module. module Dumper # Dump position params into a FEEN string. # - # @param in_hand [Array] The list of pieces in hand. - # @param shape [Array] The shape of the board. - # @param side_id [Integer] The identifier of the player who must play. - # @param square [Hash] The index of each piece on the board. + # @param side_to_move [String] Identify the active side. + # @param pieces_in_hand [Array, nil] The list of pieces in hand. + # @param board_shape [Array] The shape of the board. + # @param piece_placement [Hash] The index of each piece on the board. # # @example Dump a classic Tsume Shogi problem # call( - # "in_hand": %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], - # "shape": [9, 9], - # "side_id": 0, - # "square": { + # "side_to_move": "s", + # "pieces_in_hand": %w[S r r b g g g g s n n n n p p p p p p p p p p p p p p p p p], + # "board_shape": [9, 9], + # "piece_placement": { # 3 => "s", # 4 => "k", # 5 => "s", @@ -27,15 +26,17 @@ module Dumper # 43 => "+B" # } # ) - # # => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s" + # # => "3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 s S,b,g*4,n*4,p*17,r*2,s" # # @return [String] The FEEN string representing the position. - def self.call(in_hand:, shape:, side_id:, square:) - [ - Square.new(shape, square).to_s, - Turn.dump(side_id), - InHand.dump(in_hand) - ].join(" ") + def self.call(board_shape:, side_to_move:, piece_placement:, pieces_in_hand: nil) + array = [ + PiecePlacement.new(board_shape, piece_placement).to_s, + side_to_move + ] + + array << PiecesInHand.dump(pieces_in_hand) if Array(pieces_in_hand).any? + array.join(" ") end end end diff --git a/lib/feen/dumper/square.rb b/lib/feen/dumper/piece_placement.rb similarity index 84% rename from lib/feen/dumper/square.rb rename to lib/feen/dumper/piece_placement.rb index 413d7ef..622e5a2 100644 --- a/lib/feen/dumper/square.rb +++ b/lib/feen/dumper/piece_placement.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true -module FEEN +module Feen module Dumper - # The square class. + # The PiecePlacement class. # # @example Dump an empty board of Xiangqi - # Board.new([10, 9]).to_s # => "9/9/9/9/9/9/9/9/9/9" + # PiecePlacement.new([10, 9]).to_s # => "9/9/9/9/9/9/9/9/9/9" # # @example Dump the Xiangqi starting position board - # Board.new( + # PiecePlacement.new( # [10, 9], # { # 0 => "車", @@ -45,12 +45,12 @@ module Dumper # 89 => "俥" # } # ).to_s # => "車,馬,象,士,將,士,象,馬,車/9/1,砲,5,砲,1/卒,1,卒,1,卒,1,卒,1,卒/9/9/兵,1,兵,1,兵,1,兵,1,兵/1,炮,5,炮,1/9/俥,傌,相,仕,帥,仕,相,傌,俥" - class Square + class PiecePlacement # @param indexes [Array] The shape of the board. - # @param board [Hash] The index of each piece on the board. - def initialize(indexes, board) + # @param piece_placement [Hash] The index of each piece on the board. + def initialize(indexes, piece_placement = {}) @indexes = indexes - @squares = Array.new(length) { |i| board.fetch(i, nil) } + @squares = ::Array.new(length) { |i| piece_placement.fetch(i, nil) } end # @return [String] The string representing the board. diff --git a/lib/feen/dumper/in_hand.rb b/lib/feen/dumper/pieces_in_hand.rb similarity index 57% rename from lib/feen/dumper/in_hand.rb rename to lib/feen/dumper/pieces_in_hand.rb index 9b91c50..d8e3229 100644 --- a/lib/feen/dumper/in_hand.rb +++ b/lib/feen/dumper/pieces_in_hand.rb @@ -1,26 +1,27 @@ # frozen_string_literal: true -module FEEN +module Feen module Dumper - # The pieces in hand module. - module InHand + # A module that serializes pieces in hand lists into a string. + module PiecesInHand # Serialize pieces in hand lists into a string. # # @param piece_names [Array] A list of pieces in hand. # # @example Dump a list of pieces in hand # dump(["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"]) - # # => "S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s" + # # => "S,b,g*4,n*4,p*17,r*2,s" # # @example Dump an empty list of pieces in hand # dump([]) - # # => "-" + # # => nil # - # @return [String] A string representing the pieces in hand. + # @return [String, nil] A serialized list of pieces in hand. def self.dump(piece_names) - return "-" if piece_names.empty? + return if piece_names.empty? - piece_names.sort.join(",") + hash = piece_names.group_by(&:itself).transform_values(&:count) + hash.map { |k, v| v > 1 ? "#{k}*#{v}" : k }.sort.join(",") end end end diff --git a/lib/feen/dumper/turn.rb b/lib/feen/dumper/turn.rb deleted file mode 100644 index 62d3b69..0000000 --- a/lib/feen/dumper/turn.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module FEEN - module Dumper - # The turn module. - module Turn - # @param side_id [Integer] The identifier of the active player. - # - # @example Dump the number that identify the player who have to play - # dump(0) # => "0" - # - # @return [String] The number that identify the player who have to play. - def self.dump(side_id) - String(side_id) - end - end - end -end diff --git a/lib/feen/parser.rb b/lib/feen/parser.rb index a30be10..bb3ee19 100644 --- a/lib/feen/parser.rb +++ b/lib/feen/parser.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true -require_relative File.join("parser", "in_hand") -require_relative File.join("parser", "shape") -require_relative File.join("parser", "square") -require_relative File.join("parser", "turn") +require_relative File.join("parser", "board_shape") +require_relative File.join("parser", "pieces_in_hand") +require_relative File.join("parser", "piece_placement") -module FEEN +module Feen # The parser module. module Parser # Parse a FEEN string into position params. @@ -13,12 +12,12 @@ module Parser # @param feen [String] The FEEN string representing a position. # # @example Parse a classic Tsume Shogi problem - # call("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 0 S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s") + # call("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9 s S,b,g*4,n*4,p*17,r*2,s") # # => { - # # "in_hand": ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], - # # "shape": [9, 9], - # # "side_id": 0, - # # "square": { + # # "side_to_move": "s", + # # "pieces_in_hand": ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"], + # # "board_shape": [9, 9], + # # "piece_placement": { # # 3 => "s", # # 4 => "k", # # 5 => "s", @@ -28,13 +27,13 @@ module Parser # # @return [Hash] The position params representing the position. def self.call(feen) - square_str, side_id_str, in_hand_str = feen.split + piece_placement, side_to_move, pieces_in_hand = feen.split { - in_hand: InHand.parse(in_hand_str), - shape: Shape.new(square_str).to_a, - side_id: Turn.parse(side_id_str), - square: Square.new(square_str).to_h + board_shape: BoardShape.new(piece_placement).to_a, + pieces_in_hand: PiecesInHand.parse(pieces_in_hand), + piece_placement: PiecePlacement.new(piece_placement).to_h, + side_to_move: } end end diff --git a/lib/feen/parser/shape.rb b/lib/feen/parser/board_shape.rb similarity index 67% rename from lib/feen/parser/shape.rb rename to lib/feen/parser/board_shape.rb index 5c195ec..6f80ef9 100644 --- a/lib/feen/parser/shape.rb +++ b/lib/feen/parser/board_shape.rb @@ -1,20 +1,20 @@ # frozen_string_literal: true -module FEEN +module Feen module Parser - # The shape class. + # The BoardShape class. # # @example Parse the shape of a shogiban - # Shape.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_a # => [9, 9] - class Shape - # @param board [String] The flatten board. - def initialize(board) - @board = board + # BoardShape.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_a # => [9, 9] + class BoardShape + # @param board_str [String] The flatten board. + def initialize(board_str) + @board_str = board_str end # @return [Array] The size of each dimension of the board. def to_a - indexes(@board, @board.scan(%r{/+}).sort.fetch(-1)) + indexes(@board_str, @board_str.scan(%r{/+}).sort.fetch(-1)) end private diff --git a/lib/feen/parser/square.rb b/lib/feen/parser/piece_placement.rb similarity index 74% rename from lib/feen/parser/square.rb rename to lib/feen/parser/piece_placement.rb index dfd9932..d906d9a 100644 --- a/lib/feen/parser/square.rb +++ b/lib/feen/parser/piece_placement.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -module FEEN +module Feen module Parser - # The square class. + # The PiecePlacement class. # # @example Parse a Shogi problem board and return an array - # Board.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_a + # PiecePlacement.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_a # # => [ # # nil, nil, nil, "s", "k", "s", nil, nil, nil, # # nil, nil, nil, nil, nil, nil, nil, nil, nil, @@ -19,7 +19,7 @@ module Parser # # ] # # @example Parse a Shogi problem board and return a hash - # Board.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_h + # PiecePlacement.new("3,s,k,s,3/9/4,+P,4/9/7,+B,1/9/9/9/9").to_h # # => { # # 3 => "s", # # 4 => "k", @@ -27,15 +27,15 @@ module Parser # # 22 => "+P", # # 43 => "+B" # # } - class Square - # @param board [String] The flatten board. - def initialize(board) - @board = board + class PiecePlacement + # @param piece_placement_str [String] The placement of pieces on the board. + def initialize(piece_placement_str) + @piece_placement_str = piece_placement_str end - # @return [Array] The list of squares on the board. + # @return [Array] The list of pieces on the board. def to_a - @board + @piece_placement_str .split(%r{[/,]+}) .flat_map { |str| row(str) } end diff --git a/lib/feen/parser/in_hand.rb b/lib/feen/parser/pieces_in_hand.rb similarity index 56% rename from lib/feen/parser/in_hand.rb rename to lib/feen/parser/pieces_in_hand.rb index d156a88..6f672f0 100644 --- a/lib/feen/parser/in_hand.rb +++ b/lib/feen/parser/pieces_in_hand.rb @@ -1,15 +1,15 @@ # frozen_string_literal: true -module FEEN +module Feen module Parser # The pieces in hand module. - module InHand + module PiecesInHand # The list of pieces in hand grouped by players. # - # @param piece_names_str [String] The serialized list of pieces in hand. + # @param pieces_in_hand [String, nil] The serialized list of pieces in hand. # # @example Parse a list of serialized pieces in hand - # parse("S,b,g,g,g,g,n,n,n,n,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,r,r,s") + # parse("S,b,g*4,n*4,p*17,r*2,s") # # => ["S", "b", "g", "g", "g", "g", "n", "n", "n", "n", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "p", "r", "r", "s"] # # @example Parse an empty list of serialized pieces in hand @@ -17,10 +17,17 @@ module InHand # # => [] # # @return [Array] The list of pieces in hand grouped by players. - def self.parse(piece_names_str) - return [] if piece_names_str == "-" + def self.parse(pieces_in_hand) + return if pieces_in_hand.nil? - piece_names_str.split(",") + pieces_in_hand.split(",").flat_map do |piece| + if piece.include?("*") + letter, count = piece.split("*") + [letter] * count.to_i + else + piece + end + end.sort end end end diff --git a/lib/feen/parser/turn.rb b/lib/feen/parser/turn.rb deleted file mode 100644 index 9aa4cf1..0000000 --- a/lib/feen/parser/turn.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module FEEN - module Parser - # The turn module. - module Turn - # @param side_id [String] The identifier of bottom-side and - # top-side. - # - # @example Parse the number that identify the player who have to play - # parse("0") # => 0 - # - # @return [Integer] The number that identify the player who have to play. - def self.parse(side_id) - Integer(side_id) - end - end - end -end