From: Benjamin Auder Date: Sat, 9 Jan 2021 19:56:23 +0000 (+0100) Subject: Add Brotherhood, Maharajah (special version) + Dobutsu variants X-Git-Url: https://git.auder.net/variants/current/doc/css/vendor/index.css?a=commitdiff_plain;h=6c00a6e55209930057bcf040cf444f40e7d47030;p=vchess.git Add Brotherhood, Maharajah (special version) + Dobutsu variants --- diff --git a/TODO b/TODO index 41530300..ec1571b9 100644 --- a/TODO +++ b/TODO @@ -3,36 +3,32 @@ Embedded rules language not updated when language is set (in Analyse, Game and P If new live game starts in background, "new game" notify OK but not first move. NEW VARIANTS: -https://www.chessvariants.com/incinf.dir/bario.html -https://www.pychess.org/variant/manchu -https://discord.com/channels/686736099959504907/687076968046395410/735678637432635473 + Amazon Chess -https://www.pychess.org/variant/dobutsu -https://musketeerchess.net/games/musketeer/index.php Attention règle de promotion + SVG / PNG -https://musketeerchess.net/games/cerebral/rules/rules.php : from Titan, should be easy -https://www.pychess.org/variant/shogun -https://www.reddit.com/r/TotemChess/comments/imi3v7/totem_rules/ -https://www.chessvariants.com/other.dir/fugue.html -https://www.chessvariants.com/rules/spartan-chess -https://www.chessvariants.com/mvopponent.dir/hypnotic-chess.html -https://www.chessvariants.com/mvopponent.dir/mesmer-chess.html -http://history.chess.free.fr/rollerball.htm Squatter Chess: safe on last rank = win -Companion Chess : pieces of same nature don't attack each others -https://www.chessvariants.com/difftaking.dir/brotherhood.html Crossing Chess = win when the king cross half-board Kingmaker: pawns can promote also into enemy king --> no king tracking, getCheckSquares + underCheck test all kings -Eightkings: 8 pawns + 8 kings (non-royal until the last remains?) ---> yes seems better, no king tracking + no underCheck/...etc when >= 2 kings -https://www.jatektan.hu/_2018_vissza/2011_ig/uj2001/isakk1.html + https://boardgamegeek.com/boardgame/18661/alapo Alapo is a strategy game. Each player owns twelve abstract pieces, two each of six different kinds. Round pieces move in any of the eight directions on the 6 by 6 board; square pieces move only orthogonally and triangular pieces only diagonally. Large pieces move any distance, small pieces only one field per turn. Opponent pieces can be eliminated by moving onto their position. The goal is to reach the opponent's base line with one of your pieces without the opponent being able to eliminate your piece in his/her next move. -Maybe: -https://www.chessvariants.com/diffmove.dir/asymmetric.html -https://www.chessvariants.com/play/connected-chess + +https://www.chessvariants.com/mvopponent.dir/hypnotic-chess.html +https://www.chessvariants.com/mvopponent.dir/mesmer-chess.html +https://www.reddit.com/r/TotemChess/comments/imi3v7/totem_rules/ +http://history.chess.free.fr/rollerball.htm + +https://www.chessvariants.com/other.dir/fugue.html +https://www.chessvariants.com/rules/spartan-chess +https://www.chessvariants.com/incinf.dir/bario.html +https://www.pychess.org/variant/shogun + +https://musketeerchess.net/games/musketeer/index.php Attention règle de promotion + SVG / PNG +https://musketeerchess.net/games/cerebral/rules/rules.php : from Titan, should be easy + Non-chess: -fanorona https://fr.wikipedia.org/wiki/Fanorona +gomoku, avalam, draughts, draughts8 Yoté https://fr.wikipedia.org/wiki/Yot%C3%A9 http://www.zillionsofgames.com/cgi-bin/zilligames/submissions.cgi/92187?do=show;id=960 -gomoku, avalam, qoridor (wider lines in another color ?), draughts, draughts8 +Fanorona https://fr.wikipedia.org/wiki/Fanorona + (puis quand hexaboards peut-être: hexavariants + Hex) +qoridor (wider lines in another color ?) diff --git a/client/public/images/pieces/Dobutsu/LICENSE.txt b/client/public/images/pieces/Dobutsu/LICENSE.txt new file mode 100644 index 00000000..2f244ac8 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/LICENSE.txt @@ -0,0 +1,395 @@ +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/client/public/images/pieces/Dobutsu/README.md b/client/public/images/pieces/Dobutsu/README.md new file mode 100644 index 00000000..73ed708d --- /dev/null +++ b/client/public/images/pieces/Dobutsu/README.md @@ -0,0 +1,13 @@ +[Couch Tomato - I presume] + +I recreated all of the original [Doubutsu](https://en.wikipedia.org/wiki/D%C5%8Dbutsu_sh%C5%8Dgi) pieces in Inkscape SVG format. + +Credits: the original Doubutsu pieces were created by [Madoka Kitato](https://en.wikipedia.org/wiki/Madoka_Kitao). + +(also: [screenshot of the gshogi version](https://raw.githubusercontent.com/Ka-hu/shogi-pieces/master/_screenshots/scrot_doubutsu_gshogi.png)) + +![doubutsu screenshot](https://raw.githubusercontent.com/Ka-hu/shogi-pieces/master/_screenshots/scrot_doubutsu_xboard.png) + +## License + +Where it's not stated otherwise, my work is lincensed under [CC-BY-4.0](https://choosealicense.com/licenses/cc-by-4.0) diff --git a/client/public/images/pieces/Dobutsu/be.svg b/client/public/images/pieces/Dobutsu/be.svg new file mode 120000 index 00000000..b4006848 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/be.svg @@ -0,0 +1 @@ +we.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bei.svg b/client/public/images/pieces/Dobutsu/bei.svg new file mode 120000 index 00000000..de6cd3cd --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bei.svg @@ -0,0 +1 @@ +wei.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bg.svg b/client/public/images/pieces/Dobutsu/bg.svg new file mode 120000 index 00000000..60095064 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bg.svg @@ -0,0 +1 @@ +wg.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bgi.svg b/client/public/images/pieces/Dobutsu/bgi.svg new file mode 120000 index 00000000..a2117b15 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bgi.svg @@ -0,0 +1 @@ +wgi.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bh.svg b/client/public/images/pieces/Dobutsu/bh.svg new file mode 120000 index 00000000..6d636de7 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bh.svg @@ -0,0 +1 @@ +wh.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bhi.svg b/client/public/images/pieces/Dobutsu/bhi.svg new file mode 120000 index 00000000..bbb4eb32 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bhi.svg @@ -0,0 +1 @@ +whi.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bk.svg b/client/public/images/pieces/Dobutsu/bk.svg new file mode 120000 index 00000000..17acf536 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bk.svg @@ -0,0 +1 @@ +wk.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bki.svg b/client/public/images/pieces/Dobutsu/bki.svg new file mode 120000 index 00000000..372d4cce --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bki.svg @@ -0,0 +1 @@ +wki.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bp.svg b/client/public/images/pieces/Dobutsu/bp.svg new file mode 120000 index 00000000..e2dd8982 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bp.svg @@ -0,0 +1 @@ +wp.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/bpi.svg b/client/public/images/pieces/Dobutsu/bpi.svg new file mode 120000 index 00000000..291a6a99 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/bpi.svg @@ -0,0 +1 @@ +wpi.svg \ No newline at end of file diff --git a/client/public/images/pieces/Dobutsu/we.svg b/client/public/images/pieces/Dobutsu/we.svg new file mode 100644 index 00000000..c7eb6dc8 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/we.svg @@ -0,0 +1,176 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wei.svg b/client/public/images/pieces/Dobutsu/wei.svg new file mode 100644 index 00000000..c8b0b3c7 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wei.svg @@ -0,0 +1,176 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wg.svg b/client/public/images/pieces/Dobutsu/wg.svg new file mode 100644 index 00000000..14a55a90 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wg.svg @@ -0,0 +1,186 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wgi.svg b/client/public/images/pieces/Dobutsu/wgi.svg new file mode 100644 index 00000000..f6eb0241 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wgi.svg @@ -0,0 +1,186 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wh.svg b/client/public/images/pieces/Dobutsu/wh.svg new file mode 100644 index 00000000..7256bc88 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wh.svg @@ -0,0 +1,156 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/whi.svg b/client/public/images/pieces/Dobutsu/whi.svg new file mode 100644 index 00000000..e172f8b3 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/whi.svg @@ -0,0 +1,156 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wk.svg b/client/public/images/pieces/Dobutsu/wk.svg new file mode 100644 index 00000000..83244547 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wk.svg @@ -0,0 +1,201 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wki.svg b/client/public/images/pieces/Dobutsu/wki.svg new file mode 100644 index 00000000..33c11d38 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wki.svg @@ -0,0 +1,201 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wp.svg b/client/public/images/pieces/Dobutsu/wp.svg new file mode 100644 index 00000000..69358c74 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wp.svg @@ -0,0 +1,139 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Dobutsu/wpi.svg b/client/public/images/pieces/Dobutsu/wpi.svg new file mode 100644 index 00000000..bbefcfc9 --- /dev/null +++ b/client/public/images/pieces/Dobutsu/wpi.svg @@ -0,0 +1,139 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Maharajah/bm.svg b/client/public/images/pieces/Maharajah/bm.svg new file mode 120000 index 00000000..000f539e --- /dev/null +++ b/client/public/images/pieces/Maharajah/bm.svg @@ -0,0 +1 @@ +../Maxima/bg.svg \ No newline at end of file diff --git a/client/src/styles/_board_squares_img.sass b/client/src/styles/_board_squares_img.sass index 4075984d..19916286 100644 --- a/client/src/styles/_board_squares_img.sass +++ b/client/src/styles/_board_squares_img.sass @@ -7,6 +7,10 @@ div.board display: inline-block position: relative +div.board3 + width: 33.33% + padding-bottom: 33.33% + div.board5 width: 20% padding-bottom: 20% diff --git a/client/src/translations/en.js b/client/src/translations/en.js index fc8bd3d5..a2f1eaf2 100644 --- a/client/src/translations/en.js +++ b/client/src/translations/en.js @@ -172,6 +172,7 @@ export const translations = { "All of the same color": "All of the same color", "Ancient rules": "Ancient rules", "Attract opposite king": "Attract opposite king", + "Augmented Queens": "Augmented Queens", "Balanced sliders & leapers": "Balanced sliders & leapers", "Big board": "Big board", "Bishop versus pawns": "Bishop versus pawns", @@ -207,6 +208,7 @@ export const translations = { "Faster development": "Faster development", "Four new pieces": "Four new pieces", "Free initial setup": "Free initial setup", + "Friendly pieces": "Friendly pieces", "In the shadow": "In the shadow", "Interweaved colorbound teams": "Interweaved colorbound teams", "Get strong at self-mate": "Get strong at self-mate", @@ -226,6 +228,7 @@ export const translations = { "Lancers everywhere": "Lancers everywhere", "Landing on the board": "Landing on the board", "Laws of attraction": "Laws of attraction", + "Let's catch the Lion!": "Let's catch the Lion!", "Long jumps over pieces": "Long jumps over pieces", "Long live the Queen": "Long live the Queen", "Lose all pieces": "Lose all pieces", diff --git a/client/src/translations/es.js b/client/src/translations/es.js index d0f87e04..97dbec11 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -172,6 +172,7 @@ export const translations = { "All of the same color": "Todo el mismo color", "Ancient rules": "Viejas reglas", "Attract opposite king": "Atraer al rey contrario", + "Augmented Queens": "Damas aumentadas", "Balanced sliders & leapers": "Modos de desplazamiento equilibrados", "Big board": "Gran tablero", "Bishop versus pawns": "Alfil contra peones", @@ -207,6 +208,7 @@ export const translations = { "Faster development": "Desarrollo acelerado", "Four new pieces": "Quatro nuevas piezas", "Free initial setup": "Posición inicial libre", + "Friendly pieces": "Piezas amistosas", "In the shadow": "En la sombra", "Interweaved colorbound teams": "Equipos unicolores entrelazados", "Get strong at self-mate": "Progreso en mates asistidos", @@ -226,6 +228,7 @@ export const translations = { "Lancers everywhere": "Lanceros por todas partes", "Landing on the board": "Aterrizando en el tablero", "Laws of attraction": "Las leyes de las atracciones", + "Let's catch the Lion!": "¡Atrapemos al León!", "Long jumps over pieces": "Saltos largos sobre las piezas", "Long live the Queen": "Larga vida a la reina", "Lose all pieces": "Perder todas las piezas", diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index 3adb35ef..98706b91 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -172,6 +172,7 @@ export const translations = { "All of the same color": "Tout de la même couleur", "Ancient rules": "Règles anciennes", "Attract opposite king": "Attirer le roi adverse", + "Augmented Queens": "Dames augmentées", "Balanced sliders & leapers": "Modes de déplacement équilibrés", "Big board": "Grand échiquier", "Bishop versus pawns": "Fou contre pions", @@ -207,6 +208,7 @@ export const translations = { "Faster development": "Développement accéléré", "Four new pieces": "Quatre nouvelles pièces", "Free initial setup": "Position initiale libre", + "Friendly pieces": "Pièces amies", "In the shadow": "Dans l'ombre", "Interweaved colorbound teams": "Équipes unicolores entremêlées", "Get strong at self-mate": "Progressez en mats aidés", @@ -226,6 +228,7 @@ export const translations = { "Lancers everywhere": "Lanciers à tous les coins", "Landing on the board": "Débarquement sur l'échiquier", "Laws of attraction": "Les lois de l'attraction", + "Let's catch the Lion!": "Attrapons le Lion !", "Long jumps over pieces": "Sauts longs par dessus les pièces", "Long live the Queen": "Long vie à la Reine", "Lose all pieces": "Perdez toutes les pièces", diff --git a/client/src/translations/rules/Brotherhood/en.pug b/client/src/translations/rules/Brotherhood/en.pug new file mode 100644 index 00000000..ba4971bf --- /dev/null +++ b/client/src/translations/rules/Brotherhood/en.pug @@ -0,0 +1,16 @@ +p.boxed. + Pieces cannot capture pieces of the same type. + +p. + Rooks, knights, bishops and queens cannot capture their counterparts in + the enemy army. + +p Stalemate counts as a loss. + +h3 More informations + +p + | See + a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html") + | Brotherhood Chess + |  on chessvariants.com. diff --git a/client/src/translations/rules/Brotherhood/es.pug b/client/src/translations/rules/Brotherhood/es.pug new file mode 100644 index 00000000..b04f4a13 --- /dev/null +++ b/client/src/translations/rules/Brotherhood/es.pug @@ -0,0 +1,16 @@ +p.boxed. + Las piezas no pueden capturar otras piezas del mismo tipo. + +p. + Las torres, los caballos, los alfiles y las damas no pueden capturar a sus + contrapartes en el ejército enemigo. + +p El empate equivale a una derrota. + +h3 Más información + +p + | Ver + a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html") + | Brotherhood Chess + |  en chessvariants.com. diff --git a/client/src/translations/rules/Brotherhood/fr.pug b/client/src/translations/rules/Brotherhood/fr.pug new file mode 100644 index 00000000..4565643e --- /dev/null +++ b/client/src/translations/rules/Brotherhood/fr.pug @@ -0,0 +1,16 @@ +p.boxed. + Les pièces ne peuvent pas capturer d'autres pièces du même type. + +p. + Les tours, cavaliers, fous et dames ne peuvent capturer leurs homologues + dans l'armée ennemie. + +p Le pat équivaut à une défaite. + +h3 Plus d'information + +p + | Voir + a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html") + | Brotherhood Chess + |  sur chessvariants.com. diff --git a/client/src/translations/rules/Dobutsu/en.pug b/client/src/translations/rules/Dobutsu/en.pug new file mode 100644 index 00000000..ae05563d --- /dev/null +++ b/client/src/translations/rules/Dobutsu/en.pug @@ -0,0 +1,41 @@ +p.boxed. + Simplified Shogi. + +p. + Dobutsu Shogi ("Animal Chess") is a Shogi variant for young children. + It was invented by professional shogi player Madoka Kitao, partially to + attract young girls to the game. It is played on a 3×4 board and + generally follows the rules of standard shogi, + with a few exceptions described below. + +figure.diagram-container + .diagram + | fen:gke/1p1/1P1/EKG: + figcaption Initial position. + +ul + li. + You must either capture the enemy Lion (King) or move your own + Lion into the final rank. + li. + All pieces move by one square at a time, + following directions indicated on pieces' edges. + li. + Once arrived on the final rank, Chick (Pawn) promotes into Hen (Tokin), + moving in all directions except diagonally backward. + Other pieces don't transform. + li. + Instead of playing a move, captured pieces may be dropped + (without restrictions). A captured Hen turns back into a Chick. + li Repetition of moves counts as a draw. + +figure.showPieces.text-center + img(src="/images/pieces/Dobutsu/wh.svg") + figcaption Hen: promoted pawn. + +h3 More information + +p + | The variant is playable on + a(href="https://www.pychess.org/variant/dobutsu") pychess-variants + | . See also the Wikipedia page. diff --git a/client/src/translations/rules/Dobutsu/es.pug b/client/src/translations/rules/Dobutsu/es.pug new file mode 100644 index 00000000..74c6c548 --- /dev/null +++ b/client/src/translations/rules/Dobutsu/es.pug @@ -0,0 +1,42 @@ +p.boxed. + Shogi simplificado. + +p. + Dobutsu Shogi ("Ajedrez animal") es una variante de Shogi destinada + a los niños pequeños. Fue inventado por la jugadora profesional + Madoka Kitao, en parte para atraer a las jóvenes al juego. + Se juega en un tablero de ajedrez 3x4 y generalmente sigue las reglas de + shogi estándar, con algunas excepciones que se describen a continuación. + +figure.diagram-container + .diagram + | fen:gke/1p1/1P1/EKG: + figcaption Position initiale. + +ul + li. + Debes capturar al León (Rey) oponente o traer tu propio + en la última fila. + li. + Todas las piezas solo se mueven un espacio a la vez, + siguiendo las indicaciones indicadas en los bordes de las piezas. + li. + Una vez en la última fila, se promueve el Pollito (Peón) + en una Gallina (Tokin), moviéndose en todas direcciones excepto + diagonalmente hacia atrás. Las otras piezas no se transforman. + li. + En lugar de jugar un movimiento, las piezas capturadas se pueden lanzar + en paracaídas (sin restricciones). Una Gallina capturada se convierte de + nuevo en Pollito. + li Las jugadas repetitivas equivalen a un empate. + +figure.showPieces.text-center + img(src="/images/pieces/Dobutsu/wh.svg") + figcaption Hen: pion promu. + +h3 Más información + +p + | La variante se puede jugar en + a(href="https://www.pychess.org/variant/dobutsu") pychess-variants + | . Consulte también la página de Wikipedia. diff --git a/client/src/translations/rules/Dobutsu/fr.pug b/client/src/translations/rules/Dobutsu/fr.pug new file mode 100644 index 00000000..10a79116 --- /dev/null +++ b/client/src/translations/rules/Dobutsu/fr.pug @@ -0,0 +1,41 @@ +p.boxed. + Shogi simplifié. + +p. + Dobutsu Shogi ("Échecs des Animaux") est une variante du Shogi destinée + aux jeunes enfants. Elle a été inventée par la joueuse professionnelle + Madoka Kitao, en partie pour attirer de jeunes filles vers le jeu. + Elle se joue sur un échiquier 3x4 et suit généralement les règles du + shogi standard, avec quelques exceptions décrites ci-dessous. + +figure.diagram-container + .diagram + | fen:gke/1p1/1P1/EKG: + figcaption Position initiale. + +ul + li. + Vous devez soit capturer le Lion (Roi) adverse, ou bien amener le votre + sur la dernière rangée. + li. + Toutes les pièces ne se déplacent que d'une case à la fois, + suivant les directions indiquées sur les bords des pièces. + li. + Une fois parvenu sur la dernière rangée, le Poussin (Pion) est promu + en une Poule (Tokin), se déplaçant dans toutes les directions sauf + en diagonale vers arrière. Les autres pièces ne se transforment pas. + li. + Au lieu de jouer un coup, les pièces capturées peuvent être parachutées + (sans restrictions). Une Poule capturée redevient un Poussin. + li La répétition de coups équivaut à une nulle. + +figure.showPieces.text-center + img(src="/images/pieces/Dobutsu/wh.svg") + figcaption Hen: pion promu. + +h3 Plus d'information + +p + | La variante est jouable sur + a(href="https://www.pychess.org/variant/dobutsu") pychess-variants + | . Voir aussi la page Wikipedia. diff --git a/client/src/translations/rules/Maharajah/en.pug b/client/src/translations/rules/Maharajah/en.pug new file mode 100644 index 00000000..5a84a380 --- /dev/null +++ b/client/src/translations/rules/Maharajah/en.pug @@ -0,0 +1,25 @@ +p.boxed. + Standard army versus two powerful pieces. + +p + | This variant is inspired from + a(href="https://en.wikipedia.org/wiki/Maharajah_and_the_Sepoys") + | Maharajah Chess + | . Since it is known as a forced win for Black, it is modified here + | following ideas of Rad Herring and viro90 + a(href="https://discord.com/channels/686736099959504907/687076968046395410/735678637432635473") + | on Discord + | . The rules deviate slightly from both of their proposals, however, + | in another attempt to balance the game. + +p Rules: +ul + li White pieces move as usual, and must eliminates both black units. + li. + Black pieces are a combination of a queen, a knight, and a two-squares + jumper (Alfil + Dabbabah). They must capture the king. + +figure.diagram-container + .diagram + | fen:8/8/1N2P3/3mR3/3P4/2B2Q2/8/7K b6,c7,a5,b5,c5,f5,a2,b3,c4,a8,b7,c6,e4,f3,d4,d3,c3,e3,f4,f6,e7,f7,d6,d7,d8,e5,e6,b4: + figcaption Movements of the "upgraded Maharajah". diff --git a/client/src/translations/rules/Maharajah/es.pug b/client/src/translations/rules/Maharajah/es.pug new file mode 100644 index 00000000..d2c68bca --- /dev/null +++ b/client/src/translations/rules/Maharajah/es.pug @@ -0,0 +1,27 @@ +p.boxed. + Ejército estándar para dos piezas poderosas. + +p + | Esta variante está inspirada de + a(href="https://en.wikipedia.org/wiki/Maharajah_and_the_Sepoys") + | Maharajah Chess + | . Dado que esto conduce a una victoria negra, se modifica aquí + | siguiendo las ideas de Rad Herring y viro90 + a(href="https://discord.com/channels/686736099959504907/687076968046395410/735678637432635473") + | en Discord + | . Las reglas se desvían ligeramente de sus propuestas, sin embargo, en + | otro intento de equilibrar el juego. + +p Reglas: +ul + li. + Las piezas blancas se mueven como de costumbre, + y debe eliminar las dos piezas negras. + li. + Las piezas negras son combinaciones dama + caballo + dos "saltadores + de dos casillas" (Alfil + Dabbabah). Deben capturar al rey. + +figure.diagram-container + .diagram + | fen:8/8/1N2P3/3mR3/3P4/2B2Q2/8/7K b6,c7,a5,b5,c5,f5,a2,b3,c4,a8,b7,c6,e4,f3,d4,d3,c3,e3,f4,f6,e7,f7,d6,d7,d8,e5,e6,b4: + figcaption Movimientos del "Maharajá aumentado". diff --git a/client/src/translations/rules/Maharajah/fr.pug b/client/src/translations/rules/Maharajah/fr.pug new file mode 100644 index 00000000..c447d4f3 --- /dev/null +++ b/client/src/translations/rules/Maharajah/fr.pug @@ -0,0 +1,27 @@ +p.boxed. + Armée standard contre deux pièces puissantes. + +p + | Cette variante est inspirée de + a(href="https://en.wikipedia.org/wiki/Maharajah_and_the_Sepoys") + | Maharajah Chess + | . Puisque celle-ci mène à une victoire des noirs, elle est modifiée ici + | suivant des idées de Rad Herring et viro90 + a(href="https://discord.com/channels/686736099959504907/687076968046395410/735678637432635473") + | sur Discord + | . Les règles dévient légèrement de leurs propositions, cependant, dans + | une autre tentative d'équilibrer le jeu. + +p Règles : +ul + li. + Les pièces blanches se déplacent comme d'habitude, + et doivent éliminer les deux pièces noires. + li. + Les pièces noires sont des combinaisons dame + cavalier + deux "sauteurs + de deux cases" (Alfil + Dabbabah). Elles doivent capturer le roi. + +figure.diagram-container + .diagram + | fen:8/8/1N2P3/3mR3/3P4/2B2Q2/8/7K b6,c7,a5,b5,c5,f5,a2,b3,c4,a8,b7,c6,e4,f3,d4,d3,c3,e3,f4,f6,e7,f7,d6,d7,d8,e5,e6,b4: + figcaption Déplacements du "Maharajah augmenté". diff --git a/client/src/translations/variants/en.pug b/client/src/translations/variants/en.pug index 7eeb43fd..0ac43461 100644 --- a/client/src/translations/variants/en.pug +++ b/client/src/translations/variants/en.pug @@ -15,6 +15,7 @@ p Variants with very few different pieces, and a simplified goal. var varlist = [ "Bishopawns", "Discoduel", + "Dobutsu", "Knightpawns", "Pawns", "Pawnsking", @@ -394,6 +395,7 @@ p. "Ambiguous", "Avalanche", "Bicolour", + "Brotherhood", "Castle", "Doublearmy", "Evolution", @@ -403,6 +405,7 @@ p. "Hamilton", "Isardam", "Magnetic", + "Maharajah", "Otage", "Pacosako", "Parachute", diff --git a/client/src/translations/variants/es.pug b/client/src/translations/variants/es.pug index ad4fa473..761b7398 100644 --- a/client/src/translations/variants/es.pug +++ b/client/src/translations/variants/es.pug @@ -17,6 +17,7 @@ p Variantes con muy pocas piezas diferentes y un propósito simplificado. var varlist = [ "Bishopawns", "Discoduel", + "Dobutsu", "Knightpawns", "Pawns", "Pawnsking", @@ -405,6 +406,7 @@ p. "Ambiguous", "Avalanche", "Bicolour", + "Brotherhood", "Castle", "Doublearmy", "Evolution", @@ -414,6 +416,7 @@ p. "Hamilton", "Isardam", "Magnetic", + "Maharajah", "Otage", "Pacosako", "Parachute", diff --git a/client/src/translations/variants/fr.pug b/client/src/translations/variants/fr.pug index 28d7876c..232691d6 100644 --- a/client/src/translations/variants/fr.pug +++ b/client/src/translations/variants/fr.pug @@ -16,6 +16,7 @@ p Variantes avec très peu de pièces différentes, et un but simplifié. var varlist = [ "Bishopawns", "Discoduel", + "Dobutsu", "Knightpawns", "Pawns", "Pawnsking", @@ -404,6 +405,7 @@ p. "Ambiguous", "Avalanche", "Bicolour", + "Brotherhood", "Castle", "Doublearmy", "Evolution", @@ -413,6 +415,7 @@ p. "Hamilton", "Isardam", "Magnetic", + "Maharajah", "Otage", "Pacosako", "Parachute", diff --git a/client/src/variants/Brotherhood.js b/client/src/variants/Brotherhood.js new file mode 100644 index 00000000..4da4e114 --- /dev/null +++ b/client/src/variants/Brotherhood.js @@ -0,0 +1,24 @@ +import { ChessRules } from "@/base_rules"; + +export class BrotherhoodRules extends ChessRules { + + getPotentialMovesFrom([x, y]) { + return ( + super.getPotentialMovesFrom([x, y]).filter(m => { + // Forbid capturing same piece's type: + return ( + m.vanish.length == 1 || + [V.PAWN, V.KING].includes(m.vanish[0].p) || + m.vanish[1].p != m.vanish[0].p + ); + }) + ); + } + + getCurrentScore() { + if (this.atLeastOneMove()) return "*"; + // Game over + return (this.turn == "w" ? "0-1" : "1-0"); + } + +}; diff --git a/client/src/variants/Dobutsu.js b/client/src/variants/Dobutsu.js new file mode 100644 index 00000000..a5c03868 --- /dev/null +++ b/client/src/variants/Dobutsu.js @@ -0,0 +1,313 @@ +import { ChessRules, PiPo, Move } from "@/base_rules"; +import { ArrayFun } from "@/utils/array"; +import { sample, shuffle } from "@/utils/alea"; + +export class DobutsuRules extends ChessRules { + + static get HasFlags() { + return false; + } + + static get HasEnpassant() { + return false; + } + + static get Monochrome() { + return true; + } + + static IsGoodFen(fen) { + if (!ChessRules.IsGoodFen(fen)) return false; + const fenParsed = V.ParseFen(fen); + // 3) Check reserves + if (!fenParsed.reserve || !fenParsed.reserve.match(/^[0-9]{14,14}$/)) + return false; + return true; + } + + static ParseFen(fen) { + const fenParts = fen.split(" "); + return Object.assign( + ChessRules.ParseFen(fen), + { reserve: fenParts[3] } + ); + } + + static get ELEPHANT() { + return "e"; + } + static get GIRAFFE() { + return "g"; + } + static get HEN() { + return "h"; + } + + static get PIECES() { + return [ + ChessRules.PAWN, + ChessRules.KING, + V.ELEPHANT, + V.GIRAFFE, + V.HEN + ]; + } + + getPpath(b, color, score, orientation) { + // 'i' for "inversed": + const suffix = (b[0] == orientation ? "" : "i"); + return "Dobutsu/" + b + suffix; + } + + getPPpath(m, orientation) { + return ( + this.getPpath( + m.appear[0].c + m.appear[0].p, + null, + null, + orientation + ) + ); + } + + static GenRandInitFen() { + return "gke/1p1/1P1/EKG w 0 00000000"; + } + + getFen() { + return super.getFen() + " " + this.getReserveFen(); + } + + getFenForRepeat() { + return super.getFenForRepeat() + "_" + this.getReserveFen(); + } + + getReserveFen() { + let counts = new Array(6); + for (let i = 0; i < V.RESERVE_PIECES.length; i++) { + counts[i] = this.reserve["w"][V.RESERVE_PIECES[i]]; + counts[3 + i] = this.reserve["b"][V.RESERVE_PIECES[i]]; + } + return counts.join(""); + } + + setOtherVariables(fen) { + super.setOtherVariables(fen); + // Also init reserves (used by the interface to show landable pieces) + const reserve = + V.ParseFen(fen).reserve.split("").map(x => parseInt(x, 10)); + this.reserve = { + w: { + [V.PAWN]: reserve[0], + [V.ELEPHANT]: reserve[1], + [V.GIRAFFE]: reserve[2] + }, + b: { + [V.PAWN]: reserve[3], + [V.ELEPHANT]: reserve[4], + [V.GIRAFFE]: reserve[5] + } + }; + } + + // Goal is to capture the king, easier to not track kings + scanKings() {} + + getColor(i, j) { + if (i >= V.size.x) return i == V.size.x ? "w" : "b"; + return this.board[i][j].charAt(0); + } + + getPiece(i, j) { + if (i >= V.size.x) return V.RESERVE_PIECES[j]; + return this.board[i][j].charAt(1); + } + + static get size() { + return { x: 4, y: 3}; + } + + getReservePpath(index, color, orientation) { + return ( + "Dobutsu/" + color + V.RESERVE_PIECES[index] + + (color != orientation ? 'i' : '') + ); + } + + // Ordering on reserve pieces + static get RESERVE_PIECES() { + return ( + // No king, since the goal is to capture it + [V.PAWN, V.ELEPHANT, V.GIRAFFE] + ); + } + + getReserveMoves([x, y]) { + const color = this.turn; + const p = V.RESERVE_PIECES[y]; + if (this.reserve[color][p] == 0) return []; + let moves = []; + for (let i = 0; i < V.size.x; i++) { + for (let j = 0; j < V.size.y; j++) { + if (this.board[i][j] == V.EMPTY) { + let mv = new Move({ + appear: [ + new PiPo({ + x: i, + y: j, + c: color, + p: p + }) + ], + vanish: [], + start: { x: x, y: y }, //a bit artificial... + end: { x: i, y: j } + }); + moves.push(mv); + } + } + } + return moves; + } + + getPotentialMovesFrom(sq) { + if (sq[0] >= V.size.x) { + // Reserves, outside of board: x == sizeX(+1) + return this.getReserveMoves(sq); + } + switch (this.getPiece(sq[0], sq[1])) { + case V.PAWN: return this.getPotentialPawnMoves(sq); + case V.ELEPHANT: return this.getPotentialElephantMoves(sq); + case V.GIRAFFE: return this.getPotentialGiraffeMoves(sq); + case V.KING: return super.getPotentialKingMoves(sq); + } + return []; //never reached + } + + getPotentialPawnMoves([x, y]) { + const c = this.turn; + const beforeLastRank = (c == 'w' ? 1 : 2); + const forward = (c == 'w' ? -1 : 1); + if (!V.OnBoard(x + forward, y)) return []; //stuck pawn + if ( + this.board[x + forward][y] == V.EMPTY || + this.getColor(x + forward, y) != c + ) { + const tr = (x == beforeLastRank ? { p: V.HEN, c: c } : null); + return [super.getBasicMove([x, y], [x + forward, y], tr)]; + } + } + + getPotentialElephantMoves(sq) { + return super.getSlideNJumpMoves(sq, V.steps[V.BISHOP], "oneStep"); + } + + getPotentialGiraffeMoves(sq) { + return super.getSlideNJumpMoves(sq, V.steps[V.ROOK], "oneStep"); + } + + getAllValidMoves() { + let moves = super.getAllPotentialMoves(); + const color = this.turn; + for (let i = 0; i < V.RESERVE_PIECES.length; i++) { + moves = moves.concat( + this.getReserveMoves([V.size.x + (color == "w" ? 0 : 1), i]) + ); + } + return moves; + } + + // Goal is to capture the king: + isAttacked() { + return false; + } + filterValid(moves) { + return moves; + } + getCheckSquares() { + return []; + } + + static MayDecode(piece) { + if (piece == V.HEN) return V.PAWN; + return piece; + } + + postPlay(move) { + const color = move.appear[0].c; + if (move.vanish.length == 0) + // Drop unpromoted piece: + this.reserve[color][move.appear[0].p]--; + else if (move.vanish.length == 2) + // May capture a promoted piece: + this.reserve[color][V.MayDecode(move.vanish[1].p)]++; + } + + postUndo(move) { + const color = this.turn; + if (move.vanish.length == 0) + this.reserve[color][move.appear[0].p]++; + else if (move.vanish.length == 2) + this.reserve[color][V.MayDecode(move.vanish[1].p)]--; + } + + getCurrentScore() { + const c = this.turn; + if (this.board.every(row => row.every(cell => cell != c + 'k'))) + return (c == 'w' ? "0-1" : "1-0"); + const oppCol = V.GetOppCol(c); + const oppLastRank = (c == 'w' ? 3 : 0); + for (let j=0; j < V.size.y; j++) { + if (this.board[oppLastRank][j] == oppCol + 'k') + return (oppCol == 'w' ? "1-0" : "0-1"); + } + return "*"; + } + + static get SEARCH_DEPTH() { + return 4; + } + + static get VALUES() { + // NOTE: very arbitrary + return { + p: 1, + h: 4, + g: 3, + e: 2, + k: 1000 + } + } + + evalPosition() { + let evaluation = super.evalPosition(); + // Add reserves: + for (let i = 0; i < V.RESERVE_PIECES.length; i++) { + const p = V.RESERVE_PIECES[i]; + evaluation += this.reserve["w"][p] * V.VALUES[p]; + evaluation -= this.reserve["b"][p] * V.VALUES[p]; + } + return evaluation; + } + + getNotation(move) { + const finalSquare = V.CoordsToSquare(move.end); + if (move.vanish.length == 0) { + // Rebirth: + const piece = move.appear[0].p.toUpperCase(); + return (piece != 'P' ? piece : "") + "@" + finalSquare; + } + const piece = move.vanish[0].p.toUpperCase(); + return ( + (piece != 'P' || move.vanish.length == 2 ? piece : "") + + (move.vanish.length == 2 ? "x" : "") + + finalSquare + + ( + move.appear[0].p != move.vanish[0].p + ? "=" + move.appear[0].p.toUpperCase() + : "" + ) + ); + } + +}; diff --git a/client/src/variants/Maharajah.js b/client/src/variants/Maharajah.js new file mode 100644 index 00000000..a49828b2 --- /dev/null +++ b/client/src/variants/Maharajah.js @@ -0,0 +1,185 @@ +import { ChessRules } from "@/base_rules"; + +export class MaharajahRules extends ChessRules { + + static get HasEnpassant() { + return false; + } + + static get MAHARAJAH() { + return 'm'; + } + + getPpath(b) { + return b.charAt(0) == 'w' ? b : "Maharajah/bm"; + } + + static get PIECES() { + return ChessRules.PIECES.concat([V.MAHARAJAH]); + } + + static get M_EXTRA_STEPS() { + return [ + // Jumping options: + [-2, -2], + [-2, 0], + [-2, 2], + [0, -2], + [0, 2], + [2, -2], + [2, 0], + [2, 2] + ]; + } + + static IsGoodPosition(position) { + if (position.length == 0) return false; + const rows = position.split("/"); + if (rows.length != V.size.x) return false; + let wKingCount = 0; + for (let row of rows) { + let sumElts = 0; + for (let i = 0; i < row.length; i++) { + const lowR = row[i].toLowerCase(); + if (!!lowR.match(/[a-z]/)) { + if (row[i] == lowR && row[i] != 'm') return false; + if (row[i] == 'K') wKingCount++; + if (V.PIECES.includes(lowR)) sumElts++; + } + else { + const num = parseInt(row[i], 10); + if (isNaN(num) || num <= 0) return false; + sumElts += num; + } + } + if (sumElts != V.size.y) return false; + } + if (wKingCount != 1) return false; + return true; + } + + static IsGoodFlags(flags) { + // Only white can castle + return !!flags.match(/^[a-z]{2,2}$/); + } + + scanKings(fen) { + // Square of white king only: + this.kingPos = { w: [-1, -1], b: [-1, -1] }; + const fenRows = V.ParseFen(fen).position.split("/"); + for (let i = 0; i < fenRows.length; i++) { + let k = 0; //column index on board + for (let j = 0; j < fenRows[i].length; j++) { + switch (fenRows[i].charAt(j)) { + case "K": + this.kingPos["w"] = [i, k]; + break; + default: { + const num = parseInt(fenRows[i].charAt(j), 10); + if (!isNaN(num)) k += num - 1; + } + } + k++; + } + } + } + + static GenRandInitFen(randomness) { + const sFen = ChessRules.GenRandInitFen(Math.max(randomness, 1)); + return "3mm3/8/" + sFen.substring(18, 50); + } + + getFlagsFen() { + return this.castleFlags['w'].map(V.CoordToColumn).join(""); + } + + setFlags(fenflags) { + this.castleFlags = { 'w': [-1, -1] }; + for (let i = 0; i < 2; i++) + this.castleFlags['w'][i] = V.ColumnToCoord(fenflags.charAt(i)); + } + + getPotentialMovesFrom(sq) { + if (this.turn == 'w') return super.getPotentialMovesFrom(sq); + return this.getPotentialMaharajahMoves(sq); + } + + getPotentialMaharajahMoves(sq) { + let moves = super.getPotentialQueenMoves(sq); + moves = moves.concat(super.getPotentialKnightMoves(sq)); + const otherJumpMoves = + super.getSlideNJumpMoves(sq, V.M_EXTRA_STEPS, "oneStep") + .filter(m => + moves.every(mv => mv.end.x != m.end.x || mv.end.y != m.end.y)); + return moves.concat(otherJumpMoves); + } + + isAttacked() { + return false; + } + getCheckSquares() { + return []; + } + filterValid(moves) { + return moves; + } + + updateCastleFlags(move, piece) { + // Only white can castle: + const firstRank = 7; + if (piece == V.KING && move.appear[0].c == 'w') + this.castleFlags['w'] = [8, 8]; + else if ( + move.start.x == firstRank && + this.castleFlags['w'].includes(move.start.y) + ) { + const flagIdx = (move.start.y == this.castleFlags['w'][0] ? 0 : 1); + this.castleFlags['w'][flagIdx] = 8; + } + else if ( + move.end.x == firstRank && + this.castleFlags['w'].includes(move.end.y) + ) { + const flagIdx = (move.end.y == this.castleFlags['w'][0] ? 0 : 1); + this.castleFlags['w'][flagIdx] = 8; + } + } + + postPlay(move) { + if (this.turn == 'b') super.postPlay(move); + else { + // After a black move: white king may have disappeared + if (move.vanish.length == 2 && move.vanish[1].p == V.KING) + this.kingPos['w'] = [-1, -1]; + } + } + + postUndo(move) { + if (this.turn == 'w') super.postUndo(move); + else { + // After undoing a black move (may have captured king) + if (move.vanish.length == 2 && move.vanish[1].p == V.KING) + this.kingPos['w'] = [move.end.x, move.end.y]; + } + } + + getCurrentScore() { + if (this.turn == 'w' && this.kingPos['w'][0] < 0) return "0-1"; + if ( + this.turn == 'b' && + this.board.every(row => row.every(cell => cell.charAt(0) != 'b')) + ) { + return "1-0"; + } + return "*"; + } + + static get VALUES() { + return Object.assign({ m: 15 }, ChessRules.VALUES); + } + + static get SEARCH_DEPTH() { + return 2; + } + +}; diff --git a/client/src/variants/Shogi.js b/client/src/variants/Shogi.js index e8b17918..63c0d726 100644 --- a/client/src/variants/Shogi.js +++ b/client/src/variants/Shogi.js @@ -308,7 +308,7 @@ export class ShogiRules extends ChessRules { case V.LANCE: return this.getPotentialLanceMoves([x, y]); case V.KING: - return this.getPotentialKingMoves([x, y]); + return super.getPotentialKingMoves([x, y]); case V.P_ROOK: return this.getPotentialDragonMoves([x, y]); case V.P_BISHOP: @@ -447,14 +447,6 @@ export class ShogiRules extends ChessRules { ); } - getPotentialKingMoves(sq) { - return this.getSlideNJumpMoves( - sq, - V.steps[V.ROOK].concat(V.steps[V.BISHOP]), - { oneStep: true } - ); - } - isAttacked(sq, color) { return ( this.isAttackedByPawn(sq, color) || diff --git a/server/db/populate.sql b/server/db/populate.sql index 399fbb59..56571e56 100644 --- a/server/db/populate.sql +++ b/server/db/populate.sql @@ -30,6 +30,7 @@ insert or ignore into Variants (name, description) values ('Berolina', 'Pawns move diagonally'), ('Bicolour', 'Harassed kings'), ('Bishopawns', 'Bishop versus pawns'), + ('Brotherhood', 'Friendly pieces'), ('Cannibal', 'Capture powers'), ('Capture', 'Mandatory captures'), ('Castle', 'Win by castling long'), @@ -46,6 +47,7 @@ insert or ignore into Variants (name, description) values ('Cylinder', 'Neverending rows'), ('Diamond', 'Rotating board'), ('Discoduel', 'Enter the disco'), + ('Dobutsu', 'Let''s catch the Lion!'), ('Doublearmy', '64 pieces on the board'), ('Doublemove1', 'Double moves (v1)'), ('Doublemove2', 'Double moves (v2)'), @@ -79,6 +81,7 @@ insert or ignore into Variants (name, description) values ('Madhouse', 'Rearrange enemy pieces'), ('Madrasi', 'Paralyzed pieces'), ('Magnetic', 'Laws of attraction'), + ('Maharajah', 'Augmented Queens'), ('Makpong', 'Thai Chess (v2)'), ('Makruk', 'Thai Chess (v1)'), ('Maxima', 'Occupy the enemy palace'),