Compare commits

...

193 commits

Author SHA1 Message Date
Timo Ley beb3e37348 Merge branch 'mi-g-master' 2020-07-18 16:39:46 +02:00
Timo Ley 3b6a138342 Merge branch 'master' of https://github.com/mi-g/jocly into mi-g-master 2020-07-18 16:39:26 +02:00
Michel Gutierrez 61e7b77e1a
Merge pull request #37 from jcfrog/master
2 small fixes in readme file
2020-03-23 08:52:29 +01:00
jcfrog 27db157069
Update README.md
fixed a compilation command parameter
2020-03-19 14:07:42 +01:00
jcfrog d0dddafbd9
Update README.md
fixed wrong URL params for simple games examples
2020-03-19 14:01:37 +01:00
tilera 75beea223b
Update gulpfile.js 2019-01-20 18:20:26 +01:00
tilera afd6558369 Revert "Deletet Files for merge"
This reverts commit b200ad8127.
2019-01-20 18:16:59 +01:00
tilera 52aa3f13e3 Revert "Changed Index.js for merge"
This reverts commit 54499701a0.
2019-01-20 18:16:51 +01:00
tilera 54499701a0 Changed Index.js for merge 2019-01-20 18:13:02 +01:00
tilera b200ad8127 Deletet Files for merge 2019-01-20 18:09:51 +01:00
mig 71ce15a5c5 fix error when building in dev mode 2018-12-06 17:45:29 +01:00
Michel Gutierrez 3ac8a77e31 Merge pull request #24 from ecobabush/master
Brusky chess pawn promotion bugfix.
2017-09-18 15:50:37 +02:00
ecobabush 37da8c2e67 Brusky chess pawn promotion bugfix.
It is like in Devasa chess by analogy with glinski chess.
2017-09-13 11:38:19 +00:00
Michel Gutierrez 055f63a977 Merge pull request #23 from ecobabush/master
Devasa-chess pawn promotion bugfix like in glinski-chess.
Many thanks for the fix !
2017-09-12 22:59:26 +02:00
ecobabush 57577dcd44 Bugfix of pawn promotion like in glinski-chess 2017-09-12 20:09:12 +00:00
Michel Gutierrez 1b593b2f3d Merge pull request #21 from ecobabush/master
Bugfixes_Added pawn promotion at d9 and g10.
Thanks for the PR !
2017-08-27 17:33:05 +02:00
ecobabush 21715f24db McCooey Chess 2 bugfixes of pawn promotions at d9,g8->g10
These bugs were in glinski chess too.
2017-08-27 17:52:02 +03:00
ecobabush 8727c790f3 Bugfixes_Added pawn promotion at d9 and g10.
Debugged pawn promotion at d9, g8, g10.
2017-08-26 20:43:17 +03:00
tilera 87838dc819 add king of the hill 2017-08-19 06:42:15 +02:00
Michel Gutierrez 8d9ab54204 Merge pull request #17 from ecobabush/castling
Fixed Castling on Malett and Demi
2017-08-16 14:33:10 +02:00
ecobabush b9b3284205 Made castling behavior right.
As I understood, have made change to remove bug with castling.
2017-08-16 13:40:41 +03:00
ecobabush 895fc8e254 Final version of this file.
I am getting started to use github. Then it is not all ease for me. Excuse me for that.
2017-08-16 13:36:28 +03:00
ecobabush 6a0635c54e added \n according to POSIX 2017-08-15 19:20:31 +03:00
ecobabush 9dfbf9e7b1 Try to revert full stop
When I have compared two version the original one had full stop at the end of the file, when the second one does not.
2017-08-15 18:33:37 +03:00
ecobabush da03f87c42 Change to make black able to castle right.
If I understood right, I made a change to how castling of black should go.
2017-08-15 18:19:29 +03:00
tilera 3584ae207d add variants 2017-08-12 17:43:04 +02:00
tilera 977ecf5ddb add lcb visuals 2017-08-12 16:54:11 +02:00
tilera a3ff533500 add lcb rule graphs 2017-08-09 17:53:42 +02:00
tilera 2d34b9fc0f added leychessbeta files 2017-08-08 23:37:48 +02:00
Michel Gutierrez a83e15dd63 Merge pull request #15 from MineProjectZorg/master
Added Leychessalpha by MineProjectZorg
2017-08-02 00:25:02 +02:00
tilera 9f99a717ca readded wtamerlane 2017-08-01 23:07:07 +02:00
tilera 95ad3de4af add fairy icons 2017-08-01 23:03:09 +02:00
tilera 18349373f1 add leychess rules images 2017-08-01 23:01:56 +02:00
tilera 3b0a940577 add leychessalpha visuals 2017-08-01 23:00:32 +02:00
tilera 907d1684b2 add leychessalpha files 2017-08-01 22:59:29 +02:00
tilera dda3af9297 changed extensions for thumbs 2017-08-01 10:47:13 +02:00
tilera e663e6c693 remove thumbs for extension change 2017-08-01 10:46:48 +02:00
tilera 7e65da9ad2 add files with new extensions 2017-08-01 10:45:56 +02:00
tilera 3af6513018 removed files for extension change 2017-08-01 10:45:16 +02:00
tilera b1a9ab268d corecctet leychessalpha rules 2017-08-01 09:36:42 +02:00
tilera 6924d27d88 removed musketeer pieces and leychessbeta files 2017-08-01 09:29:56 +02:00
tilera feaec5ed73 add cavalier rules 2017-07-29 23:29:59 +02:00
tilera 4eed648df5 add lighthouse 2017-07-29 23:19:06 +02:00
tilera d0c154fe58 fixed rules 2017-07-29 23:14:09 +02:00
tilera 803c4c33e4 adding rules 2017-07-29 21:52:33 +02:00
tilera 843ea4a122 add rule images 2017-07-29 21:36:20 +02:00
tilera 0defcba49e Update leychessbeta-rules.html 2017-07-29 21:23:36 +02:00
tilera 2f18bf8b3b Update leychessalpha-rules.html 2017-07-29 21:22:37 +02:00
tilera 09da4b90eb Update leychessbeta-rules.html 2017-07-29 21:19:02 +02:00
tilera b4f545f9e7 add leychessalpha rules 2017-07-29 21:17:44 +02:00
tilera 36ae844cbb fixing errors in lcb rules 2017-07-29 21:03:03 +02:00
tilera fd0a5bc07c adding leychessbeta files 2017-07-29 20:59:51 +02:00
tilera f28982381a Delete create.js 2017-07-29 20:58:31 +02:00
tilera f24f454560 adding thumbnails 2017-07-29 19:45:14 +02:00
tilera 4e1243acf8 Update index.js 2017-07-29 19:40:40 +02:00
tilera 7464de6f52 adding 3d visuals 2017-07-29 19:38:22 +02:00
tilera dbd83f5c46 added credits 2017-07-29 18:56:07 +02:00
tilera ccd521c25c add descriptions 2017-07-29 12:53:54 +02:00
tilera 3fb10a7d4f adding a "." to the lca description 2017-07-29 12:45:32 +02:00
tilera e76371d419 added description for LeyChessAlpha 2017-07-29 12:40:06 +02:00
tilera 4a6de5ec2a changed "Unicorn" into "Knightrider" 2017-07-29 10:47:16 +02:00
tilera 43eb2beca5 Create leychessalpha-description.html 2017-07-28 19:43:59 +02:00
tilera fd7836345e Delete index.js 2017-07-28 19:41:58 +02:00
tilera 9c02256e23 changed visuals 2017-07-28 19:36:00 +02:00
tilera c738c2edde adding 2d visuals 2017-07-28 18:12:34 +02:00
tilera d67815098c readded wild tamerlane chess 2017-07-28 17:31:51 +02:00
tilera d7167d4346 add other musketeer pieces 2017-07-26 19:03:37 +02:00
tilera 5938905660 adding Emperor Chess Piece 2017-07-26 10:05:15 +02:00
tilera 3d9508310d adding musketeer pieces 2017-07-26 10:03:52 +02:00
tilera 31f7b0037f complete index.js 2017-07-26 09:56:49 +02:00
tilera 279634ec0e Changing index.js 2017-07-26 09:28:38 +02:00
tilera fa3eca7841 index.js changes 2017-07-26 09:14:11 +02:00
tilera d52c3a2ffb Added 4Board Chess 2017-07-26 09:13:33 +02:00
tilera d5622e9ff6 Added Knightet Chess and LeychessAlpha to index.js 2017-07-26 08:53:10 +02:00
tilera 9f72e57d0b add Cavalierchess and Grand Cavalierchess 2017-07-26 08:51:33 +02:00
tilera 6fd0ccdd93 Add files via upload 2017-07-20 22:06:44 +02:00
tilera 92063a72cb Create create.js 2017-07-20 22:05:10 +02:00
tilera e6558a7e98 Add files via upload 2017-07-20 22:04:06 +02:00
tilera fa9c25f985 Create create.js 2017-07-20 22:03:05 +02:00
tilera e604a5955d Add files via upload 2017-07-20 21:56:07 +02:00
tilera ab2ad40c5d Add files via upload 2017-07-20 21:54:42 +02:00
tilera 6611dd95f1 Add files via upload 2017-07-20 21:50:41 +02:00
tilera 4fd4891627 Add files via upload 2017-06-21 18:36:37 +02:00
tilera 403849773c Merge pull request #1 from mi-g/master
test
2017-06-21 18:31:25 +02:00
mig d42c8ab046 moved to 0.9.12 2017-06-20 09:15:45 +02:00
Michel Gutierrez d8b9dc46ad Merge pull request #4 from jcfrog/master
adding Wild Tamerlane game
2017-06-20 01:57:54 +02:00
jcfrog bdc6ede882 Merge remote-tracking branch 'upstream/master' 2017-06-19 19:54:56 +02:00
jcfrog d119b81bea rules and descriptions updates 2017-06-19 19:45:25 +02:00
jcfrog 832ee5991c wild tamerlane files first commit 2017-06-19 18:09:53 +02:00
jcfrog 676c3a8a56 removed 'in' notation 2017-06-19 18:08:35 +02:00
jcfrog 77ea33c020 + wild tamerlane 3d visual 2017-06-19 18:07:37 +02:00
jerome choain 22876ee813 Merge branch 'master' of https://github.com/jcfrog/jocly 2017-06-19 17:54:24 +02:00
jerome choain 656277ff83 + wild tamerlane thumb and 3d visual 2017-06-19 17:53:45 +02:00
mig 4b284ec90b move to 0.9.11 2017-06-19 11:29:31 +02:00
Michel Gutierrez 36322fd902 Merge pull request #3 from jcfrog/master
Terachess
2017-06-19 10:57:09 +02:00
jcfrog 250e9d2001 Tera+Giga : Removed P abbrev for pawns but added a fenAbbrev P 2017-06-18 17:28:25 +02:00
jcfrog 23dbe33464 gigachess start position illustration path fixed 2017-06-18 17:21:04 +02:00
jcfrog 4482eb45fc fixed wrong start position for gigachess rules. Illustration was missing. 2017-06-18 17:13:54 +02:00
jcfrog e8bdf6c054 adding gigachess files 2017-06-18 16:44:40 +02:00
jcfrog 0190c1c651 Merge branch 'master' of https://github.com/jcfrog/jocly 2017-06-18 16:26:08 +02:00
jcfrog c2a3146339 Gigachess thumb added 2017-06-18 16:25:22 +02:00
jcfrog 5b86fd34fe 3d visual for gigagchess 2017-06-18 16:24:30 +02:00
jcfrog 12aaf4931a adding gigachess entry in chess games definition file 2017-06-18 10:49:26 +02:00
jcfrog c2baab5e3b Promotion table : camel was missing. Fixed. 2017-06-18 09:58:26 +02:00
jcfrog 2421d2693a Error in promotions table, prince promotes to amazon, not queen. Fixed. 2017-06-18 09:29:49 +02:00
jcfrog 6b35b34b27 rules updated 2017-06-16 23:52:13 +02:00
jcfrog 93acc32024 utf chars bug fixed 2017-06-16 23:48:31 +02:00
jcfrog 639ed7202c centering andformating promotion table 2017-06-16 23:47:23 +02:00
jcfrog 42928a6aca update jump and slides for some pieces 2017-06-16 22:47:12 +02:00
jcfrog 8d91c4e9d0 fixed path bug for new fairy pieces 2017-06-15 21:55:17 +02:00
jerome choain 30760c5bab rules updated with promo table and better template 2017-06-15 19:03:13 +02:00
jerome choain 25787b5713 all graphs properly croped 2017-06-15 19:01:34 +02:00
jerome choain 3ff0e9f3db resized 3d visual to 600x600 2017-06-15 18:29:32 +02:00
jerome choain d3dd80dec6 updated terachess thumb 2017-06-15 18:28:35 +02:00
jerome choain cd9f39f6b2 description updated 2017-06-15 17:33:10 +02:00
jerome choain ebfbada4d6 adding rules + description + visual resources 2017-06-15 17:30:11 +02:00
jerome choain c765691454 credits updated 2017-06-14 19:10:02 +02:00
jerome choain 9be43c2b02 icons for 10 new fairy pieces 2017-06-14 19:09:37 +02:00
jcfrog 597e57c2a1 terachess game files creation
game implementation ok, all related files (desc, rules, thumb, ...) to be updated
2017-06-14 16:29:05 +02:00
jcfrog 7171ccbbba all .json files renamed to .js + creation of terachess in index.js 2017-06-14 15:31:31 +02:00
jcfrog 282c504e66 .json extensions changed to .js for 3d files 2017-06-14 15:23:12 +02:00
jcfrog c2f26b2781 adding 3D resources for 10 new fairy pieces 2017-06-14 10:52:40 +02:00
jcfrog 908533070a 10 new pieces sprites added 2017-06-14 10:31:44 +02:00
mig 10838e81cc removed unstable api warning 2017-05-26 00:29:36 +02:00
mig fd4eae3a9a fixed calling engine with moves not defined 2017-05-22 12:31:59 +02:00
mig 1624f3f89c removed halloween draughts 2017-05-21 22:34:39 +02:00
mig 1fe9fab785 use kalman filter for spinning 2017-05-19 22:25:30 +02:00
mig d7ce85d358 updated rules 2017-05-19 22:06:59 +02:00
mig d1525b241b added suicide checkers 2017-05-18 00:14:08 +02:00
mig 86796f8d14 moved to 0.9.10 2017-05-17 22:45:02 +02:00
mig 531d33a56f added losing chess 2017-05-17 22:44:20 +02:00
mig 87c59055e3 added cubic chess (no) rules notice 2017-05-17 17:53:57 +02:00
mig d9f25de47c moved to 0.9.9 2017-05-17 17:37:43 +02:00
mig 161626ea9a removed unused file 2017-05-17 16:05:49 +02:00
mig dd34506c8a do not auto-stop dolly 2017-05-17 16:05:39 +02:00
mig 245977c2e8 do not use es2015 here 2017-05-17 16:03:45 +02:00
Michel Gutierrez 9b1b8252bb Merge pull request #1 from jcfrog/master
white cube board fixed
2017-05-17 13:12:52 +02:00
jerome choain 2392a87d42 white cube board fixed
emissive removed + shininess and lights properly set
2017-05-17 11:53:01 +02:00
mig c75582324b moved to 0.9.8 2017-05-17 10:29:02 +02:00
mig 1cda0a1f01 moved to 0.9.7 2017-05-17 09:46:12 +02:00
mig 0ee5ff55e2 added camera view controls 2017-05-17 09:43:27 +02:00
mig f8e7f51250 formatted code 2017-05-13 18:26:59 +02:00
mig 9a545e5da2 allow setting quality when capturing image 2017-05-13 18:26:33 +02:00
mig 8ebdd980ca fixed mana generatemoves 2017-05-12 16:57:11 +02:00
mig 48fd8c6e72 allow snapshots in jpeg format 2017-05-11 22:38:01 +02:00
mig dd07e5cf9b fixed generate moves 2017-05-11 15:30:28 +02:00
mig 2c6056005c added taking 3D board snapshots 2017-05-11 14:41:45 +02:00
mig 3a034e5880 allow filtering out obsolete games 2017-05-11 11:42:52 +02:00
mig d2fcdfc825 allow building only specific games 2017-05-11 11:37:22 +02:00
mig f1db68390a allow choosing what game modules to include 2017-05-11 11:13:03 +02:00
mig 72054d4f8e use relative url to panorama image 2017-05-10 15:54:48 +02:00
mig f137f3a70a added panorama 2017-05-10 14:27:51 +02:00
mig 8f9153c23f added visual support for oculus touch 2017-05-08 18:10:29 +02:00
mig 7eab2185ba ensure left hand holds the board 2017-05-08 12:16:16 +02:00
mig 34f7b29d89 moved to 0.9.6 2017-05-08 11:34:05 +02:00
mig 96f70ca038 german draughts are not instant capture remove 2017-05-07 00:59:05 +02:00
mig 9f7e976214 Merge branch 'master' of github.com:mi-g/jocly 2017-05-06 17:47:13 +02:00
mig 48a2c2413e moved to 0.9.5 2017-05-06 17:44:55 +02:00
mig fbc96d4273 moved to 0.9.6 2017-05-06 17:43:26 +02:00
mig a5b208b7fc moved to 0.9.4 2017-05-06 16:46:57 +02:00
mig 406ac569a1 lonely king is loss 2017-05-06 10:24:27 +02:00
mig 840cf4e566 fixed metamachy 2017-05-06 10:02:20 +02:00
mig bccacc59e0 ensures viewAs is properly initialized 2017-05-06 09:55:35 +02:00
mig b8cccb5825 fixed alquerque roman summary 2017-05-06 09:02:30 +02:00
mig 88e2b1119c update on alquerque 2017-05-06 01:21:49 +02:00
mig 5e77e63b7a make captureInstantRemove not only about pivots 2017-05-05 17:34:11 +02:00
mig 45c861cb33 fixed king appearing at the middle of the board 2017-05-05 16:32:50 +02:00
mig 457cd7bd28 secured 'for var in' cases 2017-05-05 14:32:55 +02:00
mig 6c90a2376e ensure no warning on jshint 2017-05-05 11:02:14 +02:00
mig 174f1f0b4f secured 'for var in' 2017-05-04 00:52:28 +02:00
mig 05af43b76a report obsolete games in listGames 2017-05-03 10:38:38 +02:00
mig 769aeeb276 reduced index.js using variables 2017-05-01 07:19:06 +02:00
mig c01199290a better install and usage description 2017-04-30 18:22:01 +02:00
mig 2c7f89a2ec added link to joclyboard 2017-04-30 11:47:15 +02:00
mig 603b91e34b fixed syntax 2017-04-30 02:19:44 +02:00
mig 53195e0d9a moved to 0.9.3 2017-04-30 02:17:57 +02:00
mig 9961da66df fixed css files as string 2017-04-30 02:16:27 +02:00
mig 160a904e52 secured 'for var in' issue 2017-04-30 01:53:54 +02:00
mig 2e223d2e9e secured 'for var in' issue 2017-04-30 01:33:56 +02:00
mig bef707c8ce secure 'for var in' issue 2017-04-30 00:51:25 +02:00
mig bba07ac93a secured 'for var in' 2017-04-29 18:41:41 +02:00
mig 3825638be3 rescaled images 2017-04-28 18:45:03 +02:00
mig efad26bee2 renamed skins 2017-04-28 18:44:49 +02:00
mig 9e41c905b4 default view as player A 2017-04-28 17:44:54 +02:00
mig 9c6355f580 ignore npm-debug.log 2017-04-28 17:29:22 +02:00
mig a35d9df03a removed trace 2017-04-28 16:53:53 +02:00
mig a1c4976e83 use setViewOptions over viewAs 2017-04-28 16:53:08 +02:00
mig edc2937d1a fixed image not power of 2 2017-04-28 16:51:33 +02:00
mig d2ea2dc4e0 added missing css for 2D 2017-04-28 16:43:29 +02:00
mig 298383fe25 version to 0.9.2 2017-04-28 16:32:46 +02:00
mig 0893c19f23 added getAvailableSkins() 2017-04-28 16:32:25 +02:00
mig 6dea674e30 removed console trace 2017-04-28 16:31:58 +02:00
mig ff4f9e641e 1.0.0 2017-04-27 14:57:19 +02:00
281 changed files with 82877 additions and 27253 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ node_modules/
dist/
update-gh-pages.sh
tmp/
npm-debug.log

View file

@ -1,7 +1,4 @@
**Warning: This is work in progress, APIs are subject to changes
until Jocly is released as version 1.0.0**
Jocly is a library and set of tools to integrate boards games into Web environments.
It comes with a large collection of abstract strategy games, 2D and 3D user interface,
artificial intelligence to play against.
@ -12,16 +9,44 @@ Demos
[Controlled interface](https://mi-g.github.io/jocly/examples/browser/control.html) for playing Chess.
Click _**Other Jocly games**_ to switch to other games.
Simple human vs computer: [Classic chess](https://mi-g.github.com/jocly/examples/browser/simple.html?classic-chess),
[Circular chess](https://mi-g.github.com/jocly/examples/browser/simple.html?circular-chess),
[Multi layers chess](https://mi-g.github.com/jocly/examples/browser/simple.html?raumschach),
[Hexagonal chess](https://mi-g.github.com/jocly/examples/browser/simple.html?glinski-chess),
[Chinese chess](https://mi-g.github.com/jocly/examples/browser/simple.html?xiangqi),
[Middle-age chess](https://mi-g.github.com/jocly/examples/browser/simple.html?courier-chess),
[Scrum](https://mi-g.github.com/jocly/examples/browser/simple.html?scrum)
Simple human vs computer: [Classic chess](https://mi-g.github.com/jocly/examples/browser/simple.html?game=classic-chess),
[Circular chess](https://mi-g.github.com/jocly/examples/browser/simple.html?game=circular-chess),
[Multi layers chess](https://mi-g.github.com/jocly/examples/browser/simple.html?game=raumschach),
[Hexagonal chess](https://mi-g.github.com/jocly/examples/browser/simple.html?game=glinski-chess),
[Chinese chess](https://mi-g.github.com/jocly/examples/browser/simple.html?game=xiangqi),
[Middle-age chess](https://mi-g.github.com/jocly/examples/browser/simple.html?game=courier-chess),
[Scrum](https://mi-g.github.com/jocly/examples/browser/simple.html?game=scrum)
Or see and try [all available games](https://mi-g.github.com/jocly/examples/browser/multiple.html)
[JoclyBoard](https://github.com/mi-g/joclyboard) is a multi-platform desktop application based on Jocly
and [Electron](https://electron.atom.io/).
Install
-------
````
npm install jocly
````
Using Jocly in a Web page
-------------------------
Insert this line to your HTML source code:
````
<script src="node_modules/jocly/dist/browser/jocly.js"></script>
````
You are now ready to use the Jocly API through the `Jocly` global object.
Using Jocly in a node.js application
------------------------------------
````Javascript
const Jocly = require("jocly");
````
You are now ready to use the Jocly API through the `Jocly` entry point.
Building
--------
@ -34,33 +59,11 @@ Building
- build: `gulp build`
- `dist/browser` contains the javascript library to build web applications, `dist/node` is the module to be used for node.js applications
Using Jocly in a Web page
-------------------------
After building Jocly, copy the `dist/browser/` directory as `jocly/` into your project filesystem.
Insert this line to your HTML source code:
````
<script src="jocly/jocly.js"></script>
````
You are now ready to use the Jocly API through the `Jocly` global object.
Using Jocly in a node.js application
------------------------------------
After building Jocly, the `dist/node/` directory as the Jocly module:
````Javascript
const Jocly = require("../jocly/dist/node");
````
Or, you can figure out how to use [`npm link`](https://docs.npmjs.com/cli/link) and just do:
````Javascript
const Jocly = require("jocly");
````
You are now ready to use the Jocly API through the `Jocly` entry point.
Notes:
- using `gulp build watch` instead of `gulp build` makes *gulp* start watching files after the build. Whenever a file is changed, a build is automatically generated
- you can use `--no-default-games` to prevent including the game modules from directory, and `--modules <colon-separated-directories>` to specify additional game modules to include. For instance, `gulp --no-default-games --modules src/games/chessbase:src/games/checkers build` will only generate distribution for Chess and checkers games
- you can specify the games to be built in the distribution with the `--games` option. For instance, `gulp --no-default-games --modules src/games/chessbase --games xiangqi:classic-chess build` only generates Jocly for Classic Chess and XiangQi
- using the `no-obsolete` option filters out the games marked as obsolete
API Documentation
-----------------

View file

@ -30,6 +30,7 @@
<button id="save">Save</button>
<input type="file" id="fileElem" accept="application/json" style="display:none"/>
<button id="load">Load</button>
<button id="snapshot">Snapshot</button>
<br/><br/>
<select id="mode">
<option value="self-self">Self / Self</option>
@ -70,6 +71,17 @@
<label id="anaglyph" for="anaglyph-input">
<input id="anaglyph-input" type="checkbox"/> Anaglyph view<br/>
</label>
<label id="panorama" for="panorama-select">
Panorama 360
<input type="file" id="file360Elem" accept="application/json" style="display:none"/>
<button id="panorama-button">Local</button>
<select id="panorama-select">
<option value="">--</option>
<option value="cabin">Cabin</option>
<option value="factory">Factory</option>
<option value="earth">Earth</option>
</select>
</label>
</div>
<div id="links">

View file

@ -225,7 +225,9 @@ $(document).ready(function () {
else if(playerMode=="player-b")
player = Jocly.PLAYER_B;
if(player)
match.viewAs(player)
match.setViewOptions({
viewAs: player
})
.then( () => {
RunMatch(match,progressBar);
});
@ -276,6 +278,21 @@ $(document).ready(function () {
});
});
$("#snapshot").on("click",function() {
match.viewControl("takeSnapshot",{
format: "jpeg"
})
.then((snapshot)=>{
var a = document.createElement("a");
a.href = snapshot;
a.setAttribute("download",gameName+".jpg");
a.click();
})
.catch((error)=>{
console.warn("failed:",error);
})
});
// reading file locally
var fileElem = $("#fileElem").on("change",function() {
var fileReader = new FileReader();
@ -294,6 +311,27 @@ $(document).ready(function () {
fileElem[0].click();
});
// reading file locally
var file360Elem = $("#file360Elem").on("change",function() {
var fileReader = new FileReader();
fileReader.readAsDataURL(file360Elem[0].files[0]);
fileReader.onload = function(event) {
match.viewControl("setPanorama",{
pictureData: fileReader.result
})
}
})
$("#panorama-button").on("click",function() {
file360Elem[0].click();
});
$("#panorama-select").on("change",function() {
var options = {};
var which = $(this).val();
if(which)
options.pictureUrl = "../../panorama/"+which+".jpg";
match.viewControl("setPanorama",options);
});
$("#takeback").on("click",function() {
match.getPlayedMoves()
.then( (playedMoves) => {

View file

@ -1,5 +1,6 @@
/* jshint esversion:6 */
const path = require('path');
const fs = require('fs');
const gulp = require('gulp');
const debug = require('gulp-debug');
@ -22,16 +23,15 @@ const gulpif = require('gulp-if');
const gutil = require('gulp-util');
const modulifyHeaders = {
model:
`exports.model = Model = {
model:
`exports.model = Model = {
Game: {},
Board: {},
Move: {}
};
`
,
view:
`exports.view = View = {
`,
view:
`exports.view = View = {
Game: {},
Board: {},
Move: {}
@ -41,60 +41,84 @@ const modulifyHeaders = {
const allGames = {};
var moduleDirs = [];
var modulesMap = {};
var exclusiveGames = null;
if (typeof argv.defaultGames == "undefined" || argv.defaultGames)
moduleDirs = fs.readdirSync("src/games").map((dir) => {
return path.join("src/games", dir);
});
if (argv.modules)
moduleDirs = moduleDirs.concat(argv.modules.split(":"));
moduleDirs.forEach((dir) => {
modulesMap[path.basename(dir)] = dir;
});
if (argv.games) {
exclusiveGames = {};
argv.games.split(":").forEach((game) => {
exclusiveGames[game] = true;
});
}
function HandleModuleGames(modelOnly) {
return through.obj(function(file,enc,next) {
// this is executed for every game module
var push = this.push.bind(this);
var moduleName = path.basename(file.path);
var moduleManifest = require(file.path);
var streams = [];
moduleManifest.games.forEach((game) => {
// this is executed for every game in the game module
return through.obj(function (file, enc, next) {
// this is executed for every game module
var push = this.push.bind(this);
var moduleName = path.basename(file.path);
var moduleManifest = require(file.path);
var streams = [];
moduleManifest.games.forEach((game) => {
// this is executed for every game in the game module
if(game.config.model.obsolete)
return;
if (exclusiveGames && !exclusiveGames[game.name])
return;
if (typeof argv.obsolete != "undefined" && !argv.obsolete && game.config.model.obsolete)
return;
// same some game data so we can list all games later
allGames[game.name] = {
title: game.config.model["title-en"],
summary: game.config.model.summary,
thumbnail: game.config.model.thumbnail,
module: moduleName
};
// same some game data so we can list all games later
allGames[game.name] = {
title: game.config.model["title-en"],
summary: game.config.model.summary,
thumbnail: game.config.model.thumbnail,
module: moduleName,
obsolete: game.config.model.obsolete
};
// create the game config file
push(new Vinyl({
path: moduleName+"/"+game.name+"-config.js",
contents: new Buffer('exports.config = '+JSON.stringify(game.config))
}));
// create the game config file
push(new Vinyl({
path: moduleName + "/" + game.name + "-config.js",
contents: new Buffer('exports.config = ' + JSON.stringify(game.config))
}));
// create some specified resources
if(!modelOnly) {
// create some specified resources
if (!modelOnly) {
var resources = {
model: ["thumbnail","rules","description","credits"],
model: ["thumbnail", "rules", "description", "credits"],
view: ["css"]
};
["model","view"].forEach((modelView)=>{
resources[modelView].forEach((field)=>{
["model", "view"].forEach((modelView) => {
resources[modelView].forEach((field) => {
var files = [];
switch(typeof game.config[modelView][field]) {
switch (typeof game.config[modelView][field]) {
case "string":
files.push(game.config[modelView][field]);
break;
case "object":
for(var f in game.config[modelView][field])
for (var f in game.config[modelView][field])
files.push(game.config[modelView][field][f]);
break;
}
files = files.map((file)=>{
return "src/games/"+moduleName+"/"+file;
files = files.map((file) => {
return path.join(modulesMap[moduleName], file);
});
var stream = gulp.src(files)
.pipe(rename(function(path) {
.pipe(rename(function (path) {
path.dirname = moduleName;
}))
.pipe(through.obj(function(file,enc,next) {
.pipe(through.obj(function (file, enc, next) {
push(file);
next();
}))
@ -104,232 +128,235 @@ function HandleModuleGames(modelOnly) {
});
}
// create model and view script files
function Scripts(which) {
var scripts = game[which+"Scripts"].map((script) => {
return "src/games/"+moduleName+"/"+script;
});
var fileName = moduleName+"/"+game.name+"-"+which+".js";
var stream = gulp.src(scripts)
.pipe(gulpif(!argv.prod,sourcemaps.init()))
.pipe(add('_',modulifyHeaders[which],true))
// create model and view script files
function Scripts(which) {
var scripts = game[which + "Scripts"].map((script) => {
return path.join(modulesMap[moduleName], script);
});
var fileName = moduleName + "/" + game.name + "-" + which + ".js";
var stream = gulp.src(scripts)
.pipe(gulpif(!argv.prod, sourcemaps.init()))
.pipe(add('_', modulifyHeaders[which], true))
.pipe(concat(fileName))
.pipe(gulpif(argv.prod,uglify()))
.pipe(gulpif(argv.prod, uglify()))
.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
.pipe(gulpif(!argv.prod,sourcemaps.write('.')))
.pipe(through.obj(function(file,enc,next) {
push(file);
next();
}))
streams.push(stream);
}
if(modelOnly)
Scripts("model");
else
["model","view"].forEach(Scripts);
});
.pipe(gulpif(!argv.prod, sourcemaps.write('.')))
.pipe(through.obj(function (file, enc, next) {
push(file);
next();
}));
streams.push(stream);
}
if (modelOnly)
Scripts("model");
else
["model", "view"].forEach(Scripts);
});
// create module common resources
if(!modelOnly) {
var stream = gulp.src("src/games/"+moduleName+"/res/**/*")
.pipe(rename(function(path) {
path.dirname = moduleName + "/res/" +path.dirname;
}))
.pipe(through.obj(function(file,enc,next) {
push(file);
next();
}))
;
streams.push(stream);
}
// create module common resources
if (!modelOnly) {
var stream = gulp.src(modulesMap[moduleName] + "/res/**/*")
.pipe(rename(function (path) {
path.dirname = moduleName + "/res/" + path.dirname;
}))
.pipe(through.obj(function (file, enc, next) {
push(file);
next();
}))
;
streams.push(stream);
}
merge(streams)
.on("finish",function() {
next();
})
});
merge(streams)
.on("finish", function () {
next();
});
});
}
gulp.task("build-node-games",function() {
return gulp.src("src/games/*")
.pipe(HandleModuleGames(true))
.pipe(gulp.dest("dist/node/games"));
gulp.task("build-node-games", function () {
return gulp.src(moduleDirs)
.pipe(HandleModuleGames(true))
.pipe(gulp.dest("dist/node/games"));
});
function ProcessJS(stream,concatName,skipBabel) {
if(!argv.prod)
stream = stream.pipe(sourcemaps.init());
if(!skipBabel)
stream = stream.pipe(babel({
presets: ['es2015'],
compact: !!argv.prod
}));
if(argv.prod)
stream = stream.pipe(uglify())
.on('error', function(err) {
gutil.log(gutil.colors.red('[Error]'), err.toString());
this.emit('end');
})
if(concatName)
stream = stream.pipe(concat(concatName));
if(!argv.prod)
stream = stream.pipe(sourcemaps.write("."));
return stream;
function ProcessJS(stream, concatName, skipBabel) {
if (!argv.prod && concatName)
stream = stream.pipe(sourcemaps.init());
if (!skipBabel)
stream = stream.pipe(babel({
presets: ['es2015'],
compact: !!argv.prod
}));
if (argv.prod)
stream = stream.pipe(uglify())
.on('error', function (err) {
gutil.log(gutil.colors.red('[Error]'), err.toString());
this.emit('end');
});
if (concatName)
stream = stream.pipe(concat(concatName));
if (!argv.prod && concatName)
stream = stream.pipe(sourcemaps.write("."));
return stream;
}
gulp.task("build-node-core",function() {
gulp.task("build-node-core", function () {
var joclyCoreStream =
ProcessJS(gulp.src([
"src/core/jocly.core.js",
]));
var joclyCoreStream =
ProcessJS(gulp.src([
"src/core/jocly.core.js",
]));
var joclyBaseStream =
ProcessJS(gulp.src([
"src/core/jocly.util.js",
"src/core/jocly.uct.js",
"src/core/jocly.game.js"
]));
var joclyBaseStream =
ProcessJS(gulp.src([
"src/core/jocly.util.js",
"src/core/jocly.uct.js",
"src/core/jocly.game.js"
]));
var allGamesStream = source('jocly-allgames.js');
allGamesStream.end('exports.games = '+JSON.stringify(allGames));
allGamesStream = ProcessJS(allGamesStream.pipe(buffer()));
var allGamesStream = source('jocly-allgames.js');
allGamesStream.end('exports.games = ' + JSON.stringify(allGames));
allGamesStream = ProcessJS(allGamesStream.pipe(buffer()));
return merge(joclyCoreStream,allGamesStream,joclyBaseStream)
.pipe(gulp.dest("dist/node"));
return merge(joclyCoreStream, allGamesStream, joclyBaseStream)
.pipe(gulp.dest("dist/node"));
})
});
function CopyLicense(target) {
return gulp.src(["COPYING.md","CONTRIBUTING.md","AGPL-3.0.txt"])
.pipe(gulp.dest(target));
return gulp.src(["COPYING.md", "CONTRIBUTING.md", "AGPL-3.0.txt"])
.pipe(gulp.dest(target));
}
gulp.task("copy-browser-license",function() {
return CopyLicense("dist/browser");
gulp.task("copy-browser-license", function () {
return CopyLicense("dist/browser");
});
gulp.task("copy-node-license",function() {
return CopyLicense("dist/node");
gulp.task("copy-node-license", function () {
return CopyLicense("dist/node");
});
gulp.task("build-node",function(callback) {
runSequence("build-node-games",["build-node-core","copy-node-license"],callback);
gulp.task("build-node", function (callback) {
runSequence("build-node-games", ["build-node-core", "copy-node-license"], callback);
});
gulp.task("build-browser-games",function() {
return gulp.src("src/games/*")
.pipe(HandleModuleGames(false))
.pipe(gulp.dest("dist/browser/games"));
gulp.task("build-browser-games", function () {
return gulp.src(moduleDirs)
.pipe(HandleModuleGames(false))
.pipe(gulp.dest("dist/browser/games"));
});
gulp.task("build-browser-core",function() {
var _ProcessJS = function(s) { return s; }
gulp.task("build-browser-core", function () {
var b = browserify({
entries: "src/browser/jocly.js",
debug: true,
standalone: "Jocly"
});
var _ProcessJS = function (s) { return s; };
var joclyBrowserStream = ProcessJS(b.bundle()
.pipe(source('jocly.js'))
.pipe(buffer()));
var b = browserify({
entries: "src/browser/jocly.js",
debug: true,
standalone: "Jocly"
});
var joclyCoreStream = ProcessJS(gulp.src([
"src/core/jocly.core.js",
]));
var joclyBrowserStream = ProcessJS(b.bundle()
.pipe(source('jocly.js'))
.pipe(buffer()));
var joclyBaseStream = ProcessJS(gulp.src([
"src/core/jocly.util.js",
"src/core/jocly.uct.js",
"src/core/jocly.game.js"
]),"jocly.game.js",true);
var joclyCoreStream = ProcessJS(gulp.src([
"src/core/jocly.core.js",
]));
var joclyExtraScriptsStream = ProcessJS(gulp.src([
"src/browser/jocly.aiworker.js",
"src/browser/jocly.embed.js"
]));
var joclyBaseStream = ProcessJS(gulp.src([
"src/core/jocly.util.js",
"src/core/jocly.uct.js",
"src/core/jocly.game.js"
]), "jocly.game.js", true);
var joclyExtraStream = gulp.src([
"src/browser/jocly.embed.html"
]);
var joclyExtraScriptsStream = ProcessJS(gulp.src([
"src/browser/jocly.aiworker.js",
"src/browser/jocly.embed.js"
]));
var joclyResStream = gulp.src("src/browser/res/**/*")
.pipe(rename(function(path) {
path.dirname = "res/"+path.dirname;
}));
var joclyExtraStream = gulp.src([
"src/browser/jocly.embed.html"
]);
var allGamesStream = source('jocly-allgames.js');
allGamesStream.end('exports.games = '+JSON.stringify(allGames));
allGamesStream = ProcessJS(allGamesStream.pipe(buffer()));
var joclyResStream = gulp.src("src/browser/res/**/*")
.pipe(rename(function (path) {
path.dirname = "res/" + path.dirname;
}));
return merge(joclyBrowserStream,joclyCoreStream,allGamesStream,joclyBaseStream,
joclyExtraStream,joclyExtraScriptsStream,joclyResStream)
.pipe(gulp.dest("dist/browser"));
var allGamesStream = source('jocly-allgames.js');
allGamesStream.end('exports.games = ' + JSON.stringify(allGames));
allGamesStream = ProcessJS(allGamesStream.pipe(buffer()));
return merge(joclyBrowserStream, joclyCoreStream, allGamesStream, joclyBaseStream,
joclyExtraStream, joclyExtraScriptsStream, joclyResStream)
.pipe(gulp.dest("dist/browser"));
});
gulp.task("build-browser-xdview",function() {
const lib = "third-party/";
const src = "src/";
const srcLib = "src/lib/";
const nmLib = "node_modules/";
gulp.task("build-browser-xdview", function () {
const lib = "third-party/";
const src = "src/";
const srcLib = "src/lib/";
const nmLib = "node_modules/";
var libs = ProcessJS(gulp.src([
lib+"three.js",
nmLib+"jquery/dist/jquery.js"
]));
var libs = ProcessJS(gulp.src([
lib + "three.js",
nmLib + "jquery/dist/jquery.js"
]));
var packedLibs = ProcessJS(gulp.src([
lib+"SubdivisionModifier.js",
lib+"tween.js",
lib+"tween.fix.js",
srcLib+"JoclyOrbitControls.js",
lib+"DeviceOrientationControls.js",
lib+"Projector.js",
lib+"threex.domevent.js",
lib+"threex.domevent.object3d.js",
lib+"StereoEffect.js",
lib+"AnaglyphEffect.js",
srcLib+"VRGamepad.js",
lib+"VRControls.js",
lib+"VREffect.js",
src+"browser/jocly.ar.js",
src+"browser/jocly.state-machine.js",
src+"browser/jocly.xd-view.js"
]),"jocly-xdview.js",true);
var packedLibs = ProcessJS(gulp.src([
lib + "SubdivisionModifier.js",
lib + "tween.js",
lib + "tween.fix.js",
srcLib + "JoclyOrbitControls.js",
lib + "DeviceOrientationControls.js",
lib + "Projector.js",
lib + "threex.domevent.js",
lib + "threex.domevent.object3d.js",
lib + "StereoEffect.js",
lib + "AnaglyphEffect.js",
srcLib + "VRGamepad.js",
lib + "VRControls.js",
lib + "VREffect.js",
lib + "OBJLoader.js",
lib + "MTLLoader.js",
lib + "kalman.js",
src + "browser/jocly.ar.js",
src + "browser/jocly.state-machine.js",
src + "browser/jocly.xd-view.js"
]), "jocly-xdview.js", true);
return merge(libs,packedLibs)
.pipe(gulp.dest("dist/browser"))
;
return merge(libs, packedLibs)
.pipe(gulp.dest("dist/browser"))
;
});
gulp.task("build-browser",function(callback) {
runSequence("build-browser-games",["build-browser-core",
"build-browser-xdview","copy-browser-license"],callback);
gulp.task("build-browser", function (callback) {
runSequence("build-browser-games", ["build-browser-core",
"build-browser-xdview", "copy-browser-license"], callback);
});
gulp.task("build",function(callback) {
runSequence("clean",["build-browser","build-node"],callback);
gulp.task("build", function (callback) {
runSequence("clean", ["build-browser", "build-node"], callback);
});
gulp.task("clean",function() {
return del(["dist/*"],{force:true});
gulp.task("clean", function () {
return del(["dist/*"], { force: true });
});
gulp.task("watch",function() {
gulp.watch("src/games/**/*",["build-node-games","build-browser-games"]);
gulp.watch("src/{browser,core,lib}/**/*",["build-browser-core","build-browser-xdview"]);
gulp.watch("src/{node,core}/**/*",["build-node-core"]);
gulp.task("watch", function () {
gulp.watch(moduleDirs.map((dir) => { return dir + "/**/*"; }), ["build-node-games", "build-browser-games"]);
gulp.watch("src/{browser,core,lib}/**/*", ["build-browser-core", "build-browser-xdview"]);
gulp.watch("src/{node,core}/**/*", ["build-node-core"]);
});
gulp.task("help", function() {
var help = `
gulp.task("help", function () {
var help = `
usage: gulp [<commands>] [<options>]
commands:
@ -338,7 +365,11 @@ commands:
options:
--prod: generate for production
--no-default-games: do not process game module from default src/games directory
--modules <modules>: process additional game modules from specified directories (colon separated)
--games <games>: process exclusively the specified games (colon separated)
--no-obsolete: do not include games marked as obsolete
`;
console.log(help);
process.exit(0);
console.log(help);
process.exit(0);
});

View file

@ -1,15 +1,15 @@
{
"name": "jocly",
"version": "0.9.1",
"version": "0.9.12",
"description": "Board games 3D/2D UI and AI web library",
"keywords": [
"board games",
"chess",
"draughts",
"variants",
"webgl",
"webvr",
"javascript"
"board games",
"chess",
"draughts",
"variants",
"webgl",
"webvr",
"javascript"
],
"homepage": "https://github.com/mi-g/jocly",
"bugs": "https://github.com/mi-g/jocly/issues",
@ -21,8 +21,8 @@
},
"main": "dist/node/jocly.core.js",
"repository": {
"type": "git",
"url": "https://github.com/mi-g/jocly.git"
"type": "git",
"url": "https://github.com/mi-g/jocly.git"
},
"scripts": {
"build": "gulp build --prod"
@ -50,7 +50,7 @@
"dependencies": {
"systemjs": "^0.20.10"
},
"engines" : {
"node" : ">=5.10.1"
}
"engines": {
"node": ">=5.10.1"
}
}

BIN
panorama/cabin.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 KiB

BIN
panorama/earth.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

BIN
panorama/factory.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 KiB

View file

@ -0,0 +1,79 @@
# Blender MTL File: 'oculus-touch-controller-left.blend'
# Material Count: 7
newmtl body
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonHand
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonMenu
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonTrigger
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonX
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonY
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl stick
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
# Blender MTL File: 'oculus-touch-controller.right.blend'
# Material Count: 7
newmtl body
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonA
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonB
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonHand
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonHome
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl buttonTrigger
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png
newmtl stick
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd external_controller01_col.png

File diff suppressed because it is too large Load diff

View file

@ -1010,6 +1010,29 @@
return ProxiedMethod(this, "resetView");
}
// experimental
GameProxy.prototype.getAvailableSkins = function () {
if (jsContext == "node")
return Promise.reject(new Error("resetView(): not supported in node.js"));
if (this.game) {
var self = this;
var supports3D = ( function () {
try {
return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' );
}
catch( e ) {
return false;
}
} )();
return Promise.resolve(
this.game.mViewOptions.skins.filter((skin)=>{
return supports3D || !skin["3d"];
})
)
} else
return ProxiedMethod(this, "getAvailableSkins");
}
exports._createInternalGame = CreateInternalGame; // do not use this
exports.PLAYER_A = 1;

View file

@ -92,6 +92,8 @@ JocGame.prototype.Init = function(aOptions) {
this.mVisitedBoards = {};
if(typeof(this.mOptions.viewAs)!="undefined")
this.mViewAs = this.mOptions.viewAs;
else
this.mOptions.viewAs = this.mViewAs;
}
this.mNextSchedule = null;
this.mPlayedMoves = [];
@ -159,14 +161,15 @@ JocGame.prototype.PlayMove = function(move) {
self.mOldBoard=new (self.GetBoardClass())(self);
self.mOldBoard.CopyFrom(self.mBoard);
self.ApplyMove(move);
var moveShown = self.mBoard.PlayedMove(self,move);
if(moveShown)
self.MoveShown = function() {
delete self.MoveShown;
resolve();
else
self.MoveShown = function() {
delete self.MoveShown;
resolve();
}
}
var moveShown = self.mBoard.PlayedMove(self,move);
if(moveShown) {
delete self.MoveShown;
resolve();
}
});
return promise;
}
@ -289,7 +292,6 @@ JocGame.prototype.InitView = function() {
JocGame.prototype.LoadCss = function() {
var styles = document.querySelectorAll("head link[class='jocly-css']");
styles.forEach(function(style) {
console.info("removing style",style.getAttribute("href"));
style.parentNode.removeChild(style);
});
var self = this;
@ -746,6 +748,8 @@ JocGame.prototype.Engine = function(aBoard, aLevel, aBAlpha, aAlpha, aPotential)
context.mBoard.mFinished = false;
context.mBoard.mWinner = JocGame.DRAW;
this.mCurrentLevel=aLevel;
if(typeof context.mBoard.mMoves == "undefined")
context.mBoard.mMoves = [];
if(context.mBoard.mMoves.length==0)
context.mBoard.GenerateMoves(this);
@ -993,6 +997,7 @@ JocGame.prototype.BackTo = function(aIndex,moves) {
this.mBoard.InitialPosition(this);
if(this.mInitial && this.mInitial.turn)
this.mWho = this.mInitial.turn;
this.mBoard.mMoves=[];
this.mBoard.mWho = this.mWho;
this.mBestMoves = [];
this.mVisitedBoards={};
@ -1031,6 +1036,7 @@ JocGame.prototype.ExportInitialBoardState = function(format) {
JocGame.prototype.Load = function(gameData) {
this.mWho = JocGame.PLAYER_A;
this.mBoard = new (this.GetBoardClass())(this);
this.mBoard.mMoves=[];
if(gameData.initialBoard) {
if(typeof this.Import!="function")

View file

@ -46,6 +46,4 @@ Model.Game.BuildGraphCoord = function() {
}
this.g.Graph=g;
this.g.Coord=coord;
this.g.compulsoryCatch=false;
}

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -827,15 +827,19 @@
}
PCOUNT=0;
for(var i in INITIAL.a)
PCOUNT++;
if(INITIAL.a.hasOwnProperty(i))
PCOUNT++;
for(var i in INITIAL.b)
PCOUNT++;
if(INITIAL.b.hasOwnProperty(i))
PCOUNT++;
} else {
var index=0;
for(var i in INITIAL.a)
CreatePiece(JocGame.PLAYER_A,index++);
if(INITIAL.a.hasOwnProperty(i))
CreatePiece(JocGame.PLAYER_A,index++);
for(var i in INITIAL.b)
CreatePiece(JocGame.PLAYER_B,index++);
if(INITIAL.b.hasOwnProperty(i))
CreatePiece(JocGame.PLAYER_B,index++);
PCOUNT=INITIAL.a.length+INITIAL.b.length;
}
@ -1677,8 +1681,10 @@
xdv.updateGadget("piece#"+captPiece,{
"2d": {
opacity : 0.3,
visible: !aGame.g.captureInstantRemove
},
"3d" : {
visible: !aGame.g.captureInstantRemove,
materials: {
"base" : {
opacity: .3,
@ -1700,23 +1706,24 @@
if(animCount==0)
callback();
}
for(var capt in capts) {
animCount++;
xdv.updateGadget("piece#"+capt,{
"2d": {
opacity: 0,
},
"3d": {
z: - SIZE*.24,
},
"turkish3d": {
z: - SIZE,
},
"kids3d": {
z: - SIZE*.5,
},
},500,EndAnim);
}
for(var capt in capts)
if(capts.hasOwnProperty(capt)) {
animCount++;
xdv.updateGadget("piece#"+capt,{
"2d": {
opacity: 0,
},
"3d": {
z: - SIZE*.24,
},
"turkish3d": {
z: - SIZE,
},
"kids3d": {
z: - SIZE*.5,
},
},500,EndAnim);
}
if(animCount==0)
callback();
}

View file

@ -66,10 +66,12 @@
this.g.drawKvs2K=true;
this.g.whiteStarts=true;
this.g.king180deg=false;
this.g.suicide=false;
if(this.mOptions.variant)
for(var k in this.mOptions.variant)
this.g[k]=this.mOptions.variant[k];
if(this.mOptions.variant.hasOwnProperty(k))
this.g[k]=this.mOptions.variant[k];
this.BuildGraphCoord();
@ -107,10 +109,12 @@
Model.Move.Init = function(args) {
//JocLog("Move.Init",args);
this.pos=[];
for(var i in args.pos)
var argsPos = args.pos ? Object.keys(args.pos).sort() : [];
for(var i=0; i<argsPos.length; i++)
this.pos.push(args.pos[i]);
this.capt=[];
for(var i in args.capt)
var captPos = args.capt ? Object.keys(args.capt).sort() : [];
for(var i=0; i<captPos.length; i++)
this.capt.push(args.capt[i]);
}
@ -237,34 +241,36 @@
this.kpCount[index01]++;
}
} else {
for(var i in INITIAL.a) {
var p=INITIAL.a[i];
var pos=p[0]*WIDTH+p[1];
var piece={
s: JocGame.PLAYER_A, // side
p: pos, // position
l: -1, // last position for this piece
t: 0, // piece type
plp: pos, // last position in move (for piece angle calculation)
};
this.pieces.push(piece);
this.board[pos]=index++;
this.zSign=aGame.zobrist.update(this.zSign,"board","1/0",pos);
}
for(var i in INITIAL.b) {
var p=INITIAL.b[i];
var pos=p[0]*WIDTH+p[1];
var piece={
s: JocGame.PLAYER_B, // side
p: pos, // position
l: -1, // last position for this piece
t: 0, // piece type
plp: pos, // last position in move (for piece angle calculation)
};
this.pieces.push(piece);
this.board[pos]=index++;
this.zSign=aGame.zobrist.update(this.zSign,"board","-1/0",pos);
}
for(var i in INITIAL.a)
if(INITIAL.a.hasOwnProperty(i)) {
var p=INITIAL.a[i];
var pos=p[0]*WIDTH+p[1];
var piece={
s: JocGame.PLAYER_A, // side
p: pos, // position
l: -1, // last position for this piece
t: 0, // piece type
plp: pos, // last position in move (for piece angle calculation)
};
this.pieces.push(piece);
this.board[pos]=index++;
this.zSign=aGame.zobrist.update(this.zSign,"board","1/0",pos);
}
for(var i in INITIAL.b)
if(INITIAL.b.hasOwnProperty(i)) {
var p=INITIAL.b[i];
var pos=p[0]*WIDTH+p[1];
var piece={
s: JocGame.PLAYER_B, // side
p: pos, // position
l: -1, // last position for this piece
t: 0, // piece type
plp: pos, // last position in move (for piece angle calculation)
};
this.pieces.push(piece);
this.board[pos]=index++;
this.zSign=aGame.zobrist.update(this.zSign,"board","-1/0",pos);
}
this.pCount=[INITIAL.a.length,INITIAL.b.length];
this.spCount=[INITIAL.a.length,INITIAL.b.length];
this.kpCount=[INITIAL.a.length,INITIAL.b.length];
@ -288,7 +294,7 @@
this.mMoves = [];
function EachPiece(fnt) {
for(var i in $this.pieces) {
for(var i=0;i<$this.pieces.length;i++) {
var piece=$this.pieces[i];
if(piece && piece.s==$this.mWho)
fnt(i,piece.p);
@ -317,7 +323,7 @@
}
if(aGame.g.canCaptureBackward || forward==true) {
var pos1=aGame.g.Graph[pos0][dir];
if(pos1!=null && ($this.board[pos1]==-1 || pos1==poss[0])) {
if(pos1!=null && ($this.board[pos1]==-1 || pos1==poss[0] || (pos1!==null && aGame.g.captureInstantRemove && capts.indexOf(pos1)>=0))) {
var keep=true;
for(var i=0;i<dirs.length;i++)
if((aGame.g.captureInstantRemove && capts[i]==pos0) ||
@ -365,7 +371,7 @@
pos0=aGame.g.Graph[pos0][dir];
}
} else {
while($this.board[pos0]==-1 || pos0==poss[0]) {
while($this.board[pos0]==-1 || pos0==poss[0] || (pos0!==null && aGame.g.captureInstantRemove && capts.indexOf(pos0)>=0)) {
var keep=true;
for(var i=0;i<dirs.length;i++)
if((aGame.g.captureInstantRemove && capts[i]==caught) ||
@ -494,6 +500,10 @@
this.mFinished=true;
this.mWinner=-this.mWho;
break;
case "win":
this.mFinished=true;
this.mWinner=this.mWho;
break;
default:
this.mFinished=true;
this.mWinner=JocGame.DRAW;
@ -505,7 +515,7 @@
var moves0=this.mMoves;
var moves1=[];
var bestLength=0;
for(var i in moves0) {
for(var i=0; i<moves0.length; i++) {
var move=moves0[i];
if(move.pos.length==bestLength)
moves1.push(move);
@ -557,12 +567,12 @@
if(this.pCount[1]==0) {
this.mFinished=true;
this.mWinner=JocGame.PLAYER_A;
this.mWinner=aGame.g.suicide ? JocGame.PLAYER_B : JocGame.PLAYER_A;
return;
}
if(this.pCount[0]==0) {
this.mFinished=true;
this.mWinner=JocGame.PLAYER_B;
this.mWinner=aGame.g.suicide ? JocGame.PLAYER_A : JocGame.PLAYER_B;
return;
}
@ -573,7 +583,7 @@
var HEIGHT=aGame.mOptions.height;
var rowSumA=0;
var rowSumB=0;
for(var i in this.pieces) {
for(var i=0; i<this.pieces.length; i++) {
var piece=this.pieces[i];
if(piece && piece.t==0) {
if(this.mWho==JocGame.PLAYER_A)
@ -583,6 +593,9 @@
}
}
this.mEvaluation += (rowSumA-rowSumB) * aGame.g.lastRowFactor;
if(aGame.g.suicide)
this.mEvaluation = -this.mEvaluation;
}
//JocLog("Evaluation",this.mEvaluation,this.pCount);
@ -646,17 +659,18 @@
this.zSign=aGame.zobrist.update(this.zSign,"board",piece.s+"/"+piece.t,pos);
var plp=move.capt[move.capt.length-1]
piece.plp=plp?plp:move.pos[move.pos.length-2];
for(var index in toBeRemoved) {
var piece0=this.pieces[index];
var other=(1-piece0.s)/2;
this.pCount[other]--;
switch(piece0.t) {
case 0: this.spCount[other]--; break;
case 1: this.kpCount[other]--; break;
for(var index in toBeRemoved)
if(toBeRemoved.hasOwnProperty(index)) {
var piece0=this.pieces[index];
var other=(1-piece0.s)/2;
this.pCount[other]--;
switch(piece0.t) {
case 0: this.spCount[other]--; break;
case 1: this.kpCount[other]--; break;
}
this.zSign=aGame.zobrist.update(this.zSign,"board",piece0.s+"/"+piece0.t,piece0.p);
this.pieces[index]=null;
}
this.zSign=aGame.zobrist.update(this.zSign,"board",piece0.s+"/"+piece0.t,piece0.p);
this.pieces[index]=null;
}
if(aGame.g.lastRowCrown && this.pieces[pIndex].t==0) {
var r=aGame.g.Coord[move.pos[move.pos.length-1]][0];
if((player==JocGame.PLAYER_A && r==HEIGHT-1) || (player==JocGame.PLAYER_B && r==0)) {
@ -773,7 +787,8 @@
});
var bestMatches=[];
for(var i in bestMatchesMap)
bestMatches.push(bestMatchesMap[i]);
if(bestMatchesMap.hasOwnProperty(i))
bestMatches.push(bestMatchesMap[i]);
if(bestMatches.length>0)
candidateMoves=bestMatches;
}
@ -801,41 +816,43 @@
colors[color][abbrev].pos.push(parseInt(PosToString(piece.p)));
}
});
for(var color in colors) {
var fenColorParts=[];
for(var abbrev in colors[color]) {
var pieceType=colors[color][abbrev];
if(pieceType.group) {
pieceType.pos.sort(function(pos1,pos2) {
return parseInt(pos1)-parseInt(pos2);
});
var last=-2, end=-1, start=-1;
pieceType.pos.forEach(function(pos) {
if(parseInt(pos)==last+1) {
end=pos;
} else {
if(end>=0) {
for(var color in colors)
if(colors.hasOwnProperty(color)) {
var fenColorParts=[];
for(var abbrev in colors[color])
if(colors[color].hasOwnProperty(abbrev)) {
var pieceType=colors[color][abbrev];
if(pieceType.group) {
pieceType.pos.sort(function(pos1,pos2) {
return parseInt(pos1)-parseInt(pos2);
});
var last=-2, end=-1, start=-1;
pieceType.pos.forEach(function(pos) {
if(parseInt(pos)==last+1) {
end=pos;
} else {
if(end>=0) {
fenColorParts.push(abbrev+start+"-"+end);
end=-1;
} else {
if(start>=0)
fenColorParts.push(abbrev+start);
}
start=pos;
}
last=parseInt(pos);
});
if(end>=0)
fenColorParts.push(abbrev+start+"-"+end);
end=-1;
} else {
if(start>=0)
fenColorParts.push(abbrev+start);
}
start=pos;
}
last=parseInt(pos);
});
if(end>=0)
fenColorParts.push(abbrev+start+"-"+end);
else if(start>=0)
fenColorParts.push(abbrev+start);
} else
pieceType.pos.forEach(function(pos) {
fenColorParts.push(abbrev+pos);
});
else if(start>=0)
fenColorParts.push(abbrev+start);
} else
pieceType.pos.forEach(function(pos) {
fenColorParts.push(abbrev+pos);
});
}
fenParts.push(color+fenColorParts.join(","));
}
fenParts.push(color+fenColorParts.join(","));
}
var fen=fenParts.join(":");
return fen;
}

View file

@ -200,11 +200,13 @@ View.Game.InitView=function() {
}
var index=0;
for(var i in INITIAL.a)
CreatePiece(JocGame.PLAYER_A,index++);
if(INITIAL.a.hasOwnProperty(i))
CreatePiece(JocGame.PLAYER_A,index++);
for(var i in INITIAL.b)
CreatePiece(JocGame.PLAYER_B,index++);
if(INITIAL.b.hasOwnProperty(i))
CreatePiece(JocGame.PLAYER_B,index++);
for(var i in this.g.Coord) {
for(var i=0; i<this.g.Coord.length; i++) {
var cCoord=this.g.Coord[i];
var r=cCoord[0];
var c=cCoord[1];
@ -370,10 +372,10 @@ View.Board.HumanTurn=function(aGame) {
});
}
var matchingMoves=[];
for(var i in moves) {
for(var i=0; i<moves.length; i++) {
var move=moves[i];
var keep=true;
for(var j in poss) {
for(var j=0; j<poss.length; j++) {
if(poss[j]!=move.pos[j]) {
keep=false;
break;
@ -385,27 +387,28 @@ View.Board.HumanTurn=function(aGame) {
var nextPoss={};
var nextCapts={};
for(var i in matchingMoves) {
for(var i=0; i<matchingMoves.length; i++) {
var move=matchingMoves[i];
nextPoss[move.pos[index]]=true;
nextCapts[move.pos[index]]=move.capt[index];
}
for(var npos in nextPoss) {
aGame.mWidget.find(".possible[jocpos="+npos+"]").show();
aGame.mWidget.find(".front[jocpos="+npos+"]").addClass("choice")
.bind(JocGame.CLICK,function() {
var pos=parseInt($(this).attr("jocpos"));
poss.push(pos);
capts.push(nextCapts[npos]);
if(index==0) {
pWidget=aGame.mWidget.find(".piece[jocindex="+$this.board[pos]+"]");
} else {
MovePiece(pos);
}
index++;
UpdateChoice();
});
}
for(var npos in nextPoss)
if(nextPoss.hasOwnProperty(npos)) {
aGame.mWidget.find(".possible[jocpos="+npos+"]").show();
aGame.mWidget.find(".front[jocpos="+npos+"]").addClass("choice")
.bind(JocGame.CLICK,function() {
var pos=parseInt($(this).attr("jocpos"));
poss.push(pos);
capts.push(nextCapts[npos]);
if(index==0) {
pWidget=aGame.mWidget.find(".piece[jocindex="+$this.board[pos]+"]");
} else {
MovePiece(pos);
}
index++;
UpdateChoice();
});
}
if(matchingMoves.length==1 && matchingMoves[0].pos.length==poss.length) {
aGame.mWidget.find(".front").removeClass("back");
setTimeout(function() {

View file

@ -0,0 +1,15 @@
<ul>
<li>Alfonso X of Castille (1221-1284) for writing the (somehow incomplete) rules of Alquerque for the first time.</li>
<li>Philip Mouskat (~1243) for mentionning the crowning rule.</li>
<li><a href="http://www.draughtshistory.nl/OpeningEngels.htm" target="_blank">Arie van der Stoep</a> for his proposal of those Aquerque rules</li>
</ul>
<h3>Jocly implementation</h3>
<ul>
<li>Development: Michel gutierrez (@<a target="_blank" href="http://twitter.com/_mig_">_mig_</a>)</li>
<li>Graphic design: Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>)</li>
</ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because it is too large Load diff

View file

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View file

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View file

@ -2,7 +2,8 @@
<p>
No one knows for sure the exact rules of Alquerque, the ancestor of all Draughts variants.
<a href="http://www.draughtshistory.nl/OpeningEngels.htm" target="_blank">Arie van der Stoep</a> has worked on the history
of Draughts since the 1970s and proposed this interpretation which might well be the original rules.
of Draughts since the 1970s and proposed this interpretation which might well be the original rules as played in Middle-East
and Spain in the 10th century.
</p>
<ul>
@ -17,6 +18,7 @@ of Draughts since the 1970s and proposed this interpretation which might well be
<li>A piece reaching the opposite row is promoted to a king</li>
<li>When possible, several captures can be performed at the same round (with the same piece)</li>
<li>Captures can not be performed backward, except by a king</li>
<li>Captures are not compulsory</li>
<li>A king can move along a line of free positions (long range king)</li>
<li>After capturing, the king can stop at any free position after the captured piece (no king halt)</li>
<li>A player not able to move any of his pieces loses the game</li>

View file

@ -0,0 +1,29 @@
<p>
No one knows for sure the exact rules of Alquerque, the ancestor of all Draughts variants.
<a href="http://www.draughtshistory.nl/OpeningEngels.htm" target="_blank">Arie van der Stoep</a> has worked on the history
of Draughts since the 1970s and proposed this interpretation which might well be the original rules as played in France
and England in the 15th century.
</p>
<ul>
<li>The board and initial position is the following:
<p style="text-align: center;"><img style="max-width:100%" src="{GAME}/res/rules/alquerque-start.jpg"/></p>
</li>
<li>Players take turn by moving one piece along the drawn lines</li>
<li>Pieces can move to an adjacent empty position, either forward or sideway</li>
<li>An adjacent opponent piece can be captured by jumping over it (which implies the next position is available)
<p style="text-align: center;"><img style="max-width:100%" src="{GAME}/res/rules/capture-alquerque.jpg"/></p>
</li>
<li>A piece reaching the opposite row is promoted to a king</li>
<li>When possible, several captures can be performed at the same round (with the same piece)</li>
<li>Captures can not be performed backward, except by a king</li>
<li>Captures are compulsory</li>
<li>A king can move forward or backward of one position (short range king)</li>
<li>After capturing, the king can stop at any free position after the captured piece (no king halt)</li>
<li>A player not able to move any of his pieces loses the game</li>
</ul>
<br/>
<p>Pieces: red vs black, promoted pieces have an extra white ring.</p>
<p style="text-align:center"><img style="max-width:100%" src="{GAME}/res/images/basic-alquerque2.png"/</p>

View file

@ -20,7 +20,7 @@
<li>Promoted pieces, called kings, can move along any diagonal</li>
<li>White starts</li>
<li>Capture is compulsory</li>
<li>Captured pieces are removed immediately after the capture</li>
<li>Captured pieces are removed at the end of the capture sequence</li>
<li>If a player must choose between several capture sequences, he can choose any sequence as long as it ends to a position where no more capture is possible</li>
<li>If a piece reaches the last line during a capture sequence, it is not promoted, unless the capture finishes on the last line</li>
<li>A player who cannot play any move loses the game</li>

View file

@ -0,0 +1,29 @@
<p>In all Draughts variants, the following rules apply:</p>
<ul>
<li>Players take turn by moving one piece</li>
<li>Pieces can move to an adjacent empty position</li>
<li>An adjacent opponent piece can be captured by jumping over it (which implies the next position is available)
<p style="text-align: center;"><img style="max-width:100%" src="{GAME}/res/rules/capture.jpg"/></p>
</li>
<li>When possible, several captures can be performed at the same round (with the same piece)</li>
</ul>
<p>In English Draughts, the additional rules also apply:</p>
<ul>
<li>The winner is the player that cannot play any move, either because
there is no piece left or all remaining pieces are blocked</li>
<li>The board and initial position is the following:
<p style="text-align: center;"><img style="max-width:100%" src="{GAME}/res/rules/brit-checkers-start.jpg"/></p>
</li>
<li>Pieces moves only on dark squares</li>
<li>Simple pieces can only move forward, even for capture</li>
<li>Promoted pieces, called kings, can move backward, but only to adjacent positions</li>
<li>After a capture, a king must stop just after the captured piece (unless it can do another capture)</li>
<li>Black starts</li>
<li>Capture is compulsory</li>
<li>Captured pieces are removed after all captures are done</li>
<li>If a piece reaches the last line during a capture sequence, it is not promoted, unless the capture finishes on the last line</li>
<li>A player who cannot play any move loses the game</li>
</ul>

View file

@ -26,6 +26,17 @@ View.Game.xdInitExtra = function(xdv) {
file : this.mViewOptions.fullPath + "/res/images/damier8x8green.jpg",
},
});
var $this = this;
var skins = this.mViewOptions.skins.filter(function(skin) {
return skin.name === $this.mSkin;
});
if(skins.length>0 && skins[0].preload) {
var resources = skins[0].preload.map(function(res) {
var m = /^(.*?\|)([^\|]*)$/.exec(res);
return m[1] + $this.mViewOptions.fullPath + m[2];
});
this.xdLoadResources(resources,function() {});
}
}
View.Board.CheckersAngle = function(aGame,piece,from,to) {

View file

@ -0,0 +1,9 @@
<h1>Credits</h1>
<pre>
Inventor: tilera
Developer: tilera
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>4Board Chess is a Chess Variants, where 4 Classic chess Boards stuckt together and 3 of the Kings be replaced by Fairy Pieces.</p>

View file

@ -0,0 +1,264 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(16,16);
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
epTarget: true,
initial: [{s:1,p:16},{s:1,p:17},{s:1,p:18},{s:1,p:19},{s:1,p:20},{s:1,p:21},{s:1,p:22},{s:1,p:23},{s:1,p:24},{s:1,p:25},{s:1,p:26},{s:1,p:27},{s:1,p:28},{s:1,p:29},{s:1,p:30},{s:1,p:31}],
},
1: {
name: 'pawn-b',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
epTarget: true,
initial: [{s:-1,p:96},{s:-1,p:97},{s:-1,p:98},{s:-1,p:99},{s:-1,p:100},{s:-1,p:101},{s:-1,p:102},{s:-1,p:103},{s:-1,p:104},{s:-1,p:105},{s:-1,p:106},{s:-1,p:107},{s:-1,p:108},{s:-1,p:109},{s:-1,p:110},{s:-1,p:111}],
},
2: {
name: 'pawn-w2',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
epTarget: true,
initial: [{s:1,p:224},{s:1,p:225},{s:1,p:226},{s:1,p:227},{s:1,p:228},{s:1,p:229},{s:1,p:230},{s:1,p:231},{s:1,p:232},{s:1,p:233},{s:1,p:234},{s:1,p:235},{s:1,p:236},{s:1,p:237},{s:1,p:238},{s:1,p:239}],
},
3: {
name: 'pawn-b2',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
epTarget: true,
initial: [{s:-1,p:144},{s:-1,p:145},{s:-1,p:146},{s:-1,p:147},{s:-1,p:148},{s:-1,p:149},{s:-1,p:150},{s:-1,p:151},{s:-1,p:152},{s:-1,p:153},{s:-1,p:154},{s:-1,p:155},{s:-1,p:156},{s:-1,p:157},{s:-1,p:158},{s:-1,p:159}],
},
4: {
name: 'knight',
aspect: 'fr-knight',
graph: this.cbKnightGraph(geometry),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6},{s:1,p:9},{s:1,p:14},{s:1,p:241},{s:1,p:246},{s:1,p:249},{s:1,p:254},{s:-1,p:113},{s:-1,p:118},{s:-1,p:121},{s:-1,p:126},{s:-1,p:129},{s:-1,p:134},{s:-1,p:137},{s:-1,p:142}],
},
5: {
name: 'bishop',
aspect: 'fr-bishop',
graph: this.cbBishopGraph(geometry),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5},{s:1,p:10},{s:1,p:13},{s:1,p:242},{s:1,p:245},{s:1,p:250},{s:1,p:253},{s:-1,p:114},{s:-1,p:117},{s:-1,p:122},{s:-1,p:125},{s:-1,p:130},{s:-1,p:133},{s:-1,p:138},{s:-1,p:141}],
},
6: {
name: 'rook',
aspect: 'fr-rook',
graph: this.cbRookGraph(geometry),
value: 5,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7},{s:1,p:8},{s:1,p:15},{s:1,p:240},{s:1,p:247},{s:1,p:248},{s:1,p:255},{s:-1,p:112},{s:-1,p:119},{s:-1,p:120},{s:-1,p:127},{s:-1,p:128},{s:-1,p:135},{s:-1,p:136},{s:-1,p:143}],
castle: true,
},
7: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 9,
abbrev: 'Q',
initial: [{s:1,p:3},{s:1,p:11},{s:1,p:244},{s:1,p:252},{s:-1,p:115},{s:-1,p:123},{s:-1,p:132},{s:-1,p:140}],
},
8: {
name: 'king',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:12},{s:-1,p:124}],
},
9: {
name: 'commander',
aspect: 'fr-amazon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbKnightGraph(geometry)),
value: 13,
abbrev: 'Co',
initial: [{s:1,p:4},{s:-1,p:116}],
},
10: {
name: 'cardinal',
aspect: 'fr-cardinal',
graph: this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbKnightGraph(geometry)),
value: 6,
abbrev: 'Ca',
initial: [{s:1,p:251},{s:-1,p:139}],
},
11: {
name: 'chancellor',
aspect: 'fr-marshall',
graph: this.cbMergeGraphs(geometry,
this.cbRookGraph(geometry),
this.cbKnightGraph(geometry)),
value: 9,
abbrev: 'Ch',
initial: [{s:1,p:243},{s:-1,p:131}],
castle: true,
},
},
promote: function(aGame,piece,move) {
if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7,9,10,11];
else if(piece.t==1 && geometry.R(move.t)==0)
return [4,5,6,7,9,10,11];
else if(piece.t==2 && geometry.R(move.t)==8)
return [4,5,6,7,9,10,11];
else if(piece.t==3 && geometry.R(move.t)==15)
return [4,5,6,7,9,10,11];
return [];
},
castle: {
"12/8": {k:[11,10],r:[9,10,11],n:"O-O-O"},
"12/15": {k:[13,14],r:[14,13],n:"O-O"},
"124/120": {k:[123,122],r:[121,122,123],n:"O-O-O"},
"124/127": {k:[125,126],r:[126,125],n:"O-O"},
},
evaluate: function(aGame,evalValues,material) {
// check lack of material to checkmate
var white=material[1].count;
var black=material[-1].count;
if(!white[0] && !white[1] && !white[4] && !white[5] && !white[6] && !white[7]) { // white king single
if(!black[2] && !black[3] && !black[6] && !black[7] && (black[4]+black[5]<2 || black[5]<2)) {
this.mFinished=true;
this.mWinner=JocGame.DRAW;
}
}
if(!black[2] && !black[3] && !black[4] && !black[5] && !black[6] && !black[7]) { // black king single
if(!white[0] && !white[1] && !white[6] && !white[7] && (white[4]+white[5]<2 || white[5]<2)) {
this.mFinished=true;
this.mWinner=JocGame.DRAW;
}
}
// check 50 moves without capture
if(this.noCaptCount>=100) {
this.mFinished=true;
this.mWinner=JocGame.DRAW;
}
// motivate pawns to reach the promotion line
var distPromo=aGame.cbUseTypedArrays?new Int8Array(3):[0,0,0];
var height=geometry.height;
var pawns=material[1].byType[0],pawnsLength;
if(pawns) {
pawnsLength=pawns.length;
for(var i=0;i<pawnsLength;i++)
switch(height-geometry.R(pawns[i].p)) {
case 2: distPromo[0]++; break;
case 3: distPromo[1]++; break;
case 4: distPromo[2]++; break;
}
}
pawns=material[-1].byType[2],pawnsLength;
if(pawns) {
pawnsLength=pawns.length;
for(var i=0;i<pawnsLength;i++)
switch(geometry.R(pawns[i].p)) {
case 1: distPromo[0]--; break;
case 2: distPromo[1]--; break;
case 3: distPromo[2]--; break;
}
}
if(distPromo[0]!=0)
evalValues['distPawnPromo1']=distPromo[0];
if(distPromo[1]!=0)
evalValues['distPawnPromo2']=distPromo[1];
if(distPromo[2]!=0)
evalValues['distPawnPromo3']=distPromo[2];
// motivate knights and bishops to deploy early
var minorPiecesMoved=0;
for(var t=4;t<=5;t++)
for(var s=1;s>=-1;s-=2) {
var pieces=material[s].byType[t];
if(pieces)
for(var i=0;i<pieces.length;i++)
if(pieces[i].m)
minorPiecesMoved+=s;
}
if(minorPiecesMoved!=0) {
evalValues['minorPiecesMoved']=minorPiecesMoved;
}
},
importGame: function(initial,format,data) {
initial.pieces.forEach(function(piece) {
if(piece.s==1 && geometry.R(piece.p)==1 && piece.t==0) {
piece.t=1;
piece.m=false;
}
if(piece.s==1 && geometry.R(piece.p)!=1 && piece.t==1) {
piece.t=0;
piece.m=true;
}
if(piece.s==-1 && geometry.R(piece.p)==geometry.height-2 && piece.t==2) {
piece.t=3;
piece.m=false;
}
if(piece.s==-1 && geometry.R(piece.p)!=geometry.height-2 && piece.t==3) {
piece.t=2;
piece.m=true;
}
});
return true;
}
};
}
})();

View file

@ -0,0 +1,42 @@
<h1>Rules</h1>
<h2>Setup</h2>
<img src="res/visuals/4board-600x600-2d.jpg" >
<h2>Pieces</h2>
<pre>
King
Like in Classic Chess.
<img src="res/fairy/icons/w-king.png" >
<img src="res/rules/graphs/king.png" >
Queen
Like in Classic Chess.
<img src="res/fairy/icons/w-queen.png" >
<img src="res/rules/graphs/queen.png" >
Rook
Like in Classic Chess.
<img src="res/fairy/icons/w-rook.png" >
<img src="res/rules/graphs/rook.png" >
Bishop
Like in Classic Chess.
<img src="res/fairy/icons/w-bishop.png" >
<img src="res/rules/graphs/bishop.png" >
Knight
Like in Classic Chess.
<img src="res/fairy/icons/w-knight.png" >
<img src="res/rules/graphs/knight.png" >
Pawn
Like in Classic Chess.
<img src="res/fairy/icons/w-pawn.png" >
<img src="res/rules/graphs/pawn.png" >
Commander
Classic Queen + Classic Knight.
<img src="res/fairy/icons/w-amazon.png" >
<img src="res/rules/graphs/amazon.png" >
Chancellor
Classic Rook + Classic Knight.
<img src="res/fairy/icons/w-marshall.png" >
<img src="res/rules/graphs/marshall.png" >
Cardinal
Classic Bishop + Classic Knight
<img src="res/fairy/icons/w-cardinal.png" >
<img src="res/rules/graphs/cardinal.png" >
</pre>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,100 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 700,
height: 700,
},
"3d": {
scale: [0.45,0.45,0.45],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [0.3,0.3,0.3],
},
"2d": {
width: 650,
height: 650,
},
},
"fr-amazon": {
"3d": {
scale: [0.3,0.3,0.3],
},
},
}),
};
}
/* Make the knight and amazon jump when leaping */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,9 @@
<h1>Credits</h1>
<pre>
Inventor: tilera
Developer: tilera
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>Army Chess is a Chess Variant, where Black has an Army unroyal Kings.</p>

View file

@ -0,0 +1,159 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
},
1: {
name: 'ipawn-w',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:14},{s:1,p:15}],
epTarget: true,
},
2: {
name: 'soilder',
aspect: 'fr-admiral',
graph: this.cbKingGraph(geometry),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:40},{s:-1,p:41},{s:-1,p:42},{s:-1,p:43},{s:-1,p:44},{s:-1,p:45},{s:-1,p:46},{s:-1,p:47},{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55},{s:-1,p:56},{s:-1,p:57},{s:-1,p:58},{s:-1,p:59},{s:-1,p:61},{s:-1,p:62},{s:-1,p:63},],
epCatch: true,
},
4: {
name: 'knight',
aspect: 'fr-lion',
graph: this.cbShortRangeGraph(geometry,[
[-1,-1],[-1,1],[1,-1],[1,1],[1,0],[0,1],[-1,0],[0,-1],
[-2,0],[-2,-1],[-2,-2],[-1,-2],[0,-2],
[1,-2],[2,-2],[2,-1],[2,0],[2,1],
[2,2],[1,2],[0,2],[-1,2],[-2,2],[-2,1]]),
value: 6,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6}],
},
5: {
name: 'bishop',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 9,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5}],
},
6: {
name: 'rook',
aspect: 'fr-lighthouse',
graph: this.cbMergeGraphs(geometry,
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]
]),
this.cbRookGraph(geometry)),
value: 12,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7}],
castle: true,
},
7: {
name: 'amazon',
aspect: 'fr-amazon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbKnightGraph(geometry)),
value: 12,
abbrev: 'A',
initial: [{s:1,p:3}],
},
3: {
name: 'king',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:4},{s:-1,p:60}],
},
8: {
name: 'emperor',
aspect: 'fr-crowned-rook',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKnightGraph(geometry)),
value: 20,
abbrev: 'EM',
},
9: {
name: 'horse',
aspect: 'fr-knight',
graph: this.cbKnightGraph(geometry),
value: 2.9,
abbrev: 'HR',
initial: [{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==1)
return [0];
else if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7,8];
else if(piece.t==2 && geometry.R(move.t)==0)
return [4,5,6,7];
return [];
},
castle: {
"4/0": {k:[3,2],r:[1,2,3],n:"O-O-O"},
"4/7": {k:[5,6],r:[6,5],n:"O-O"},
"60/56": {k:[59,58],r:[57,58,59],n:"O-O-O"},
"60/63": {k:[61,62],r:[62,61],n:"O-O"},
},
};
}
})();

View file

@ -0,0 +1,28 @@
<h1>Rules</h1>
<h2>Setup</h2>
<img src="res/visuals/armychess-600x600-2d.jpg" >
<h2>Pieces</h2>
<pre>
King
Like in Classic Chess.
<img src="res/fairy/icons/w-king.png" >
<img src="res/rules/graphs/king.png" >
Commander
Classic Queen + Classic Knight.
<img src="res/fairy/icons/w-amazon.png" >
<img src="res/rules/graphs/amazon.png" >
Admiral
Moves like a classic King.
<img src="res/fairy/icons/w-admiral.png" >
<img src="res/rules/graphs/leychess/admiral.png" >
Queen
Like in Classic Chess.
<img src="res/fairy/icons/w-queen.png" >
<img src="res/rules/graphs/queen.png" >
Lion
<img src="res/fairy/icons/w-lion.png" >
<img src="res/rules/graphs/lion.png" >
Lighthouse
<img src="res/fairy/icons/w-lighthouse.png" >
<img src="res/rules/graphs/leychess/lighthouse.png" >
</pre>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,92 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1500,
height: 1500,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [.5,.5,.5],
},
"2d": {
width: 1300,
height: 1300,
},
},
"fr-amazon": {
"3d": {
scale: [.5,.5,.6],
},
},
}),
};
}
/* Make the knight and amazon jump when leaping */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -144,9 +144,9 @@
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
else if(piece.t==0 && (move.t in promo[1]))
return [4,5,6,7];
else if(piece.t==2 && geometry.R(move.t)==0)
else if(piece.t==2 && (move.t in promo[-1]))
return [4,5,6,7];
return [];
},
@ -226,4 +226,4 @@
};
}
})();
})();

View file

@ -0,0 +1,139 @@
/*
* Copyright(c) 2013-2016 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
Model.Game.cbKnightRiderGraph = function(geometry,confine) {
return this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]],confine);
}
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'cavalier-w',
aspect: 'fr-knight',
graph: Model.Game.cbHorseGraph(geometry),
value: 2,
abbrev: 'H',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15}],
},
1: {
name: 'cavalier-b',
aspect: 'fr-knight',
graph: Model.Game.cbHorseGraph(geometry),
value: 2,
abbrev: 'H',
initial: [{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}],
},
2: {
name: 'nightrider',
aspect: 'fr-unicorn',
graph: this.cbKnightRiderGraph(geometry),
value: 4.5,
abbrev: 'I',
initial: [{s:1,p:1},{s:1,p:6},{s:-1,p:57},{s:-1,p:62}],
},
3: {
name: 'paladin',
aspect: 'fr-cardinal',
graph: this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbKnightGraph(geometry)),
value: 6,
abbrev: 'A',
initial: [{s:1,p:2},{s:1,p:5},{s:-1,p:58},{s:-1,p:61}],
},
4: {
name: 'marshall',
aspect: 'fr-marshall',
graph: this.cbMergeGraphs(geometry,
this.cbRookGraph(geometry),
this.cbKnightGraph(geometry)),
value: 7.8,
abbrev: 'M',
initial: [{s:1,p:0},{s:1,p:7},{s:-1,p:56},{s:-1,p:63}],
},
5: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 9,
abbrev: 'Q',
initial: [{s:1,p:3},{s:-1,p:59}],
},
6: {
name: 'knightking',
aspect: 'fr-king',
isKing: true,
graph: this.cbMergeGraphs(geometry,
this.cbKingGraph(geometry),
this.cbKnightGraph(geometry)),
abbrev: 'K',
initial: [{s:1,p:4},{s:-1,p:60}],
},
},
promote: function(aGame,piece,move) {
rank = geometry.R(move.t);
file = geometry.C(move.t);
if ((piece.t==0 && rank==7) || (piece.t==1 && rank==0)) {
if (file==0 || file==7)
return [4];
if (file==1 || file==6)
return [2];
if (file==2 || file==5)
return [3];
if (file==3)
return [5];
return [2,3,4,5];
}
return [];
},
importGame: function(initial,format,data) {
initial.pieces.forEach(function(piece) {
if(piece.s==1 && geometry.R(piece.p)==1 && piece.t==0) {
piece.t=1;
piece.m=false;
}
if(piece.s==1 && geometry.R(piece.p)!=1 && piece.t==1) {
piece.t=0;
piece.m=true;
}
if(piece.s==-1 && geometry.R(piece.p)==geometry.height-2 && piece.t==2) {
piece.t=3;
piece.m=false;
}
if(piece.s==-1 && geometry.R(piece.p)!=geometry.height-2 && piece.t==3) {
piece.t=2;
piece.m=true;
}
});
return true;
}
};
}
})();

View file

@ -0,0 +1,114 @@
/*
* Copyright(c) 2013-2016 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbPromoSize = 1200;
View.Game.cbTargetSelectColor = 0x8B4513;
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var threeColors3D = {
'colorFill' : {
"+": "rgba(0,0,32,1)",
".": "rgba(160,150,150,0.9)",
"#": "rgba(0,24,0,1)",
}
}
var threeColors2D = {
'colorFill' : {
"+": "rgba(128,128,0,1)",
".": "rgba(189,183,107,1)",
"#": "rgba(85,107,47,1)",
}
}
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta,threeColors3D);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta,threeColors2D);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".+.+.+.+",
"#.#.#.#.",
".+.+.+.+",
"#.#.#.#.",
".+.+.+.+",
"#.#.#.#.",
".+.+.+.+",
"#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1400,
height: 1400,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"2d":{
width: 1300,
height: 1300,
},
"3d": {
scale: [.5,.5,.5],
},
},
"fr-knight": {
"3d": {
scale: [.4,.4,.4],
rotate: 90,
},
},
"fr-unicorn": {
"3d" : {
rotate: 90,
},
},
}),
};
}
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,11 @@
<h1>Credits</h1>
<pre>
Fergus Duniho from chessvariants.com made Cavalierchess and
Grand Cavalier Chess also with Jocly and inspired me, to make it also.
Inventor: Fergus Duniho
Developer: tilera
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>Cavalier Chess is a Chess Variant, where every Piece, except the Queen, are replaced by a Knight like variant of this Piece.</p>

View file

@ -0,0 +1,29 @@
<h1>Rules</h1>
<h2>Setup</h2>
<img src="res/visuals/cavalierchess-600x600-2d.jpg" >
<h2>Pieces</h2>
<pre>
Knight King
Classic King + Classic Knight
<img src="res/fairy/icons/w-king.png" >
<img src="res/rules/graphs/leychess/equusrex.png" >
Queen
Like in Classic Chess.
<img src="res/fairy/icons/w-queen.png" >
<img src="res/rules/graphs/queen.png" >
Cavalier
Like Chinese Chess Knights
<img src="res/fairy/icons/w-knight.png" >
<img src="res/rules/graphs/leychess/cavalier.png" >
Marshall
Classic Rook + Classic Knight.
<img src="res/fairy/icons/w-marshall.png" >
<img src="res/rules/graphs/marshall.png" >
Paladin
Classic Bishop + Classic Knight
<img src="res/fairy/icons/w-cardinal.png" >
<img src="res/rules/graphs/cardinal.png" >
Nightrider
<img src="res/fairy/icons/w-unicorn.png" >
<img src="res/rules/graphs/leychess/knightrider.png" >
</pre>

File diff suppressed because it is too large Load diff

View file

@ -542,7 +542,7 @@
canvas[channel]=canvas0;
});
spec.createMaterial.call($this,spec,canvas,function(material) {
material.emissive={r:.5,g:.5,b:.5};
material.emissive={r:0,g:0,b:0};
if($this.cbView.fences && $this.cbView.fences[fence])
material.color.set($this.cbView.fences[fence]);
var mesh=new THREE.Mesh(meshGeometry,material);
@ -707,9 +707,9 @@
var texBoardDiffuse = new THREE.Texture(canvas.diffuse);
texBoardDiffuse.needsUpdate = true;
var matSpec={
specular: '#111111',
emissive: '#ffffff',
shininess: 500,
specular: '#010101',
//emissive: '#ffffff',
shininess: 200,
map: texBoardDiffuse,
}
if(canvas.bump) {
@ -859,7 +859,7 @@
}
var lightPos = 14;
var lightInt = 1.2;
var lightInt = 1;
View.Game.cbExtraLights = [{
color: 0xffffff,

View file

@ -0,0 +1,20 @@
<style>
@media screen and (max-width: 520px) {
.side {
float: none;
display: block;
max-width: 100%;
margin-right: auto;
margin-left: auto;
}
}
</style>
<p>This Cubic Chess implementation does not enforce any rule !</p>
<p>It is to be used as a support to invent your own rules. If you come up with interesting rules and want to see them implemented into Jocly,
please open an issue about it on the <a href="https://github.com/mi-g/jocly/issues/new" target="_blank">Jocly repository</a>.</p>
<p>A consequence of the fact that no enforced rule is that playing against an artificial intelligence is pointless. You should only use
this Cubic Chess in human-vs-human mode.</p>

View file

@ -110,7 +110,7 @@
castle: {
"0/3": {k:[1,2],r:[2,1],n:"O-O"},
"28/31": {k:[30,29],r:[29,30],n:"O-O"},
"28/31": {k:[29,30],r:[30,29],n:"O-O"},
},
evaluate: function(aGame,evalValues,material) {
@ -184,4 +184,4 @@
};
}
})();
})();

View file

@ -148,9 +148,9 @@
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
else if(piece.t==0 && (move.t in promo[1]))
return [4,5,6,7];
else if(piece.t==2 && geometry.R(move.t)==0)
else if(piece.t==2 && (move.t in promo[-1]))
return [4,5,6,7];
return [];
},
@ -230,4 +230,4 @@
};
}
})();
})();

View file

@ -137,11 +137,61 @@
clipx: 1800,
},
},
"fr-star": {
"2d": {
clipx: 2600,
},
},
"fr-bow": {
"2d": {
clipx: 2400,
},
},
"fr-prince": {
"2d": {
clipx: 2100,
},
},
"fr-rhino": {
"2d": {
clipx: 1900,
},
},
"fr-bull": {
"2d": {
clipx: 2000,
},
},
"fr-corporal": {
"2d": {
clipx: 2700,
},
},
"fr-antelope": {
"2d": {
clipx: 2500,
},
},
"fr-machine": {
"2d": {
clipx: 2800,
},
},
"fr-buffalo": {
"2d": {
clipx: 2300,
},
},
"fr-ship": {
"2d": {
clipx: 2200,
},
},
},modifier);
}
View.Game.cbFairyPieceStyle3D = $.extend(true,{},View.Game.cbUniformPieceStyle3D,{
"default": {
mesh: {
normalScale: 1,
@ -149,26 +199,26 @@
},
//'useUniforms' : true,
materials:{
mat0:{
channels:{
mat0:{
channels:{
diffuse:{
size: FAIRY_CANVAS_PROPERTIES,
size: FAIRY_CANVAS_PROPERTIES,
},
normal: {
normal: {
size: FAIRY_CANVAS_PROPERTIES,
},
},
},
},
},
},
"1":{
'default': {
materials:{
mat0:{
mat0:{
params : {
specular: 0x020202,
shininess : 150 ,
shininess : 150 ,
},
},
},
@ -177,10 +227,10 @@
"-1":{
'default': {
materials:{
mat0:{
mat0:{
params : {
specular: 0x040404,
shininess : 100 ,
shininess : 100 ,
},
},
},
@ -202,10 +252,10 @@
},
},
"fr-pawn": {
mesh: {
jsFile:"/res/fairy/pawn/pawn.js"
mesh: {
jsFile:"/res/fairy/pawn/pawn.js"
},
materials: {
mat0: {
@ -217,17 +267,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/pawn/pawn-normalmap.jpg",
normalImg: "/res/fairy/pawn/pawn-normalmap.jpg",
}
}
}
}
},
},
"fr-knight": {
mesh: {
jsFile:"/res/fairy/knight/knight.js"
mesh: {
jsFile:"/res/fairy/knight/knight.js"
},
materials: {
mat0: {
@ -239,17 +289,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/knight/knight-normalmap.jpg",
normalImg: "/res/fairy/knight/knight-normalmap.jpg",
}
}
}
}
},
},
"fr-bishop": {
mesh: {
jsFile:"/res/fairy/bishop/bishop.js"
mesh: {
jsFile:"/res/fairy/bishop/bishop.js"
},
materials: {
mat0: {
@ -261,17 +311,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/bishop/bishop-normalmap.jpg",
normalImg: "/res/fairy/bishop/bishop-normalmap.jpg",
}
}
}
}
},
},
"fr-rook": {
mesh: {
jsFile:"/res/fairy/rook/rook.js"
mesh: {
jsFile:"/res/fairy/rook/rook.js"
},
materials: {
mat0: {
@ -283,17 +333,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/rook/rook-normalmap.jpg",
normalImg: "/res/fairy/rook/rook-normalmap.jpg",
}
}
}
}
},
},
"fr-queen": {
mesh: {
jsFile:"/res/fairy/queen/queen.js"
mesh: {
jsFile:"/res/fairy/queen/queen.js"
},
materials: {
mat0: {
@ -305,17 +355,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/queen/queen-normalmap.jpg",
normalImg: "/res/fairy/queen/queen-normalmap.jpg",
}
}
}
}
},
},
"fr-king": {
mesh: {
jsFile:"/res/fairy/king/king.js"
mesh: {
jsFile:"/res/fairy/king/king.js"
},
materials: {
mat0: {
@ -327,17 +377,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/king/king-normalmap.jpg",
normalImg: "/res/fairy/king/king-normalmap.jpg",
}
}
}
}
},
},
"fr-cannon": {
mesh: {
jsFile:"/res/fairy/cannon/cannon.js"
mesh: {
jsFile:"/res/fairy/cannon/cannon.js"
},
materials: {
mat0: {
@ -349,17 +399,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/cannon/cannon-normalmap.jpg",
normalImg: "/res/fairy/cannon/cannon-normalmap.jpg",
}
}
}
}
},
},
"fr-cannon2": {
mesh: {
jsFile:"/res/fairy/cannon2/cannon2.js"
mesh: {
jsFile:"/res/fairy/cannon2/cannon2.js"
},
materials: {
mat0: {
@ -371,17 +421,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/cannon2/cannon2-normalmap.jpg",
normalImg: "/res/fairy/cannon2/cannon2-normalmap.jpg",
}
}
}
}
},
},
"fr-dragon": {
mesh: {
jsFile:"/res/fairy/dragon/dragon.js"
mesh: {
jsFile:"/res/fairy/dragon/dragon.js"
},
materials: {
mat0: {
@ -393,7 +443,7 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/dragon/dragon-normalmap.jpg",
normalImg: "/res/fairy/dragon/dragon-normalmap.jpg",
}
}
}
@ -402,8 +452,8 @@
},
"fr-lighthouse": {
mesh: {
jsFile:"/res/fairy/lighthouse/lighthouse.js"
mesh: {
jsFile:"/res/fairy/lighthouse/lighthouse.js"
},
materials: {
mat0: {
@ -415,17 +465,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/lighthouse/lighthouse-normalmap.jpg",
normalImg: "/res/fairy/lighthouse/lighthouse-normalmap.jpg",
}
}
}
}
},
},
"fr-elephant": {
mesh: {
jsFile:"/res/fairy/elephant/elephant.js"
mesh: {
jsFile:"/res/fairy/elephant/elephant.js"
},
materials: {
mat0: {
@ -437,17 +487,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/elephant/elephant-normalmap.jpg",
normalImg: "/res/fairy/elephant/elephant-normalmap.jpg",
}
}
}
}
},
},
"fr-admiral": {
mesh: {
jsFile:"/res/fairy/admiral/admiral.js"
mesh: {
jsFile:"/res/fairy/admiral/admiral.js"
},
materials: {
mat0: {
@ -459,17 +509,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/admiral/admiral-normalmap.jpg",
normalImg: "/res/fairy/admiral/admiral-normalmap.jpg",
}
}
}
}
},
},
"fr-eagle": {
mesh: {
jsFile:"/res/fairy/eagle/eagle.js"
mesh: {
jsFile:"/res/fairy/eagle/eagle.js"
},
materials: {
mat0: {
@ -481,17 +531,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/eagle/eagle-normalmap.jpg",
normalImg: "/res/fairy/eagle/eagle-normalmap.jpg",
}
}
}
}
},
},
"fr-lion": {
mesh: {
jsFile:"/res/fairy/lion/lion.js"
mesh: {
jsFile:"/res/fairy/lion/lion.js"
},
materials: {
mat0: {
@ -503,17 +553,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/lion/lion-normalmap.jpg",
normalImg: "/res/fairy/lion/lion-normalmap.jpg",
}
}
}
}
},
},
"fr-camel": {
mesh: {
jsFile:"/res/fairy/camel/camel.js"
mesh: {
jsFile:"/res/fairy/camel/camel.js"
},
materials: {
mat0: {
@ -525,17 +575,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/camel/camel-normalmap.jpg",
normalImg: "/res/fairy/camel/camel-normalmap.jpg",
}
}
}
}
},
},
"fr-marshall": {
mesh: {
jsFile:"/res/fairy/marshall/marshall.js"
mesh: {
jsFile:"/res/fairy/marshall/marshall.js"
},
materials: {
mat0: {
@ -547,17 +597,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/marshall/marshall-normalmap.jpg",
normalImg: "/res/fairy/marshall/marshall-normalmap.jpg",
}
}
}
}
},
},
"fr-crowned-rook": {
mesh: {
jsFile:"/res/fairy/crowned-rook/crowned-rook.js"
mesh: {
jsFile:"/res/fairy/crowned-rook/crowned-rook.js"
},
materials: {
mat0: {
@ -569,7 +619,7 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/crowned-rook/crowned-rook-normalmap.jpg",
normalImg: "/res/fairy/crowned-rook/crowned-rook-normalmap.jpg",
}
}
}
@ -578,8 +628,8 @@
},
"fr-amazon": {
mesh: {
jsFile:"/res/fairy/amazon/amazon.js"
mesh: {
jsFile:"/res/fairy/amazon/amazon.js"
},
materials: {
mat0: {
@ -591,17 +641,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/amazon/amazon-normalmap.jpg",
normalImg: "/res/fairy/amazon/amazon-normalmap.jpg",
}
}
}
}
},
},
"fr-cardinal": {
mesh: {
jsFile:"/res/fairy/cardinal/cardinal.js"
mesh: {
jsFile:"/res/fairy/cardinal/cardinal.js"
},
materials: {
mat0: {
@ -613,17 +663,17 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/cardinal/cardinal-normalmap.jpg",
normalImg: "/res/fairy/cardinal/cardinal-normalmap.jpg",
}
}
}
}
},
},
"fr-unicorn": {
mesh: {
jsFile:"/res/fairy/unicorn/unicorn.js"
mesh: {
jsFile:"/res/fairy/unicorn/unicorn.js"
},
materials: {
mat0: {
@ -635,13 +685,234 @@
},
normal: {
texturesImg: {
normalImg: "/res/fairy/unicorn/unicorn-normalmap.jpg",
normalImg: "/res/fairy/unicorn/unicorn-normalmap.jpg",
}
}
}
}
},
},
"fr-star": {
mesh: {
jsFile:"/res/fairy/star/star.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/star/star-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/star/star-normalmap.jpg",
}
}
}
}
}
},
"fr-bow": {
mesh: {
jsFile:"/res/fairy/bow/bow.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/bow/bow-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/bow/bow-normalmap.jpg",
}
}
}
}
}
},
"fr-prince": {
mesh: {
jsFile:"/res/fairy/prince/prince.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/prince/prince-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/prince/prince-normalmap.jpg",
}
}
}
}
}
},
"fr-rhino": {
mesh: {
jsFile:"/res/fairy/rhino/rhino.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/rhino/rhino-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/rhino/rhino-normalmap.jpg",
}
}
}
}
}
},
"fr-bull": {
mesh: {
jsFile:"/res/fairy/bull/bull.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/bull/bull-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/bull/bull-normalmap.jpg",
}
}
}
}
}
},
"fr-corporal": {
mesh: {
jsFile:"/res/fairy/corporal/corporal.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/corporal/corporal-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/corporal/corporal-normalmap.jpg",
}
}
}
}
}
},
"fr-antelope": {
mesh: {
jsFile:"/res/fairy/antelope/antelope.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/antelope/antelope-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/antelope/antelope-normalmap.jpg",
}
}
}
}
}
},
"fr-machine": {
mesh: {
jsFile:"/res/fairy/machine/machine.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/machine/machine-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/machine/machine-normalmap.jpg",
}
}
}
}
}
},
"fr-buffalo": {
mesh: {
jsFile:"/res/fairy/buffalo/buffalo.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/buffalo/buffalo-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/buffalo/buffalo-normalmap.jpg",
}
}
}
}
}
},
"fr-ship": {
mesh: {
jsFile:"/res/fairy/ship/ship.js"
},
materials: {
mat0: {
channels: {
diffuse: {
texturesImg: {
diffImg : "/res/fairy/ship/ship-diffusemap.jpg",
}
},
normal: {
texturesImg: {
normalImg: "/res/fairy/ship/ship-normalmap.jpg",
}
}
}
}
}
},
});
})();
})();

View file

@ -0,0 +1,175 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
1: {
name: 'ipawn-w',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15}],
epTarget: false,
},
2: {
name: 'pawn-b',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
3: {
name: 'ipawn-b',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}],
epTarget: false,
},
4: {
name: 'knight',
aspect: 'fr-knight',
graph: this.cbKnightGraph(geometry),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6}],
},
5: {
name: 'bishop',
aspect: 'fr-bishop',
graph: this.cbBishopGraph(geometry),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5}],
},
6: {
name: 'rook',
aspect: 'fr-rook',
graph: this.cbRookGraph(geometry),
value: 5,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7}],
castle: true,
},
7: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 8,
abbrev: 'A',
initial: [{s:1,p:3}],
},
8: {
name: 'king',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:4},{s:-1,p:60}],
},
9: {
name: 'chancellor',
aspect: 'fr-marshall',
graph: this.cbMergeGraphs(geometry,
this.cbRookGraph(geometry),
this.cbKnightGraph(geometry)),
value: 5,
abbrev: 'Cc',
initial: [{s:-1,p:58},{s:-1,p:61}],
},
10: {
name: 'cardinal',
aspect: 'fr-cardinal',
graph: this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbKnightGraph(geometry)),
value: 5,
abbrev: 'Ad',
initial: [{s:-1,p:59}],
castle: true,
},
11: {
name : 'elephant',
abbrev : 'E',
aspect : 'fr-elephant',
graph : this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1],[-2,-2],[-2,2],[2,-2],[2,2]],),
value : 2,
initial: [{s:-1,p:57},{s:-1,p:62}],
},
12: {
name : 'crownedrook',
abbrev : 'Ib',
aspect : 'fr-crowned-rook',
graph : this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbShortRangeGraph(geometry,[[-1,0],[-2,0],[1,0],[2,0],[0,1],[0,2],[0,-1],[0,-2]])),
value : 2.2,
initial: [{s:-1,p:56},{s:-1,p:63}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==1)
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7];
else if(piece.t==2 && geometry.R(move.t)==0)
return [9,10,11,12];
return [];
},
castle: {
"4/0": {k:[3,2],r:[1,2,3],n:"O-O-O"},
"4/7": {k:[5,6],r:[6,5],n:"O-O"},
},
};
}
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,92 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1500,
height: 1500,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [.5,.5,.5],
},
"2d": {
width: 1300,
height: 1300,
},
},
"fr-amazon": {
"3d": {
scale: [.5,.5,.6],
},
},
}),
};
}
/* Make the knight and amazon jump when leaping */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,6 @@
<h3>Jocly implementation</h3>
<ul>
<li>Development: Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>)</li>
<li>Graphic design: Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>)</li>
<li>Rules and descriptions: <a target="_blank" href="http://history.chess.free.fr/terachess.htm">Jean-Louis Cazaux</a> and Jérôme Choain (@<a target="_blank" href="http://twitter.com/jcfrog">jcfrog</a>)</li>
</ul>

View file

@ -0,0 +1,4 @@
<p>Even bigger ! This is a chess variant with 20 different pieces on a 14 x 14 board: such a board was used by some Maharajahs in old India. There are 196 cases and 48 pieces per side which gives almost the same density than for Orthodox Chess.</p>
<p>In Gigachess one will find again all 13 kinds of pieces encountered in Shako , Tamerlane 2000, Metamachy. Newcomers are the <b>Corporal</b> (a super-Pawn), the <b>Machine</b> (orthogonal dual of the Elephant), the <b>Bow</b> (diagonal dual of the Cannon), the <b>Amazon</b> (Queen+Knight), the <b>Marshall</b> (Rook+Knight) and the <b>Cardinal</b> (Bishop+Knight) so often used in chess variants, and the <b>Buffalo</b>, a terrific leaper combining the powers of Knight, Camel and more.</p>

View file

@ -0,0 +1,447 @@
/*
* Copyright(c) 2013-2014 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var firstRow=0;
var lastRow=13;
var firstCol=0;
var lastCol=13;
var geometry = Model.Game.cbBoardGeometryGrid(14,14);
// graphs
Model.Game.cbCorporalGraph = function(geometry,side,confine) {
var $this=this;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
var directions=[];
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine))) {
var direction=[pos1 | $this.cbConstants.FLAG_MOVE];
var pos2=geometry.Graph(pos1,[0,side]);
if(pos2!=null && (!confine || (pos2 in confine)))
direction.push(pos2 | $this.cbConstants.FLAG_MOVE);
directions.push($this.cbTypedArray(direction));
}
[-1,1].forEach(function(dc) {
var pos2=geometry.Graph(pos,[dc,side]);
if(pos2!=null && (!confine || (pos2 in confine)))
directions.push($this.cbTypedArray([pos2 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE]));
});
graph[pos]=directions;
}
return graph;
}
Model.Game.cbPrinceGraph = function(geometry,side,confine) {
var $this=this;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
graph[pos]=[];
var forward=[]; // hold the pos line in front of the piece
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine))) {
forward.push(pos1 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE); // capture and move allowed at first forward position
pos1=geometry.Graph(pos1,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine)))
forward.push(pos1 | $this.cbConstants.FLAG_MOVE); // move to second forward only, no capture
graph[pos].push($this.cbTypedArray(forward));
}
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[-1,0],[1,0],[1,-1],[1,1],[0,-side]]), // direction other than forward
graph // forward direction
);
}
Model.Game.cbEagleGraph = function(geometry){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=0;dir<2;dir++) { // dir=0 for row, dir=1 for column
var nbMax = (dir==0) ? lastRow : lastCol;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
Model.Game.cbShipGraph = function(geometry){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=1;dir<2;dir++) { // dir=0 for row, dir=1 for column
var nbMax = (dir==0) ? lastRow : lastCol;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
var confine = {};
for(var pos=0;pos<geometry.boardSize;pos++) {
confine[pos]=1;
}
Model.Game.cbDefine = function() {
// classic chess pieces
var piecesTypes = {
0: {
name : 'ipawnw',
abbrev : '',
fenAbbrev: 'P',
aspect : 'fr-pawn',
graph : this.cbInitialPawnGraph(geometry,1,confine),
value : 0.6,
initial: [{s:1,p:28},{s:1,p:29},{s:1,p:30},{s:1,p:31},{s:1,p:38},{s:1,p:39},{s:1,p:40},{s:1,p:41},{s:1,p:46},{s:1,p:47},{s:1,p:48},{s:1,p:49},{s:1,p:50},{s:1,p:51}],
epCatch : true,
epTarget : true,
},
1: {
name : 'ipawnb',
abbrev : '',
fenAbbrev: 'P',
aspect : 'fr-pawn',
graph : this.cbInitialPawnGraph(geometry,-1,confine),
value : 0.6,
initial: [{s:-1,p:144},{s:-1,p:145},{s:-1,p:146},{s:-1,p:147},{s:-1,p:148},{s:-1,p:149},{s:-1,p:154},{s:-1,p:155},{s:-1,p:156},{s:-1,p:157},{s:-1,p:164},{s:-1,p:165},{s:-1,p:166},{s:-1,p:167}],
epCatch : true,
epTarget : true,
},
2: {
name : 'corporalw',
abbrev : 'O',
aspect : 'fr-corporal',
graph : this.cbCorporalGraph(geometry,1,confine),
value : 0.9,
initial: [{s:1,p:32},{s:1,p:33},{s:1,p:34},{s:1,p:35},{s:1,p:36},{s:1,p:37}],
epCatch : true,
epTarget : true,
},
3: {
name : 'corporalb',
abbrev : 'O',
aspect : 'fr-corporal',
graph : this.cbCorporalGraph(geometry,-1,confine),
value : 0.9,
initial: [{s:-1,p:158},{s:-1,p:159},{s:-1,p:160},{s:-1,p:161},{s:-1,p:162},{s:-1,p:163}],
epCatch : true,
epTarget : true,
},
4: {
name : 'princew',
abbrev : 'I',
aspect : 'fr-prince',
graph : this.cbPrinceGraph(geometry,1,confine),
value : 2.5,
initial: [{s:1,p:19},{s:1,p:22}],
epTarget : true,
},
5: {
name : 'princeb',
abbrev : 'I',
aspect : 'fr-prince',
graph : this.cbPrinceGraph(geometry,-1,confine),
value : 2.5,
initial: [{s:-1,p:173},{s:-1,p:176}],
epTarget : true,
},
6: {
name : 'rook',
abbrev : 'R',
aspect : 'fr-rook',
graph : this.cbRookGraph(geometry,confine),
value : 5,
initial: [{s:1,p:16},{s:1,p:25},{s:-1,p:170},{s:-1,p:179}],
},
7: {
name : 'bishop',
abbrev : 'B',
aspect : 'fr-bishop',
graph : this.cbBishopGraph(geometry,confine),
value : 3.4,
initial: [{s:1,p:18},{s:1,p:23},{s:-1,p:172},{s:-1,p:177}],
},
8: {
name : 'knight',
abbrev : 'N',
aspect : 'fr-knight',
graph : this.cbKnightGraph(geometry,confine),
value : 2.2,
initial: [{s:1,p:17},{s:1,p:24},{s:-1,p:171},{s:-1,p:178}],
},
9: {
name : 'queen',
abbrev : 'Q',
aspect : 'fr-queen',
graph : this.cbQueenGraph(geometry,confine),
value : 8.3,
initial: [{s:1,p:20},{s:-1,p:174}],
},
10: {
name : 'king',
abbrev : 'K',
aspect : 'fr-king',
graph : this.cbKingGraph(geometry,confine),
isKing : true,
initial: [{s:1,p:21},{s:-1,p:175}],
},
11: {
name : 'bow',
abbrev : 'W',
aspect : 'fr-bow',
graph : this.cbLongRangeGraph(geometry,[[-1,-1],[1,1],[-1,1],[1,-1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
value : 3.3,
initial: [{s:1,p:0},{s:1,p:13},{s:-1,p:182},{s:-1,p:195}],
},
12: {
name : 'lion',
abbrev : 'L',
aspect : 'fr-lion',
graph : this.cbShortRangeGraph(geometry,[
[-1,-1],[-1,1],[1,-1],[1,1],[1,0],[0,1],[-1,0],[0,-1],
[-2,0],[-2,-1],[-2,-2],[-1,-2],[0,-2],
[1,-2],[2,-2],[2,-1],[2,0],[2,1],
[2,2],[1,2],[0,2],[-1,2],[-2,2],[-2,1]
], confine),
value : 6.7,
initial: [{s:1,p:5},{s:-1,p:187}],
},
13: {
name : 'elephant',
abbrev : 'E',
aspect : 'fr-elephant',
graph : this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1],[-2,-2],[-2,2],[2,-2],[2,2]],confine),
value : 2.2,
initial: [{s:1,p:15},{s:1,p:26},{s:-1,p:169},{s:-1,p:180}],
},
14: {
name : 'cannon',
abbrev : 'Z',
aspect : 'fr-cannon2',
graph : this.cbXQCannonGraph(geometry),
value : 4.9,
initial: [{s:1,p:1},{s:1,p:12},{s:-1,p:183},{s:-1,p:194}],
},
15: {
name : 'machine',
abbrev : 'D',
aspect : 'fr-machine',
graph : this.cbShortRangeGraph(geometry,[[-1,0],[-2,0],[1,0],[2,0],[0,1],[0,2],[0,-1],[0,-2]],confine),
value : 2.4,
initial: [{s:1,p:14},{s:1,p:27},{s:-1,p:168},{s:-1,p:181}],
},
16: {
name : 'buffalo',
abbrev : 'F',
aspect : 'fr-buffalo',
graph : this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine),
value : 5.9,
initial: [{s:1,p:4},{s:-1,p:186}],
},
17: {
name : 'ship',
abbrev : 'X',
aspect : 'fr-ship',
graph : this.cbShipGraph(geometry),
value : 4.5,
initial: [{s:1,p:3},{s:1,p:10},{s:-1,p:185},{s:-1,p:192}],
},
18: {
name : 'eagle',
abbrev : 'H',
aspect : 'fr-eagle',
graph : this.cbEagleGraph(geometry),
value : 8.1,
initial: [{s:1,p:6},{s:-1,p:188}],
},
19: {
name : 'camel',
abbrev : 'J',
aspect : 'fr-camel',
graph : this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]]),
value : 2,
initial: [{s:1,p:2},{s:1,p:11},{s:-1,p:184},{s:-1,p:193}],
},
20: {
name : 'amazon',
abbrev : 'A',
aspect : 'fr-amazon',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbQueenGraph(geometry,confine)),
value : 10.4,
initial: [{s:1,p:7},{s:-1,p:189}],
},
21: {
name : 'marshall',
abbrev : 'M',
aspect : 'fr-marshall',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbRookGraph(geometry,confine)),
value : 7.1,
initial: [{s:1,p:8},{s:-1,p:190}],
},
22: {
name : 'cardinal',
abbrev : 'C',
aspect : 'fr-cardinal',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbBishopGraph(geometry,confine)),
value : 5.5,
initial: [{s:1,p:9},{s:-1,p:191}],
},
}
// defining types for readable promo cases
var T_ipawnw=0
var T_ipawnb=1
var T_corporalw=2
var T_corporalb=3
var T_princew=4
var T_princeb=5
var T_rook=6
var T_bishop=7
var T_knight=8
var T_queen=9
var T_king=10
var T_bow=11
var T_lion=12
var T_elephant=13
var T_cannon=14
var T_machine=15
var T_buffalo=16
var T_ship=17
var T_eagle=18
var T_camel=19
var T_amazon=20
var T_marshall=21
var T_cardinal=22
return {
geometry: geometry,
pieceTypes: piecesTypes,
promote: function(aGame,piece,move) {
// initial pawns go up to last row where it promotes to Queen
if( ((piece.t==T_ipawnw || piece.t==T_corporalw) && geometry.R(move.t)==lastRow) || ((piece.t==T_ipawnb || piece.t==T_corporalb) && geometry.R(move.t)==firstRow))
return [T_queen];
if (piece.t==T_princew && geometry.R(move.t)==lastRow)
return [T_amazon];
if (piece.t==T_princeb && geometry.R(move.t)==firstRow)
return [T_amazon];
if ((piece.t==T_knight || piece.t==T_camel) && ((geometry.R(move.t)==lastRow && piece.s > 0) || (geometry.R(move.t)==firstRow && piece.s < 0)) )
return [T_buffalo];
if (piece.t==T_elephant && ((geometry.R(move.t)==lastRow && piece.s > 0) || (geometry.R(move.t)==firstRow && piece.s < 0)) )
return [T_lion];
if (piece.t==T_machine && ((geometry.R(move.t)==lastRow && piece.s > 0) || (geometry.R(move.t)==firstRow && piece.s < 0)) )
return [T_lion];
if (piece.t==T_ship && ((geometry.R(move.t)==lastRow && piece.s > 0) || (geometry.R(move.t)==firstRow && piece.s < 0)) )
return [T_eagle];
return [];
},
};
}
})();

View file

@ -0,0 +1,228 @@
<style>
.piece-graph {
height: auto;
max-width: 100%;
margin: 0 auto;
display: block;
}
.piece-icon {
width : 70px;
height : auto;
float : left;
margin-right : 10px;
}
.piece-icon-promo {
width : 50px;
height : 50px;
}
#promo{
width : 200px;
margin: 0 auto;
}
</style>
<h1>Initial setup</h1>
<p>The board is a 14 x 14 checkered squares with a white one at the right end of each player.</p>
<p>
<img class='piece-graph' src='{GAME}/res/rules/gigachess/gigachess-start.png'>
</p>
<p>There are 48 pieces per side:
<ul>
<li>2 Bows, 2 Cannons, 2 Camels, 2 Ships, 1 Buffalo, 1 Lion, 1 Eagle, 1 Amazon, 1 Marshall, 1 Cardinal on 1st row, </li>
<li>1 King, 1 Queen, 2 Princes, 2 Bishops, 2 Knights, 2 Rooks, 2 Elephants, 2 Machines on 2nd row, </li>
<li>6 Corporals on 3rd row and 14 Pawns on 3rd and 4th rows. </li>
</ul>
</p>
<p>The white King is placed on the center of the second row on a black square, the black King being on a white square. The Queen is also placed on the center, beside the King. The Amazon is just behind the King. On the 1st row there is the "animal side" with Eagle, Lion, Buffalo from inside to outside, and the "knighted side" with Amazon, Marshall and Cardinal in this order. On 3rd row, Corporals occupy the six central columns. </p>
<p>All short-range pieces (and the Ship as well) promote.</p>
<h1>Pieces</h1>
<h2>King</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-king.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/king.png'>
</p>
<h2>Queen</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-queen.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/queen.png'>
</p>
<h2>Bishop</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-bishop.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/bishop.png'>
</p>
<h2>Knight</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-knight.png'>
</p>
<p class='piece-details'>Moves as in usual Chess. In addition, when a Knight reaches the last row it promotes to a Buffalo.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/knight.png'>
</p>
<h2>Rook</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-rook.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/rook.png'>
</p>
<h2>Elephant</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-elephant.png'>
</p>
<p class='piece-details'>As in Shako. In this game, when the Elephant reaches the last row it promotes to a Lion.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/elephant.png'>
</p>
<h2>Machine</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-machine.png'>
</p>
<p class='piece-details'>It is an orthogonal counterpart of the Elephant as it moves 1 or 2 cases orthogonally, jumping over the first case if it is occupied. Then, it combines the moves of old Dabbaba and Wazir found in ancient Muslim Chess variants. In this game, when the Machine reaches the last row it promotes to a Lion.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/machine.png'>
</p>
<h2>Lion</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-lion.png'>
</p>
<p class='piece-details'>As in Metamachy, inspired (although with some simplification) by Chu Shogi, the most popular variant of the Japanese Chess. Here the Lion may move as a King (a single step move in any direction), or it may jump to a position two squares away, jumping in any orthogonal or diagonal direction, or alternatively jumping as a Knight in usual Chess. (Then this Lion has the same range but is more restricted than the Lion in Chu Shogi which can move two times in a turn). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/lion.png'>
</p>
<h2>Eagle</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-eagle.png'>
</p>
<p class='piece-details'>As in Metamachy, moves one square diagonally and then, goes away of an indefinite number of cases vertically or horizontally. It is authorized to go only one square diagonal. It can not jump and the unobstructed path must start with the diagonal movement. This piece is almost as powerful as the Queen and is inspired by the Giraffe from Tamerlane's Chess and the Aanca from Alfonso X's Grande Acedrex.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/eagle.png'>
</p>
<h2>Ship</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-ship.png'>
</p>
<p class='piece-details'>Originally invented for Tamerlane 2000, it moves one square diagonally and then, goes away of an indefinite number of cases vertically, never horizontally. It can move one square diagonally only. It can not jump and must begin its move with the diagonal step. The Ship is more limited than the Eagle (which can move horizontally). Nevertheless its move power is comparable to the Rook and the Bishop. When the Ship reaches the last row it promotes to an Eagle.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/ship.png'>
</p>
<h2>Camel</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-camel.png'>
</p>
<p class='piece-details'>As in Metamachy, a well known piece from medieval Muslim great Chess like Tamerlane's Chess. It jumps to the opposite case of a 2x4 rectangle, like an extended Knight. No matter what intermediate cases contain. Note that it always stays on the same color of square. When a Camel reaches the last row it promotes to a Buffalo.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/camel.png'>
</p>
<h2>Cannon</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-cannon.png'>
</p>
<p class='piece-details'>As in Xiangqi, in Shako and in Metamachy. (Also known as Pao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/cannon.png'>
</p>
<h2>Bow</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-bow.png'>
</p>
<p class='piece-details'>It is the diagonal counterpart of the Chinese Cannon. It moves like a Bishop and needs an intermediate piece between itself and its victim to capture it. The Bow jumps the intermediate and takes the victim on its square. The intermediate is left unaffected. (Also known as Vao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/bow.png'>
</p>
<h2>Buffalo</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-buffalo.png'>
</p>
<p class='piece-details'>Combines the leaps of the Knight (3x2), the Camel (4x2) and the Bull (see Terachess) (4x3).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/buffalo.png'>
</p>
<h2>Marshall</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-marshall.png'>
</p>
<p class='piece-details'>It combines the move of Rook and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca and many others like Grand Chess or Gothic Chess. (under many other names: Champion, Guard, Empress, Concubine, Chancellor, etc. The later is sometimes preferred, however it is confusing since Capablanca used it once for R+N and once for B+N. It is an Elephant in Seirawan Chess).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/marshall.png'>
</p>
<h2>Cardinal</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-cardinal.png'>
</p>
<p class='piece-details'>It combines the move of Bishop and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca, Modern and many others like Grand Chess or Gothic Chess. (under many other names: Centaur, Minister, Equerry, Janus, Archbishop, Princess, Chancellor, etc. It is a Hawk in Seirawan Chess). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/cardinal.png'>
</p>
<h2>Amazon</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-amazon.png'>
</p>
<p class='piece-details'>Strongest piece on the board, it combines the move of Queen and Knight. It was used in the Turkish-Indian Grand Chess (as a Giraffe). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/amazon.png'>
</p>
<h1>Promotions table</h1>
<div id="promo">
<table><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-pawn.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-queen.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-corporal.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-queen.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-prince.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-amazon.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-knight.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-buffalo.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-camel.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-buffalo.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-elephant.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-lion.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-machine.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-lion.png'>
</td></tr><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-ship.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-eagle.png'>
</td></tr></table>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,224 @@
/*
*
*
*
* authors: jerome choain
*
*/
(function() {
function createTexturedPatternCanvas(W,H,texture,clipW,clipH,mask,borderFact){
// borderFact is the percentage (/100) of the mask transition overlay border : ex 30% => .3
var cv = document.createElement('canvas');
cv.width=W;
cv.height=H;
var ctx=cv.getContext('2d');
var maskW=mask.width;
var maskH=mask.height;
var textW=texture.width;
var textH=texture.height;
var tmp = document.createElement('canvas');
ctx.globalCompositeOperation='or';
var y=0;
for (var i=0; y<=(H+clipH/2);i++){
var x=0;
for (var j=0; x<=(W+clipW/2);j++){
tmp.width=clipW; tmp.height=clipH;
ctxTmp=tmp.getContext('2d');
ctxTmp.globalCompositeOperation='xor';
ctxTmp.drawImage(texture, Math.random()*(textW-clipW),Math.random()*(textH-clipH),clipW,clipH,0,0,clipW,clipH);
ctxTmp.drawImage(mask,0,0,clipW,clipH);
ctx.drawImage(tmp,x-clipW/2,y-clipH/2,clipW,clipH);
x+=clipW-borderFact*clipW;
}
y+=clipH-borderFact*clipH;
}
return cv;
}
// Reducing the promo frame which was overflowing the board screen
View.Game.cbPromoSize = 1100;
// extending fairy pieces with some musketeer new pieces
View.Game.cbFairyGigachessPieceStyle3D = $.extend(true,{},View.Game.cbFairyPieceStyle3D,{
});
View.Game.cbDefineView = function() {
var gigachessBoardDelta = {
notationMode: "out",
//notationDebug: true,
}
gigachessBoardDelta3d = $.extend(true,{},gigachessBoardDelta,
{
/*'colorFill' : {
".": "#575b36", // "rgba(180,213,80,.3)",
"#": "#474b36", // "black" cells
" ": "rgba(0,0,0,0)",
},*/
'colorFill' : {
"#": "rgba(204,40,0,1)",
".": "rgba(180,180,0,1)",
},
'texturesImg' : {
'crackles': '/res/images/crackles.jpg',
'tiler': '/res/images/tileralpha.png',
},
'3D':true,
'margins' : {x:.47,y:.47},
'extraChannels':[
'bump'
],
paintCell: function(spec,ctx,images,channel,cellType,xCenter,yCenter,cx,cy) {
var tW=images['crackles'].width;
var tH=images['crackles'].height;
var tClipCx=200;
var tClipCy=200;
ctx.fillStyle="#000000";
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
if(channel=="bump"){
return;
}
cx=.98*cx;
cy=.98*cy;
ctx.save();
ctx.strokeStyle = "rgba(0,0,0,1)";
ctx.lineWidth = 50;
if (channel=='diffuse')
ctx.fillStyle=spec.colorFill[cellType];
else
ctx.fillStyle=0xffffff;
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.globalCompositeOperation = 'multiply';
ctx.drawImage(images['crackles'],
Math.random()*(tW-tClipCx),Math.random()*(tH-tClipCy),tClipCx,tClipCy,
xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.restore();
},
paintBackground: function(spec,ctx,images,channel,bWidth,bHeight) {
ctx.save();
ctx.fillStyle="#ffffff";
if (channel=='diffuse')
ctx.fillStyle="#BA784A";
//ctx.fillStyle="#cc6600";
var cSize = this.cbCSize(spec);
ctx.fillRect(-bWidth/2,-bHeight/2,bWidth,bHeight);
var textureCanvas=createTexturedPatternCanvas(1200,800,images['crackles'],200,200,images['tiler'],.3);
ctx.globalCompositeOperation='multiply';
ctx.drawImage(textureCanvas,-bWidth/2,-bHeight/2,bWidth,bHeight);
ctx.restore();
},
}
);
gigachessBoardDelta2d = $.extend(true,{},gigachessBoardDelta,
{
'colorFill' : {
".": "#ffffc0", // "white" cells
"#": "#8F976D", // "black" cells
" ": "rgba(0,0,0,0)",
},
'texturesImg' : {}, // to avoid default wood texture
'margins' : {x:.47,y:.47},
/*'colorFill' : {
".": "rgba(224,50,0,1)",
"#": "rgba(220,220,0,1)",
},*/
}
);
var gigachessBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,gigachessBoardDelta3d);
var gigachessBoard2d = $.extend(true,{},this.cbGridBoardClassic2DMargin,gigachessBoardDelta2d);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,gigachessBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,gigachessBoard3d),
},
boardLayout: [
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(gigachessBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(gigachessBoard3d),
},
},
clicker: {
"2d": {
width: 800,
height: 800,
},
"3d": {
scale: [0.51428571428571,0.51428571428571,0.51428571428571],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"2d": {
width: 742.85714285714,
height: 742.85714285714,
},
"3d": {
scale: [0.34285714285714,0.34285714285714,0.34285714285714],
display: this.cbDisplayPieceFn(this.cbFairyGigachessPieceStyle3D)
},
},
"fr-amazon" :{
"3d": {
scale: [0.41142857142857,0.41142857142857,0.41142857142857],
}
},
}),
};
}
/* Make the jumps */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geo=aGame.cbVar.geometry;
var dx=Math.abs(geo.C(aMove.t)-geo.C(aMove.f));
var dy=Math.abs(geo.R(aMove.t)-geo.R(aMove.f));
if(("_N_E_D_L_J_T_F_G_S_".indexOf("_"+aMove.a+"_")>=0) && (aGame.g.distGraph[aMove.f][aMove.t]>1))
return Math.max(zFrom,zTo)+2000;
else if(("_A_C_M_".indexOf("_"+aMove.a+"_")>=0) && dx!=dy && dx!=0 && dy!=0)
return Math.max(zFrom,zTo)+2000;
else if(("_Z_W_".indexOf("_"+aMove.a+"_")>=0) && aMove.c != null)
return Math.max(zFrom,zTo)+2000;
else
return (zFrom+zTo)/2;
}
})();

View file

@ -8,11 +8,11 @@
5:'a4',16:'b4',26:'c4',37:'d4',47:'e4',58:'f4',69:'g4',81:'h4',92:'i4',104:'k4',115:'l4',
6:'a5',17:'b5',27:'c5',38:'d5',48:'e5',59:'f5',70:'g5',82:'h5',93:'i5',105:'k5',116:'l5',
7:'a6',18:'b6',28:'c6',39:'d6',49:'e6',60:'f6',71:'g6',83:'h6',94:'i6',106:'k6',117:'l6',
19:'b7',29:'c7',40:'d7',50:'e7',61:'f7',72:'g7',84:'h7',95:'i7',107:'k7',
30:'c8',41:'d8',51:'e8',62:'f8',73:'g8',85:'h8',96:'i8',
42:'d9',52:'e9',63:'f9',74:'g9',86:'h9',
53:'e10',64:'f10',75:'g10',
65:'f11',
19:'b7',29:'c7',40:'d7',50:'e7',61:'f7',72:'g7',84:'h7',95:'i7',107:'k7',
30:'c8',41:'d8',51:'e8',62:'f8',73:'g8',85:'h8',96:'i8',
42:'d9',52:'e9',63:'f9',74:'g9',86:'h9',
53:'e10',64:'f10',75:'g10',
65:'f11',
};
var geometry = Model.Game.cbBoardGeometryHex([
@ -35,7 +35,7 @@
}
var promo = {
"1": { 7:1, 19:1, 30:1, 53:1, 65:1, 73:1, 86:1, 96:1, 107:1, 117:1 },
"1": { 7:1, 19:1, 30:1, 42:1, 53:1, 65:1, 75:1, 86:1, 96:1, 107:1, 117:1 },
"-1": { 2:1, 13:1, 23:1, 34:1, 44:1, 55:1, 66:1, 78:1, 89:1, 101:1, 112:1 },
}
@ -229,4 +229,4 @@
};
}
})();
})();

View file

@ -0,0 +1,153 @@
/*
* Copyright(c) 2013-2016 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(10,10);
Model.Game.cbKnightRiderGraph = function(geometry,confine) {
return this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]],confine);
}
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'cavalier-w',
aspect: 'fr-knight',
graph: Model.Game.cbHorseGraph(geometry),
value: 2,
abbrev: 'H',
initial: [{s:1,p:21},{s:1,p:22},{s:1,p:23},{s:1,p:24},{s:1,p:25},{s:1,p:26},{s:1,p:27},{s:1,p:28}],
},
1: {
name: 'cavalier-b',
aspect: 'fr-knight',
graph: Model.Game.cbHorseGraph(geometry),
value: 2,
abbrev: 'H',
initial: [{s:-1,p:71},{s:-1,p:72},{s:-1,p:73},{s:-1,p:74},{s:-1,p:75},{s:-1,p:76},{s:-1,p:77},{s:-1,p:78}],
},
2: {
name: 'nightrider',
aspect: 'fr-unicorn',
graph: this.cbKnightRiderGraph(geometry),
value: 4.4,
abbrev: 'I',
initial: [{s:1,p:2},{s:1,p:7},{s:-1,p:92},{s:-1,p:97}],
},
3: {
name: 'paladin',
aspect: 'fr-cardinal',
graph: this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbKnightGraph(geometry)),
value: 6,
abbrev: 'A',
initial: [{s:1,p:3},{s:1,p:6},{s:-1,p:93},{s:-1,p:96}],
},
4: {
name: 'marshall',
aspect: 'fr-marshall',
graph: this.cbMergeGraphs(geometry,
this.cbRookGraph(geometry),
this.cbKnightGraph(geometry)),
value: 7.8,
abbrev: 'M',
initial: [{s:1,p:1},{s:1,p:8},{s:-1,p:91},{s:-1,p:98}],
},
5: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 9,
abbrev: 'Q',
initial: [{s:1,p:4},{s:-1,p:94}],
},
6: {
name: 'knightking',
aspect: 'fr-king',
isKing: true,
graph: this.cbMergeGraphs(geometry,
this.cbKingGraph(geometry),
this.cbKnightGraph(geometry)),
abbrev: 'K',
initial: [{s:1,p:5},{s:-1,p:95}],
},
7: {
name: 'cannon',
aspect: 'fr-cannon2',
graph: this.cbXQCannonGraph(geometry),
value: 4.6,
abbrec: 'C',
initial: [{s:1,p:10},{s:1,p:19},{s:-1,p:89},{s:-1,p:80}],
},
},
promote: function(aGame,piece,move) {
var rank = geometry.R(move.t);
if ((piece.t==0 && rank==9) || (piece.t==1 && rank==0)) {
var considerTypes={ 2:2, 3:2, 4:2, 5:1, 7:2 };
for(var i=0;i<this.pieces.length;i++) {
var piece1=this.pieces[i];
if(piece1.s==piece.s // piece from our side
&& piece1.p>0 // in play on board
&& (piece1.t in considerTypes)) // promotable piece type
considerTypes[piece1.t] = considerTypes[piece1.t] - 1;
}
var promo=[];
for(var t in considerTypes) { // create an array of types from our types map
if (considerTypes[t] > 0)
promo.push(t);
}
if(promo.length==0)
return null; // last line but no captured piece to promote to: move is not possible
return promo;
}
return [];
},
importGame: function(initial,format,data) {
initial.pieces.forEach(function(piece) {
if(piece.s==1 && geometry.R(piece.p)==1 && piece.t==0) {
piece.t=1;
piece.m=false;
}
if(piece.s==1 && geometry.R(piece.p)!=1 && piece.t==1) {
piece.t=0;
piece.m=true;
}
if(piece.s==-1 && geometry.R(piece.p)==geometry.height-2 && piece.t==2) {
piece.t=3;
piece.m=false;
}
if(piece.s==-1 && geometry.R(piece.p)!=geometry.height-2 && piece.t==3) {
piece.t=2;
piece.m=true;
}
});
return true;
}
};
}
debugger;
})();

View file

@ -0,0 +1,116 @@
/*
* Copyright(c) 2013-2016 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbPromoSize = 1200;
View.Game.cbTargetSelectColor = 0x8B4513;
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var threeColors3D = {
'colorFill' : {
"+": "rgba(0,0,32,1)",
".": "rgba(160,150,150,0.9)",
"#": "rgba(0,24,0,1)",
}
}
var threeColors2D = {
'colorFill' : {
"+": "rgba(128,128,0,1)",
".": "rgba(189,183,107,1)",
"#": "rgba(85,107,47,1)",
}
}
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta,threeColors3D);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta,threeColors2D);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".+.+.+.+.+",
"#.#.#.#.#.",
".+.+.+.+.+",
"#.#.#.#.#.",
".+.+.+.+.+",
"#.#.#.#.#.",
".+.+.+.+.+",
"#.#.#.#.#.",
".+.+.+.+.+",
"#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1400,
height: 1400,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"2d":{
width: 1300,
height: 1300,
},
"3d": {
scale: [.5,.5,.5],
},
},
"fr-knight": {
"3d": {
scale: [.4,.4,.4],
rotate: 90,
},
},
"fr-unicorn": {
"3d" : {
rotate: 90,
},
},
}),
};
}
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,11 @@
<h1>Credits</h1>
<pre>
Fergus Duniho from chessvariants.com made Cavalierchess and
Grand Cavalier Chess also with Jocly and inspired me, to make it also.
Inventor: Fergus Duniho
Developer: tilera
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>Grand Cavalier Chess is a greater Variant of Cavalier Chess, with two Cannons.</p>

View file

@ -0,0 +1,33 @@
<h1>Rules</h1>
<h2>Setup</h2>
<img src="res/visuals/grandcavalierchess-600x600-2d.jpg" >
<h2>Pieces</h2>
<pre>
Knight King
Classic King + Classic Knight
<img src="res/fairy/icons/w-king.png" >
<img src="res/rules/graphs/leychess/equusrex.png" >
Queen
Like in Classic Chess.
<img src="res/fairy/icons/w-queen.png" >
<img src="res/rules/graphs/queen.png" >
Cavalier
Like Chinese Chess Knights
<img src="res/fairy/icons/w-knight.png" >
<img src="res/rules/graphs/leychess/cavalier.png" >
Marshall
Classic Rook + Classic Knight.
<img src="res/fairy/icons/w-marshall.png" >
<img src="res/rules/graphs/marshall.png" >
Paladin
Classic Bishop + Classic Knight
<img src="res/fairy/icons/w-cardinal.png" >
<img src="res/rules/graphs/cardinal.png" >
Nightrider
<img src="res/fairy/icons/w-unicorn.png" >
<img src="res/rules/graphs/leychess/knightrider.png" >
Cannon
Like in Chinese Chess
<img src="res/fairy/icons/w-cannon.png" >
<img src="res/rules/graphs/cannon.png" >
</pre>

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,9 @@
<h1>Credits</h1>
<pre>
Inventor: tilera
Developer: tilera
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>Knightet Chess is a 8*8 Chess Variant with Knightet Pieces.</p>

View file

@ -0,0 +1,152 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-knight',
graph: this.cbMergeGraphs(geometry,
this.cbPawnGraph(geometry,1),
this.cbKnightGraph(geometry)),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
1: {
name: 'ipawn-w',
aspect: 'fr-knight',
graph: this.cbMergeGraphs(geometry,
this.cbInitialPawnGraph(geometry,1),
this.cbKnightGraph(geometry)),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15}],
epTarget: false,
},
2: {
name: 'pawn-b',
aspect: 'fr-knight',
graph: this.cbMergeGraphs(geometry,
this.cbPawnGraph(geometry,-1),
this.cbKnightGraph(geometry)),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
3: {
name: 'ipawn-b',
aspect: 'fr-knight',
graph: this.cbMergeGraphs(geometry,
this.cbInitialPawnGraph(geometry,-1),
this.cbKnightGraph(geometry)),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}],
epTarget: false,
},
4: {
name: 'knightrider',
aspect: 'fr-unicorn',
graph: this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6},{s:-1,p:57},{s:-1,p:62}],
},
5: {
name: 'cardinal',
aspect: 'fr-cardinal',
graph: this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbKnightGraph(geometry)),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5},{s:-1,p:58},{s:-1,p:61}],
},
6: {
name: 'chancellor',
aspect: 'fr-marshall',
graph: this.cbMergeGraphs(geometry,
this.cbRookGraph(geometry),
this.cbKnightGraph(geometry)),
value: 5,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7},{s:-1,p:56},{s:-1,p:63}],
castle: true,
},
7: {
name: 'commander',
aspect: 'fr-amazon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbKnightGraph(geometry)),
value: 8,
abbrev: 'A',
initial: [{s:1,p:3},{s:-1,p:59}],
},
8: {
name: 'king',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:4},{s:-1,p:60}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==1)
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7];
else if(piece.t==2 && geometry.R(move.t)==0)
return [4,5,6,7];
return [];
},
castle: {
"4/0": {k:[3,2],r:[1,2,3],n:"O-O-O"},
"4/7": {k:[5,6],r:[6,5],n:"O-O"},
"60/56": {k:[59,58],r:[57,58,59],n:"O-O-O"},
"60/63": {k:[61,62],r:[62,61],n:"O-O"},
},
};
}
})();

View file

@ -0,0 +1,29 @@
<h1>Rules</h1>
<h2>Setup</h2>
<img src="res/visuals/knightetchess-600x600-2d.jpg" >
<h2>Pieces</h2>
<pre>
King
Like in Classic Chess.
<img src="res/fairy/icons/w-king.png" >
<img src="res/rules/graphs/king.png" >
Commander
Classic Queen + Classic Knight.
<img src="res/fairy/icons/w-amazon.png" >
<img src="res/rules/graphs/amazon.png" >
Pawnight
Classic Pawn + Classic Knight.
<img src="res/fairy/icons/w-knight.png" >
<img src="res/rules/graphs/leychess/pawnight.png" >
Chancellor
Classic Rook + Classic Knight.
<img src="res/fairy/icons/w-marshall.png" >
<img src="res/rules/graphs/marshall.png" >
Cardinal
Classic Bishop + Classic Knight
<img src="res/fairy/icons/w-cardinal.png" >
<img src="res/rules/graphs/cardinal.png" >
Knightrider
<img src="res/fairy/icons/w-unicorn.png" >
<img src="res/rules/graphs/leychess/knightrider.png" >
</pre>

View file

@ -0,0 +1,92 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1500,
height: 1500,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [.5,.5,.5],
},
"2d": {
width: 1300,
height: 1300,
},
},
"fr-amazon": {
"3d": {
scale: [.5,.5,.6],
},
},
}),
};
}
/* Make the knight and amazon jump when leaping */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,137 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
1: {
name: 'ipawn-w',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15}],
epTarget: false,
},
2: {
name: 'pawn-b',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
3: {
name: 'ipawn-b',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}],
epTarget: false,
},
4: {
name: 'knight',
aspect: 'fr-admiral',
graph: this.cbKingGraph(geometry),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6},{s:-1,p:57},{s:-1,p:62}],
},
5: {
name: 'bishop',
aspect: 'fr-bishop',
graph: this.cbBishopGraph(geometry),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5},{s:-1,p:58},{s:-1,p:61}],
},
6: {
name: 'rook',
aspect: 'fr-rook',
graph: this.cbRookGraph(geometry),
value: 5,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7},{s:-1,p:56},{s:-1,p:63}],
castle: true,
},
7: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 8,
abbrev: 'A',
initial: [{s:1,p:3},{s:-1,p:59}],
},
8: {
name: 'king',
aspect: 'fr-unicorn',
isKing: true,
graph: this.cbKnightGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:4},{s:-1,p:60}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==1)
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7];
else if(piece.t==2 && geometry.R(move.t)==0)
return [9,10,11,12];
return [];
},
castle: {
"4/0": {k:[3,2],r:[1,2,3],n:"O-O-O"},
"4/7": {k:[5,6],r:[6,5],n:"O-O"},
"60/56": {k:[59,58],r:[57,58,59],n:"O-O-O"},
"60/63": {k:[61,62],r:[62,61],n:"O-O"},
},
};
}
})();

View file

@ -0,0 +1,92 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1500,
height: 1500,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [.5,.5,.5],
},
"2d": {
width: 1300,
height: 1300,
},
},
"fr-amazon": {
"3d": {
scale: [.5,.5,.6],
},
},
}),
};
}
/* Make the knight and amazon jump when leaping */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,188 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
1: {
name: 'ipawn-w',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15}],
epTarget: false,
},
2: {
name: 'pawn-b',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
3: {
name: 'ipawn-b',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}],
epTarget: false,
},
4: {
name: 'knight',
aspect: 'fr-knight',
graph: this.cbKnightGraph(geometry),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6},{s:-1,p:57},{s:-1,p:62}],
},
5: {
name: 'bishop',
aspect: 'fr-bishop',
graph: this.cbBishopGraph(geometry),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5},{s:-1,p:58},{s:-1,p:61}],
},
6: {
name: 'rook',
aspect: 'fr-rook',
graph: this.cbRookGraph(geometry),
value: 5,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7}],{s:-1,p:56},{s:-1,p:63}],
castle: true,
},
7: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 8,
abbrev: 'A',
initial: [{s:1,p:3},{s:-1,p:59}],
},
8: {
name: 'kingw',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:4}],
},
9: {
name: 'kingb',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:-1,p:60}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==1)
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7];
else if(piece.t==2 && geometry.R(move.t)==0)
return [9,10,11,12];
return [];
},
castle: {
"4/0": {k:[3,2],r:[1,2,3],n:"O-O-O"},
"4/7": {k:[5,6],r:[6,5],n:"O-O"},
"60/56": {k:[59,58],r:[57,58,59],n:"O-O-O"},
"60/63": {k:[61,62],r:[62,61],n:"O-O"},
},
};
}
Model.Board.Evaluate = function(aGame,piece,move) {
if(piece.t==8 && geometry.R(move.t)==3 && geometry.C(3)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==8 && geometry.R(move.t)==3 && geometry.C(4)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==8 && geometry.R(move.t)==4 && geometry.C(3)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==8 && geometry.R(move.t)==4 && geometry.C(4)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==9 && geometry.R(move.t)==3 && geometry.C(3)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==9 && geometry.R(move.t)==3 && geometry.C(4)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==9 && geometry.R(move.t)==4 && geometry.C(3)) {
this.mFinished=true;
this.mWinner=1;
return;
},
if(piece.t==9 && geometry.R(move.t)==4 && geometry.C(4)) {
this.mFinished=true;
this.mWinner=1;
return;
}
}
})();

View file

@ -0,0 +1,92 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var orthoBoardDelta = {
// notationMode: 'in',
// notationDebug: true,
};
var orthoBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,orthoBoardDelta);
var orthoBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,orthoBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,orthoBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,orthoBoard3d),
},
boardLayout: [
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
".#.#.#.#",
"#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(orthoBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(orthoBoard3d),
},
},
clicker: {
"2d": {
width: 1500,
height: 1500,
},
"3d": {
scale: [.75,.75,.75],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [.5,.5,.5],
},
"2d": {
width: 1300,
height: 1300,
},
},
"fr-amazon": {
"3d": {
scale: [.5,.5,.6],
},
},
}),
};
}
/* Make the knight and amazon jump when leaping */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geometry = aGame.cbVar.geometry;
var x0 = geometry.C(aMove.f);
var x1 = geometry.C(aMove.t);
var y0 = geometry.R(aMove.f);
var y1 = geometry.R(aMove.t);
if(x1-x0==0 || y1-y0==0 || Math.abs(x1-x0)==Math.abs(y1-y0))
return (zFrom+zTo)/2;
else
return Math.max(zFrom,zTo)+1500;
}
})();

View file

@ -0,0 +1,11 @@
<h1>Credits</h1>
<pre>
LeyChessAlpha is based on Metamachy.
Inventor: tilera
Developer: tilera
Inventor of Metamachy: Jean-Louis Cazaux
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>LeyChessAlpha is a 12*12 Chess Variant with Fairy Pieces based on Metamachy.</p>

View file

@ -0,0 +1,574 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(12,12);
Model.Game.cbDefine = function() {
var $this = this;
/*
* Movement/capture graph for the prince
*/
function PrinceGraph(side) {
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
var forward=[]; // hold the pos line in front of the piece
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null) {
forward.push(pos1 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE); // capture and move allowed at first forward position
pos1=geometry.Graph(pos1,[0,side]);
if(pos1!=null)
forward.push(pos1 | $this.cbConstants.FLAG_MOVE); // move to second forward only, no capture
graph[pos].push($this.cbTypedArray(forward));
}
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[-1,0],[1,0],[1,-1],[1,1],[0,-side]]), // direction other than forward
graph // forward direction
);
}
/*
* Movement/capture graph for the eagle
*/
function EagleGraph() {
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=0;dir<2;dir++) { // dir=0 for row, dir=1 for column
var away=[] // hold the sliding line
for(var n=1;n<11;n++) { // board is 12 cells long, so only consider max 11 cell displacements
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
1: {
name: 'ipawn-w',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:24},{s:1,p:25},{s:1,p:26},{s:1,p:27},{s:1,p:28},{s:1,p:29},{s:1,p:30},{s:1,p:31},{s:1,p:32},{s:1,p:33},{s:1,p:34},{s:1,p:35}],
epTarget: true,
epCatch: false,
},
2: {
name: 'pawn-b',
aspect: 'fr-pawn',
graph: this.cbPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: false,
},
3: {
name: 'ipawn-b',
aspect: 'fr-pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:108},{s:-1,p:109},{s:-1,p:110},{s:-1,p:111},{s:-1,p:112},{s:-1,p:113},{s:-1,p:114},{s:-1,p:115},{s:-1,p:116},{s:-1,p:117},{s:-1,p:118},{s:-1,p:119}],
epTarget: true,
epCatch: false,
},
4: {
name: 'knight',
aspect: 'fr-knight',
graph: this.cbKnightGraph(geometry),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:14},{s:1,p:21},{s:-1,p:122},{s:-1,p:129}],
},
5: {
name: 'bishop',
aspect: 'fr-bishop',
graph: this.cbBishopGraph(geometry),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:15},{s:1,p:20},{s:-1,p:123},{s:-1,p:128}],
},
6: {
name: 'rook',
aspect: 'fr-rook',
graph: this.cbRookGraph(geometry),
value: 5,
abbrev: 'R',
initial: [{s:1,p:13},{s:1,p:22},{s:-1,p:121},{s:-1,p:130}],
castle: true,
},
7: {
name: 'queen',
aspect: 'fr-queen',
graph: this.cbQueenGraph(geometry),
value: 9,
abbrev: 'Q',
initial: [{s:1,p:18},{s:-1,p:126}],
},
8: {
name: 'king',
aspect: 'fr-king',
isKing: true,
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:17},{s:-1,p:125}],
},
9: {
name: 'cannon',
aspect: 'fr-cannon2',
graph: this.cbXQCannonGraph(geometry),
value: 3.5,
abbrev: 'C',
initial: [{s:1,p:0},{s:1,p:11},{s:-1,p:132},{s:-1,p:143}],
},
10: {
name: 'elephant',
aspect: 'fr-elephant',
graph: this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1],[-2,-2],[-2,2],[2,-2],[2,2]]),
value: 2.5,
abbrev: 'E',
initial: [{s:1,p:12},{s:1,p:23},{s:-1,p:120},{s:-1,p:131}],
},
11: {
name: 'prince-w',
aspect: 'fr-admiral',
graph: PrinceGraph(1),
value: 3,
epTarget: true,
abbrev: 'I',
initial: [{s:1,p:16},{s:1,p:19}],
},
12: {
name: 'prince-b',
aspect: 'fr-admiral',
graph: PrinceGraph(-1),
epTarget: true,
value: 3,
abbrev: 'I',
initial: [{s:-1,p:124},{s:-1,p:127}],
},
13: {
name: 'camel',
aspect: 'fr-camel',
graph: this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]]),
value: 2,
abbrev: 'M',
initial: [{s:1,p:1},{s:1,p:10},{s:-1,p:133},{s:-1,p:142}],
},
14: {
name: 'lion',
aspect: 'fr-lion',
graph: this.cbShortRangeGraph(geometry,[
[-1,-1],[-1,1],[1,-1],[1,1],[1,0],[0,1],[-1,0],[0,-1],
[-2,0],[-2,-1],[-2,-2],[-1,-2],[0,-2],
[1,-2],[2,-2],[2,-1],[2,0],[2,1],
[2,2],[1,2],[0,2],[-1,2],[-2,2],[-2,1]]),
value: 7.5,
abbrev: 'L',
initial: [{s:1,p:5},{s:-1,p:137}],
},
15: {
name: 'eagle',
aspect: 'fr-eagle',
graph: EagleGraph(),
value: 8,
abbrev: 'A',
initial: [{s:1,p:6},{s:-1,p:138}],
},
16: {
name: 'unicorn',
aspect: 'fr-unicorn',
graph: this.cbMergeGraphs(geometry,
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKingGraph(geometry),
this.cbKnightGraph(geometry),
this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]])
),
value: 13,
abbrev: 'Pa',
initial: [{s:1,p:2},{s:-1,p:134}],
},
17: {
name: 'dragon',
aspect: 'fr-dragon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
EagleGraph()),
value: 14,
abbrev: 'D',
initial: [{s:1,p:4},{s:-1,p:136}],
},
18: {
name: 'lighthouse',
aspect: 'fr-lighthouse',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE)),
value: 12,
abbrev: 'LH',
initial: [{s:1,p:3},{s:-1,p:135}],
},
19: {
name: 'emperor',
aspect: 'fr-crowned-rook',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
EagleGraph(),
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKnightGraph(geometry),
this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]])),
value: 20,
abbrev: 'EM',
},
20: {
name: 'commander',
aspect: 'fr-amazon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbKnightGraph(geometry)),
value: 13,
abbrev: 'Co',
initial: [{s:1,p:7},{s:-1,p:139}],
},
21: {
name: 'cardinal',
aspect: 'fr-cardinal',
graph: this.cbMergeGraphs(geometry,
this.cbBishopGraph(geometry),
this.cbKnightGraph(geometry)),
value: 6,
abbrev: 'Ca',
initial: [{s:1,p:9},{s:-1,p:141}],
},
22: {
name: 'chancellor',
aspect: 'fr-marshall',
graph: this.cbMergeGraphs(geometry,
this.cbRookGraph(geometry),
this.cbKnightGraph(geometry)),
value: 9,
abbrev: 'Ch',
initial: [{s:1,p:8},{s:-1,p:140}],
castle: true,
},
},
promote: function(aGame,piece,move) {
if(piece.t==1 && geometry.R(move.t)==11)
return [14,15,20,16,17,18];
else if(piece.t==3 && geometry.R(move.t)==0)
return [14,15,20,16,17,18];
else if(piece.t==11 && geometry.R(move.t)==11)
return [19];
else if(piece.t==12 && geometry.R(move.t)==0)
return [19];
return [];
},
};
}
/*
* Model.Board.GenerateMoves:
* - handle setup phase
* - handle king special move: a kind of castle involving only the king
*/
var kingLongMoves={
"1": {
17: [ [15,16],[19,18],[41,29],[39,28],[43,30],[3,4,16],[27,16,28],[40,28,29],[42,29,30],[31,18,30],[7,18,6] ],
5: [ [3,4],[7,8],[29,17],[27,16],[31,18],[15,4,6],[28,16,17],[30,17,18],[19,6,18] ],
},
"-1": {
125: [ [127,126],[123,124],[101,113],[99,112],[103,114],[135,124,136],[111,112,124],[100,112,113],[102,113,114],[115,114,126],[139,126,138] ],
137: [ [139,138],[135,136],[113,125],[115,126],[111,124],[127,126,138],[114,125,126],[112,124,125],[123,124,136] ],
},
}
var SuperModelBoardGenerateMoves=Model.Board.GenerateMoves;
Model.Board.GenerateMoves = function(aGame) {
// first moves (white and black) are managed specifically to setup K,Q,E,L initial position
if(this.setupState===undefined) {
this.mMoves=[{}];
return;
}
if(this.setupState=="setup") {
this.mMoves=[];
for(var i=0;i<12;i++)
this.mMoves.push({setup:i});
return;
}
SuperModelBoardGenerateMoves.apply(this,arguments); // call regular GenerateMoves method
// now consider special 2 cases king moves
var kPiece=this.pieces[this.board[this.kings[this.mWho]]];
if(!kPiece.m && !this.check) {
var lMoves=kingLongMoves[this.mWho][kPiece.p];
for(var i=0;i<lMoves.length;i++) {
var lMove=lMoves[i];
if(this.board[lMove[0]]>=0)
continue;
var canMove=true;
var oppInCheck=false;
for(var j=0;j<lMove.length;j++) {
var pos=lMove[j];
var tmpOut=this.board[pos];
this.board[pos]=-1; // remove possible piece to prevent problems when quick-applying/unapplying
var undo=this.cbQuickApply(aGame,{
f: kPiece.p,
t: pos,
});
var inCheck=this.cbGetAttackers(aGame,pos,this.mWho,true).length>0;
if(!inCheck && j==0)
oppInCheck=this.cbGetAttackers(aGame,this.kings[-this.mWho],-this.mWho,true).length>0;
this.cbQuickUnapply(aGame,undo);
this.board[pos]=tmpOut;
this.cbIntegrity(aGame);
if(inCheck) {
canMove=false;
break;
}
}
if(canMove)
this.mMoves.push({
f: kPiece.p,
t: lMove[0],
c: null,
ck: oppInCheck,
a: 'K',
});
}
}
}
/*
* Model.Board.CopyFrom overriding to copy setupState property
*/
var SuperModelBoardCopyFrom = Model.Board.CopyFrom;
Model.Board.CopyFrom = function(aBoard) {
SuperModelBoardCopyFrom.apply(this,arguments);
this.setupState = aBoard.setupState;
}
/*
* Model.Board.Evaluate overriding: in setup phase, no evaluation
*/
var SuperModelBoardEvaluate = Model.Board.Evaluate;
Model.Board.Evaluate = function(aGame) {
if(this.setupState===undefined || this.setupState=="setup")
return;
SuperModelBoardEvaluate.apply(this,arguments);
}
/*
* Model.Board.ApplyMove overriding: setup phase and king special move
*/
var SuperModelBoardApplyMove=Model.Board.ApplyMove;
Model.Board.ApplyMove = function(aGame,move) {
if(this.setupState===undefined)
this.setupState="setup";
else if(this.setupState=="setup") {
var $this=this, piece;
// at this point, KQLE have arbitrary positions. remember those piece indexes so we can move them
var starting={
"1": { K: 17, Q: 18, L: 5, E: 6 },
"-1": { K: 125, Q: 126, L: 137, E: 138 },
}
var indexes={ "1": {}, "-1": {} };
["1","-1"].forEach(function(side) {
for(var p in starting[side])
indexes[side][p]=$this.board[starting[side][p]];
});
// remove KQLE from the board
[5,6,17,18,125,126,137,138].forEach(function(pos) {
var pIndex=$this.board[pos];
$this.board[pos]=-1;
piece = $this.pieces[pIndex];
piece.p=-1;
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,pos);
});
// setup KQLE positions according to the setup
var setup=move.setup;
var remaining={};
if(setup/6<1) {
this.board[17]=indexes[1].K;
piece = this.pieces[indexes[1].K];
piece.p=17;
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,17);
this.kings[1]=17;
remaining[1]=[18,5,6];
this.board[125]=indexes[-1].K;
piece = this.pieces[indexes[-1].K];
piece.p=125;
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,125);
this.kings[-1]=125;
remaining[-1]=[126,137,138];
} else {
this.board[5]=indexes[1].K;
piece = this.pieces[indexes[1].K];
piece.p=5;
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,5);
this.kings[1]=5;
remaining[1]=[17,18,6];
this.board[137]=indexes[-1].K;
piece = this.pieces[indexes[-1].K];
piece.p=137;
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,137);
this.kings[-1]=137;
remaining[-1]=[125,126,138];
}
setup%=6;
var queen=Math.floor(setup/2);
this.board[remaining[1][queen]]=indexes[1].Q;
piece = this.pieces[indexes[1].Q];
piece.p=remaining[1][queen];
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,remaining[1][queen]);
remaining[1].splice(queen,1);
this.board[remaining[-1][queen]]=indexes[-1].Q;
piece = this.pieces[indexes[-1].Q];
piece.p=remaining[-1][queen];
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,remaining[-1][queen]);
remaining[-1].splice(queen,1);
var eagle,lion;
setup%=2;
if(setup==0) {
eagle=0;
lion=1;
} else {
eagle=1;
lion=0;
}
this.board[remaining[1][eagle]]=indexes[1].E;
piece = this.pieces[indexes[1].E];
piece.p=remaining[1][eagle];
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,remaining[1][eagle]);
this.board[remaining[1][lion]]=indexes[1].L;
piece = this.pieces[indexes[1].L];
piece.p=remaining[1][lion];
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,remaining[1][lion]);
this.board[remaining[-1][eagle]]=indexes[-1].E;
piece = this.pieces[indexes[-1].E];
piece.p=remaining[-1][eagle];
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,remaining[-1][eagle]);
this.board[remaining[-1][lion]]=indexes[-1].L;
piece = this.pieces[indexes[-1].L];
piece.p=remaining[-1][lion];
$this.zSign=aGame.zobrist.update($this.zSign,"board",piece.t,remaining[1][lion]);
this.setupState="done";
} else
SuperModelBoardApplyMove.apply(this,arguments);
}
/*
* Model.Move.ToString overriding for setup notation
*/
var SuperModelMoveToString = Model.Move.ToString;
Model.Move.ToString = function() {
if(this.f===undefined) {
if(this.setup===undefined)
return "--";
else
return "#"+this.setup;
}
return SuperModelMoveToString.apply(this,arguments);
}
/*
* Model.Board.CompactMoveString overriding to help reading PJN game transcripts
*/
var SuperModelBoardCompactMoveString = Model.Board.CompactMoveString;
Model.Board.CompactMoveString = function(aGame,aMove,allMoves) {
if(typeof aMove.ToString!="function") // ensure proper move object, if necessary
aMove=aGame.CreateMove(aMove);
if(this.setupState===undefined || this.setupState=="setup")
return aMove.ToString();
return SuperModelBoardCompactMoveString.apply(this,arguments);
}
/*
* Model.Board.StaticGenerateMoves overriding to prevent using AI during the setup phase
*/
Model.Board.StaticGenerateMoves = function(aGame) {
if(this.setupState=="setup")
return [aGame.CreateMove({setup:Math.floor(Math.random()*12)})];
return null;
}
})();

View file

@ -0,0 +1,177 @@
<h1 style="font-size:300%;">LeyChessAlpha Rules</h1>
<h1>Setup</h1>
<img src="res/visuals/leychessalpha-600x600-2d.jpg" alt="Your Browser suck:(" style="width:320px;height:320px;">
<h1>Pieces</h1>
<h2>King</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-king.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/king.png'>
</p>
<h2>Queen</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-queen.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/queen.png'>
</p>
<h2>Bishop</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bishop.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bishop.png'>
</p>
<h2>Knight</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-knight.png'>
</p>
<p class='piece-details'>Moves as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/knight.png'>
</p>
<h2>Rook</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-rook.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/rook.png'>
</p>
<h2>Pawn</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-pawn.png'>
</p>
<p class='piece-details'>The Pawn is almost similar to usual Chess. There is a difference: it can advance one or two square from ANY position on the board. However, its capturing move is unchanged: one square diagonally forward. As a consequence, the en-passant capture is possible every time the opposite Pawn or Corporal or Prince has advanced two squares.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/pawn.png'>
</p>
<h2>Prince</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-admiral.png'>
</p>
<p class='piece-details'>This piece is simply a non-royal King combined with a Pawn. It can be found in Metamachy and has been inspired by medieval games like the Courier chess , an old chess variant, played in Germany, where it is called "Man". It moves one square in an arbitrary direction, like the King, but without being hindered by check. Here, like the Pawn, he can move without capturing to the second square straight ahead. When the Prince reaches the last row it promotes to an Emperor.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/prince.png' style="width:50%;height:50%;">
</p>
<h2>Elephant</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-elephant.png'>
</p>
<p class='piece-details'>As in Shako.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/elephant.png'>
</p>
<h2>Lion</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-lion.png'>
</p>
<p class='piece-details'>As in Metamachy, inspired (although with some simplification) by Chu Shogi, the most popular variant of the Japanese Chess. Here the Lion may move as a King (a single step move in any direction), or it may jump to a position two squares away, jumping in any orthogonal or diagonal direction, or alternatively jumping as a Knight in usual Chess. (Then this Lion has the same range but is more restricted than the Lion in Chu Shogi which can move two times in a turn). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/lion.png'>
</p>
<h2>Eagle</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-eagle.png'>
</p>
<p class='piece-details'>As in Metamachy, moves one square diagonally and then, goes away of an indefinite number of cases vertically or horizontally. It is authorized to go only one square diagonal. It can not jump and the unobstructed path must start with the diagonal movement. This piece is almost as powerful as the Queen and is inspired by the Giraffe from Tamerlane's Chess and the Aanca from Alfonso X's Grande Acedrex.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/eagle.png'>
</p>
<h2>Camel</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-camel.png'>
</p>
<p class='piece-details'>As in Metamachy, a well known piece from medieval Muslim great Chess like Tamerlane's Chess. It jumps to the opposite case of a 2x4 rectangle, like an extended Knight. No matter what intermediate cases contain. Note that it always stays on the same color of square.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/camel.png'>
</p>
<h2>Cannon</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-cannon.png'>
</p>
<p class='piece-details'>As in Xiangqi, in Shako and in Metamachy. (Also known as Pao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/cannon.png'>
</p>
<h2>Chancellor</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-marshall.png'>
</p>
<p class='piece-details'>It combines the move of Rook and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca and many others like Grand Chess or Gothic Chess. (under many other names: Champion, Guard, Empress, Concubine, Chancellor, etc. The later is sometimes preferred, however it is confusing since Capablanca used it once for R+N and once for B+N. It is an Elephant in Seirawan Chess).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/marshall.png'>
</p>
<h2>Cardinal</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-cardinal.png'>
</p>
<p class='piece-details'>It combines the move of Bishop and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca, Modern and many others like Grand Chess or Gothic Chess. (under many other names: Centaur, Minister, Equerry, Janus, Archbishop, Princess, Chancellor, etc. It is a Hawk in Seirawan Chess). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/cardinal.png'>
</p>
<h2>Commander</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-amazon.png'>
</p>
<p class='piece-details'>It combines the move of Queen and Knight. It was used in the Turkish-Indian Grand Chess (as a Giraffe). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/amazon.png'>
</p>
<h2>Lighthouse</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-lighthouse.png'>
</p>
<p class='piece-details'>It combines the Star and the Queen.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/lighthouse.png' style="width:25%;height:25%;">
</p>
<h2>Unicorn</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-unicorn.png'>
</p>
<p class='piece-details'>The Unicorn combines the Camel, Lion and Antelope and additionaly it can jump infinite times like a Knight in the same direction(like the Knightrider).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/unicorn.png' style="width:25%;height:25%;">
</p>
<h2>Dragon</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-dragon.png'>
</p>
<p class='piece-details'>The Dragon combines the Queen and the Eagle.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/dragon.png' style="width:25%;height:25%;">
</p>
<h2>Emperor</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-emperor.png'>
</p>
<p class='piece-details'>The Emperor combines the Dragon, Unicorn and Lighthouse. That means, that every Piece is included in the Emperor. You can only get the Emperor, when you promote a Prince.</p>
<div style='clear:both'></div>
<h1>Promotion</h1>
<h2>Pawn</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lca/pawnpromo.png'>
<h2>Prince</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lca/princepromo.png'>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,219 @@
/*
* Copyright(c) 2013-2017 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
View.Game.cbDefineView = function() {
var metamachyBoardDelta = {
//notationMode: 'in',
//notationDebug: true,
};
var metamachyBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,metamachyBoardDelta);
var metamachyBoard2d = $.extend(true,{},this.cbGridBoardClassic2DNoMargin,metamachyBoardDelta);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,metamachyBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,metamachyBoard3d),
},
boardLayout: [
".#.#.#.#.#.#",
"#.#.#.#.#.#.",
".#.#.#.#.#.#",
"#.#.#.#.#.#.",
".#.#.#.#.#.#",
"#.#.#.#.#.#.",
".#.#.#.#.#.#",
"#.#.#.#.#.#.",
".#.#.#.#.#.#",
"#.#.#.#.#.#.",
".#.#.#.#.#.#",
"#.#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(metamachyBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(metamachyBoard3d),
},
},
clicker: {
"2d": {
width: 1000,
height: 1000,
},
"3d": {
scale: [.6,.6,.6],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"3d": {
scale: [.4,.4,.4],
},
"2d": {
width: 900,
height: 900,
},
},
}),
};
}
/*
* Make the knight & the camel jump when moving, the elephant & the lion when moving 2 squares, the cannon when capturing
*/
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
if(aMove.a=='N' || aMove.a=='M' || (aMove.a=='E' && aGame.g.distGraph[aMove.f][aMove.t]==2) || (aMove.a=='L' && aGame.g.distGraph[aMove.f][aMove.t]==2) || (aMove.a=='K' && aGame.g.distGraph[aMove.f][aMove.t]==2) || (aMove.a=='C' && aMove.c!=null))
return Math.max(zFrom,zTo)+1500;
else
return (zFrom+zTo)/2;
}
/*
* View.Game.xdInit overriding to create initial setup gadgets
*/
var SuperViewGameXdInit = View.Game.xdInit;
View.Game.xdInit = function(xdv) {
var $this=this;
SuperViewGameXdInit.apply(this,arguments);
var size=600;
xdv.createGadget("setup-board",{
base: {
type: "element",
x: 0,
y: 0,
width: size*12,
height: size*9,
z: 108,
css: {
"background-color": "White",
},
},
});
var setups={
0: "KQEL",
1: "KQLE",
2: "KEQL",
3: "KLQE",
4: "KELQ",
5: "KLEQ",
6: "QEKL",
7: "QLKE",
8: "EQKL",
9: "LQKE",
10: "ELKQ",
11: "LEKQ",
}
var imageOffsets={
K: 500, Q: 400, E: 1100, L: 1200,
}
for(var setup in setups) {
(function(setup) {
var x=((setup%4)-1.5)*3*size;
var y=(Math.floor(setup/4)-1)*3*size;
xdv.createGadget("setup#"+setup,{
base: {
type: "canvas",
x: x,
y: y,
width: 2*size,
height: 2*size,
z: 109,
draw: function(ctx) {
ctx.fillStyle="#c0c0c0";
ctx.rect(-size,-size,size*2,size*2);
ctx.fill();
ctx.save();
this.getResource("image|"+$this.g.fullPath+"/res/fairy/wikipedia-fairy-sprites.png",function(image) {
for(var i=0;i<4;i++) {
var x=i%2, y=Math.floor(i/2), p=setups[setup].charAt(i);
ctx.drawImage(image,imageOffsets[p],0,100,100,(x-1)*size,(y-1)*size,size,size);
}
ctx.restore();
});
}
},
});
})(setup);
}
}
/*
* View.Board.xdInput overriding to handle setup phase
*/
var SuperViewBoardxdInput = View.Board.xdInput;
View.Board.xdInput = function(xdv, aGame) {
if(this.setupState===undefined) {
return {
initial: {},
getActions: function(moves,currentInput) { return null; },
}
} else if(this.setupState=="setup") {
return {
initial: {
setupDone: false,
},
getActions: function(moves,currentInput) {
var actions={};
if(!currentInput.setupDone) {
moves.forEach(function(move) {
actions[move.setup]={
view: ["setup#"+move.setup],
click: ["setup#"+move.setup],
moves: [move],
validate: { setupDone: true },
}
});
}
return actions;
},
furnitures: ["setup-board"],
}
} else
return SuperViewBoardxdInput.apply(this,arguments);
}
/*
* View.Board.cbAnimate overriding to prevent animation on setup
*/
var SuperViewBoardcbAnimate = View.Board.cbAnimate;
View.Board.cbAnimate = function(xdv,aGame,aMove,callback) {
if(this.setupState===undefined || this.setupState=="setup")
callback();
else
SuperViewBoardcbAnimate.apply(this,arguments);
}
/*
* View.Board.xdDisplay overriding to prevent displaying KQEL before setup
*/
var SuperViewBoardxdDisplay = View.Board.xdDisplay;
View.Board.xdDisplay = function(xdv, aGame) {
if(this.setupState===undefined || this.setupState=="setup") {
var $this=this;
var hidden={};
[5,6,17,18,125,126,137,138].forEach(function(pos) {
var pIndex=$this.board[pos];
hidden[pos]=pIndex;
$this.pieces[pIndex].p=-1;
});
SuperViewBoardxdDisplay.apply(this,arguments);
for(var pos in hidden)
this.pieces[hidden[pos]].p=parseInt(pos);
} else
SuperViewBoardxdDisplay.apply(this,arguments);
}
})();

View file

@ -0,0 +1,13 @@
<h1>Credits</h1>
<pre>
LeyChessBeta is based on Terachess.
The view.js is taked from Terachess.
Inventor: tilera
Developer: tilera
Inventor of Terachess: Jean-Louis Cazaux
Developer of Terachess: jcfrog
Developer of Jocly: Michel Gutierrez
Piece Graphic Designer:
Michel Gutierrez
jcfrog
</pre>

View file

@ -0,0 +1 @@
<p>LeyChessBeta is a 16*16 Chess Variant with Fairy Pieces based on Terachess</p>

View file

@ -0,0 +1,591 @@
/*
* Copyright(c) 2013-2014 - jocly.com
*
* You are allowed to use and modify this source code as long as it is exclusively for use in the Jocly API.
*
* Original authors: Jocly team
*
*/
(function() {
var firstRow=0;
var lastRow=15;
var firstCol=0;
var lastCol=15;
var geometry = Model.Game.cbBoardGeometryGrid(16,16);
// graphs
Model.Game.cbCorporalGraph = function(geometry,side,confine) {
var $this=this;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
var directions=[];
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine))) {
var direction=[pos1 | $this.cbConstants.FLAG_MOVE];
var pos2=geometry.Graph(pos1,[0,side]);
if(pos2!=null && (!confine || (pos2 in confine)))
direction.push(pos2 | $this.cbConstants.FLAG_MOVE);
directions.push($this.cbTypedArray(direction));
}
[-1,1].forEach(function(dc) {
var pos2=geometry.Graph(pos,[dc,side]);
if(pos2!=null && (!confine || (pos2 in confine)))
directions.push($this.cbTypedArray([pos2 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE]));
});
graph[pos]=directions;
}
return graph;
}
Model.Game.cbPrinceGraph = function(geometry,side,confine) {
var $this=this;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
graph[pos]=[];
var forward=[]; // hold the pos line in front of the piece
var pos1=geometry.Graph(pos,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine))) {
forward.push(pos1 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE); // capture and move allowed at first forward position
pos1=geometry.Graph(pos1,[0,side]);
if(pos1!=null && (!confine || (pos1 in confine)))
forward.push(pos1 | $this.cbConstants.FLAG_MOVE); // move to second forward only, no capture
graph[pos].push($this.cbTypedArray(forward));
}
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[-1,0],[1,0],[1,-1],[1,1],[0,-side]]), // direction other than forward
graph // forward direction
);
}
Model.Game.cbEagleGraph = function(geometry){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=0;dir<2;dir++) { // dir=0 for row, dir=1 for column
var nbMax = (dir==0) ? lastRow : lastCol;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
Model.Game.cbShipGraph = function(geometry){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
graph[pos]=[];
[[-1,-1],[-1,1],[1,-1],[1,1]].forEach(function(delta) { // loop on all 4 diagonals
var pos1=geometry.Graph(pos,delta);
if(pos1!=null) {
for(var dir=1;dir<2;dir++) { // dir=0 for row, dir=1 for column
var nbMax = (dir==0) ? lastRow : lastCol;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[];
delta2[dir]=delta[dir]*n;
delta2[1-dir]=0; // delta2 is now only about moving orthogonally, away from the piece
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags);
}
}
if(away.length>0)
graph[pos].push($this.cbTypedArray(away));
}
}
});
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1]]),
graph
);
}
Model.Game.cbRhinoGraph = function(geometry,confine){
var $this=this;
var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE;
var graph={};
for(var pos=0;pos<geometry.boardSize;pos++) {
if(confine && !(pos in confine)){
graph[pos]=[];
continue;
}
var directions=[];
[[1,2],[2,1],[1,-2],[2,-1],[-1,2],[-2,1],[-1,-2],[-2,-1]].forEach(function(delta) { // loop on all 8 diagonals
var movedir = [Math.sign(delta[0]),Math.sign(delta[1])];
var pos1=geometry.Graph(pos,delta);
if(pos1!=null && (!confine || (pos1 in confine))) {
var direction=[pos1 | $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE | $this.cbConstants.FLAG_STOP];
//directions.push($this.cbTypedArray(direction));
var nbMax = Math.max(lastRow , lastCol) - 1;
var away=[] // hold the sliding line
for(var n=1;n<nbMax;n++) {
var delta2=[movedir[0]*n,movedir[1]*n];
var pos2=geometry.Graph(pos1,delta2);
if(pos2!=null && (!confine || (pos2 in confine))) {
if(n==1) // possible to slide at least 1 cell, make sure the diagonal cell is not occupied, but cannot move to this cell
away.push(pos1 | $this.cbConstants.FLAG_STOP);
away.push(pos2 | flags | $this.cbConstants.FLAG_STOP);
}
}
if(away.length>0)
directions.push($this.cbTypedArray(away));
}
});
graph[pos]=directions;
}
return $this.cbMergeGraphs(geometry,
$this.cbShortRangeGraph(geometry,[[1,2],[2,1],[1,-2],[2,-1],[-1,2],[-2,1],[-1,-2],[-2,-1]]),
graph
);
}
var confine = {};
for(var pos=0;pos<geometry.boardSize;pos++) {
confine[pos]=1;
}
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name : 'ipawnw',
abbrev : '',
fenAbbrev: 'P',
aspect : 'fr-pawn',
graph : this.cbInitialPawnGraph(geometry,1,confine),
value : 0.5,
initial: [{s:1,p:48},{s:1,p:49},{s:1,p:50},{s:1,p:51},{s:1,p:52},{s:1,p:53},{s:1,p:54},{s:1,p:55},{s:1,p:56},{s:1,p:57},{s:1,p:58},{s:1,p:59},{s:1,p:60},{s:1,p:61},{s:1,p:62},{s:1,p:63}],
epCatch : false,
epTarget : false,
},
1: {
name : 'ipawnb',
abbrev : '',
fenAbbrev: 'P',
aspect : 'fr-pawn',
graph : this.cbInitialPawnGraph(geometry,-1,confine),
value : 0.5,
initial: [{s:-1,p:192},{s:-1,p:193},{s:-1,p:194},{s:-1,p:195},{s:-1,p:196},{s:-1,p:197},{s:-1,p:198},{s:-1,p:199},{s:-1,p:200},{s:-1,p:201},{s:-1,p:202},{s:-1,p:203},{s:-1,p:204},{s:-1,p:205},{s:-1,p:206},{s:-1,p:207}],
epCatch : false,
epTarget : false,
},
2: {
name : 'corporalw',
abbrev : 'O',
aspect : 'fr-corporal',
graph : this.cbCorporalGraph(geometry,1,confine),
value : 0.8,
initial: [{s:1,p:16},{s:1,p:17},{s:1,p:18},{s:1,p:19},{s:1,p:20},{s:1,p:27},{s:1,p:28},{s:1,p:29},{s:1,p:30},{s:1,p:31}],
epCatch : false,
epTarget : false,
},
3: {
name : 'corporalb',
abbrev : 'O',
aspect : 'fr-corporal',
graph : this.cbCorporalGraph(geometry,-1,confine),
value : 0.8,
initial: [{s:-1,p:224},{s:-1,p:225},{s:-1,p:226},{s:-1,p:227},{s:-1,p:228},{s:-1,p:235},{s:-1,p:236},{s:-1,p:237},{s:-1,p:238},{s:-1,p:239}],
epCatch : false,
epTarget : false,
},
4: {
name : 'princew',
abbrev : 'I',
aspect : 'fr-admiral',
graph : this.cbPrinceGraph(geometry,1,confine),
value : 2.2,
initial: [{s:1,p:38},{s:1,p:41}],
epTarget : false,
},
5: {
name : 'princeb',
abbrev : 'I',
aspect : 'fr-admiral',
graph : this.cbPrinceGraph(geometry,-1,confine),
value : 2.2,
initial: [{s:-1,p:214},{s:-1,p:217}],
epTarget : false,
},
6: {
name : 'rook',
abbrev : 'R',
aspect : 'fr-rook',
graph : this.cbRookGraph(geometry,confine),
value : 5,
initial: [{s:1,p:34},{s:1,p:45},{s:-1,p:210},{s:-1,p:221}],
},
7: {
name : 'bishop',
abbrev : 'B',
aspect : 'fr-bishop',
graph : this.cbBishopGraph(geometry,confine),
value : 3.4,
initial: [{s:1,p:36},{s:1,p:43},{s:-1,p:212},{s:-1,p:219}],
},
8: {
name : 'knight',
abbrev : 'N',
aspect : 'fr-knight',
graph : this.cbKnightGraph(geometry,confine),
value : 2,
initial: [{s:1,p:35},{s:1,p:44},{s:-1,p:211},{s:-1,p:220}],
},
9: {
name : 'queen',
abbrev : 'Q',
aspect : 'fr-queen',
graph : this.cbQueenGraph(geometry,confine),
value : 8.3,
initial: [{s:1,p:39},{s:-1,p:215}],
},
10: {
name : 'king',
abbrev : 'K',
aspect : 'fr-king',
graph : this.cbKingGraph(geometry,confine),
isKing : true,
initial: [{s:1,p:40},{s:-1,p:216}],
},
11: {
name : 'star',
abbrev : 'S',
aspect : 'fr-star',
graph : this.cbLongRangeGraph(geometry,[[0,-1],[0,1],[-1,0],[1,0],[1,1],[1,-1],[-1,-1],[-1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
value : 8.2,
initial: [{s:1,p:7},{s:-1,p:247}],
},
12: {
name : 'bow',
abbrev : 'W',
aspect : 'fr-bow',
graph : this.cbLongRangeGraph(geometry,[[-1,-1],[1,1],[-1,1],[1,-1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
value : 3.3,
initial: [{s:1,p:2},{s:1,p:13},{s:-1,p:242},{s:-1,p:253}],
},
13: {
name : 'rhino',
abbrev : 'U',
aspect : 'fr-rhino',
graph : this.cbRhinoGraph(geometry,confine),
value : 6.1,
initial: [{s:1,p:6},{s:-1,p:246}],
},
14: {
name : 'bull',
abbrev : 'T',
aspect : 'fr-bull',
graph : this.cbShortRangeGraph(geometry,[
[2,3],[3,2],[2,-3],[3,-2],[-2,3],[-3,2],[-2,-3],[-3,-2]
],confine),
value : 1.7,
initial: [{s:1,p:3},{s:1,p:12},{s:-1,p:243},{s:-1,p:252}],
},
15: {
name : 'antelope',
abbrev : 'G',
aspect : 'fr-antelope',
graph : this.cbShortRangeGraph(geometry,[
[2,2],[3,3],[2,-2],[3,-3],[-2,2],[-3,3],[-2,-2],[-3,-3],
[2,0],[3,0],[-2,0],[-3,0],[0,2],[0,3],[0,-2],[0,-3]
],
confine),
value : 3.7,
initial: [{s:1,p:0},{s:1,p:15},{s:-1,p:240},{s:-1,p:255}],
},
16: {
name : 'lion',
abbrev : 'L',
aspect : 'fr-lion',
graph : this.cbShortRangeGraph(geometry,[
[-1,-1],[-1,1],[1,-1],[1,1],[1,0],[0,1],[-1,0],[0,-1],
[-2,0],[-2,-1],[-2,-2],[-1,-2],[0,-2],
[1,-2],[2,-2],[2,-1],[2,0],[2,1],
[2,2],[1,2],[0,2],[-1,2],[-2,2],[-2,1]
], confine),
value : 6,
initial: [{s:1,p:23},{s:-1,p:231}],
},
17: {
name : 'elephant',
abbrev : 'E',
aspect : 'fr-elephant',
graph : this.cbShortRangeGraph(geometry,[[-1,-1],[-1,1],[1,-1],[1,1],[-2,-2],[-2,2],[2,-2],[2,2]],confine),
value : 2,
initial: [{s:1,p:32},{s:1,p:47},{s:-1,p:208},{s:-1,p:223}],
},
18: {
name : 'cannon',
abbrev : 'Z',
aspect : 'fr-cannon2',
graph : this.cbXQCannonGraph(geometry),
value : 5,
initial: [{s:1,p:4},{s:1,p:11},{s:-1,p:244},{s:-1,p:251}],
},
19: {
name : 'machine',
abbrev : 'D',
aspect : 'fr-machine',
graph : this.cbShortRangeGraph(geometry,[[-1,0],[-2,0],[1,0],[2,0],[0,1],[0,2],[0,-1],[0,-2]],confine),
value : 2.2,
initial: [{s:1,p:33},{s:1,p:46},{s:-1,p:209},{s:-1,p:222}],
},
20: {
name : 'buffalo',
abbrev : 'F',
aspect : 'fr-buffalo',
graph : this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine),
value : 5.4,
initial: [{s:1,p:5},{s:-1,p:245}],
},
21: {
name : 'ship',
abbrev : 'X',
aspect : 'fr-ship',
graph : this.cbShipGraph(geometry),
value : 4.4,
initial: [{s:1,p:37},{s:1,p:42},{s:-1,p:213},{s:-1,p:218}],
},
22: {
name : 'eagle',
abbrev : 'H',
aspect : 'fr-eagle',
graph : this.cbEagleGraph(geometry),
value : 8.4,
initial: [{s:1,p:24},{s:-1,p:232}],
},
23: {
name : 'camel',
abbrev : 'J',
aspect : 'fr-camel',
graph : this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]]),
value : 2,
initial: [{s:1,p:1},{s:1,p:14},{s:-1,p:241},{s:-1,p:254}],
},
24: {
name : 'amazon',
abbrev : 'A',
aspect : 'fr-amazon',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbQueenGraph(geometry,confine)),
value : 10.2,
initial: [{s:1,p:8},{s:-1,p:248}],
},
25: {
name : 'marshall',
abbrev : 'M',
aspect : 'fr-marshall',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbRookGraph(geometry,confine)),
value : 6.9,
initial: [{s:1,p:9},{s:-1,p:249}],
},
26: {
name : 'cardinal',
abbrev : 'C',
aspect : 'fr-cardinal',
graph : this.cbMergeGraphs(geometry,
this.cbKnightGraph(geometry,confine),
this.cbBishopGraph(geometry,confine)),
value : 5.3,
initial: [{s:1,p:10},{s:-1,p:250}],
},
27: {
name: 'unicorn',
aspect: 'fr-unicorn',
graph: this.cbMergeGraphs(geometry,
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKingGraph(geometry),
this.cbKnightGraph(geometry),
this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]])
),
value: 13,
abbrev: 'Pa',
initial: [{s:1,p:26},{s:-1,p:234}],
},
28: {
name: 'dragon',
aspect: 'fr-dragon',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbEagleGraph(geometry)),
value: 14,
abbrev: 'Dr',
initial: [{s:1,p:25},{s:-1,p:233}],
},
29: {
name: 'lighthouse',
aspect: 'fr-lighthouse',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE)),
value: 12,
abbrev: 'LH',
initial: [{s:1,p:21},{s:-1,p:229}],
},
30: {
name: 'emperor',
aspect: 'fr-crowned-rook',
graph: this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry),
this.cbXQCannonGraph(geometry),
this.cbLongRangeGraph(geometry,[[1,-1],[-1,-1],[-1,1],[1,1]],null,this.cbConstants.FLAG_MOVE | this.cbConstants.FLAG_SCREEN_CAPTURE),
this.cbEagleGraph(geometry),
this.cbShortRangeGraph(geometry,[
[-2,-2],[-2,0],[-2,2],[0,2],[2,2],[2,0],[2,-2],[0,-2],
[-3,-3],[-3,0],[-3,3],[0,3],[3,3],[3,0],[3,-3],[0,-3]]),
this.cbKnightGraph(geometry),
this.cbLongRangeGraph(geometry,[[2,-1],[2,1],[-2,-1],[-2,1],[-1,2],[-1,-2],[1,2],[1,-2]]),
this.cbShortRangeGraph(geometry,[[-3,-1],[-3,1],[3,-1],[3,1],[1,3],[1,-3],[-1,3],[-1,-3]]),
this.cbRhinoGraph(geometry,confine),
this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine),
this.cbLongRangeGraph(geometry,
[
[-2,-2],[2,2],[-2,2],[2,-2],
[-2,0],[2,0],[0,2],[0,-2]
],
confine)),
value: 20,
abbrev: 'EM',
},
31: {
name : 'buffaloriderqueen',
abbrev : 'Brq',
aspect : 'fr-prince',
graph : this.cbMergeGraphs(geometry,
this.cbQueenGraph(geometry,confine),
this.cbShortRangeGraph(geometry,[
[1,2],[1,3],[2,1],[2,3],[3,1],[3,2],
[1,-2],[1,-3],[2,-1],[2,-3],[3,-1],[3,-2],
[-1,-2],[-1,-3],[-2,-1],[-2,-3],[-3,-1],[-3,-2],
[-1,2],[-1,3],[-2,1],[-2,3],[-3,1],[-3,2]
],confine)),
value : 14,
initial: [{s:1,p:22},{s:-1,p:230}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==0 && geometry.R(move.t)==15)
return [24,22,20,16,15,13,11];
else if(piece.t==1 && geometry.R(move.t)==0)
return [24,22,20,16,15,13,11];
else if(piece.t==4 && geometry.R(move.t)==15)
return [30];
else if(piece.t==5 && geometry.R(move.t)==0)
return [30];
else if(piece.t==2 && geometry.R(move.t)==15)
return [27,28,29,31];
else if(piece.t==3 && geometry.R(move.t)==0)
return [27,28,29,31];
return [];
},
};
}
var SuperModelBoardGenerateMoves=Model.Board.GenerateMoves;
Model.Board.GenerateMoves = function(aGame) {
var $this = this;
SuperModelBoardGenerateMoves.apply(this,arguments); // call regular GenerateMoves method
}
var SuperModelBoardApplyMove=Model.Board.ApplyMove;
Model.Board.ApplyMove = function(aGame,move) {
// console.log("ApplyMove entrance",aGame,move);
var $this = this;
SuperModelBoardApplyMove.apply(this,arguments); // call regular GenerateMoves method
}
})();

View file

@ -0,0 +1,269 @@
<h1 style="font-size:300%;">LeyChessBeta Rules</h1>
<h1>Setup</h1>
<img src="res/visuals/leychessbeta-600x600-2d.jpg" alt="Your Browser suck:(" style="width:320px;height:320px;">
<h1>Pieces</h1>
<h2>King</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-king.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/king.png'>
</p>
<h2>Queen</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-queen.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/queen.png'>
</p>
<h2>Bishop</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bishop.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bishop.png'>
</p>
<h2>Knight</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-knight.png'>
</p>
<p class='piece-details'>Moves as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/knight.png'>
</p>
<h2>Rook</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-rook.png'>
</p>
<p class='piece-details'>Exactly as in usual Chess.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/rook.png'>
</p>
<h2>Pawn</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-pawn.png'>
</p>
<p class='piece-details'>The Pawn is almost similar to usual Chess. There is a difference: it can advance one or two square from ANY position on the board. However, its capturing move is unchanged: one square diagonally forward. As a consequence, the en-passant capture is possible every time the opposite Pawn or Corporal or Prince has advanced two squares.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/pawn.png'>
</p>
<h2>Corporal</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-corporal.png'>
</p>
<p class='piece-details'>An extended Pawn. He can advance one or two square from any position on the board and its capturing move is one square diagonally forward. The improvement is that the Corporal can also advance 1 step diagonally forward. (So, with or without capturing). The Corporal can take en-passant every time an opposite Pawn or Corporal or Prince has advanced two squares.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/corporal.png'>
</p>
<h2>Prince</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-admiral.png'>
</p>
<p class='piece-details'>This piece is simply a non-royal King combined with a Pawn. It can be found in Metamachy and has been inspired by medieval games like the Courier chess , an old chess variant, played in Germany, where it is called "Man". It moves one square in an arbitrary direction, like the King, but without being hindered by check. Here, like the Pawn, he can move without capturing to the second square straight ahead. When the Prince reaches the last row it promotes to an Emperor.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/prince.png' style="width:50%;height:50%;">
</p>
<h2>Elephant</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-elephant.png'>
</p>
<p class='piece-details'>As in Shako.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/elephant.png'>
</p>
<h2>Machine</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-machine.png'>
</p>
<p class='piece-details'>It is an orthogonal counterpart of the Elephant as it moves 1 or 2 cases orthogonally, jumping over the first case if it is occupied. Then, it combines the moves of old Dabbaba and Wazir found in ancient Muslim Chess variants.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/machine.png'>
</p>
<h2>Lion</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-lion.png'>
</p>
<p class='piece-details'>As in Metamachy, inspired (although with some simplification) by Chu Shogi, the most popular variant of the Japanese Chess. Here the Lion may move as a King (a single step move in any direction), or it may jump to a position two squares away, jumping in any orthogonal or diagonal direction, or alternatively jumping as a Knight in usual Chess. (Then this Lion has the same range but is more restricted than the Lion in Chu Shogi which can move two times in a turn). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/lion.png'>
</p>
<h2>Eagle</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-eagle.png'>
</p>
<p class='piece-details'>As in Metamachy, moves one square diagonally and then, goes away of an indefinite number of cases vertically or horizontally. It is authorized to go only one square diagonal. It can not jump and the unobstructed path must start with the diagonal movement. This piece is almost as powerful as the Queen and is inspired by the Giraffe from Tamerlane's Chess and the Aanca from Alfonso X's Grande Acedrex.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/eagle.png'>
</p>
<h2>Ship</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-ship.png'>
</p>
<p class='piece-details'>Originally invented for Tamerlane 2000, it moves one square diagonally and then, goes away of an indefinite number of cases vertically, never horizontally. It can move one square diagonally only. It can not jump and must begin its move with the diagonal step. The Ship is more limited than the Eagle (which can move horizontally). Nevertheless its move power is comparable to the Rook and the Bishop.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/ship.png'>
</p>
<h2>Camel</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-camel.png'>
</p>
<p class='piece-details'>As in Metamachy, a well known piece from medieval Muslim great Chess like Tamerlane's Chess. It jumps to the opposite case of a 2x4 rectangle, like an extended Knight. No matter what intermediate cases contain. Note that it always stays on the same color of square.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/camel.png'>
</p>
<h2>Cannon</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-cannon.png'>
</p>
<p class='piece-details'>As in Xiangqi, in Shako and in Metamachy. (Also known as Pao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/cannon.png'>
</p>
<h2>Bow</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bow.png'>
</p>
<p class='piece-details'>It is the diagonal counterpart of the Chinese Cannon. It moves like a Bishop and needs an intermediate piece between itself and its victim to capture it. The Bow jumps the intermediate and takes the victim on its square. The intermediate is left unaffected. (Also known as Vao by problemists).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bow.png'>
</p>
<h2>Buffalo</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-buffalo.png'>
</p>
<p class='piece-details'>Combines the leaps of the Knight (3x2), the Camel (4x2) and the Bull (see Terachess) (4x3).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/buffalo.png'>
</p>
<h2>Chancellor</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-marshall.png'>
</p>
<p class='piece-details'>It combines the move of Rook and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca and many others like Grand Chess or Gothic Chess. (under many other names: Champion, Guard, Empress, Concubine, Chancellor, etc. The later is sometimes preferred, however it is confusing since Capablanca used it once for R+N and once for B+N. It is an Elephant in Seirawan Chess).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/marshall.png'>
</p>
<h2>Cardinal</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-cardinal.png'>
</p>
<p class='piece-details'>It combines the move of Bishop and Knight. It can be found in many, many chess variants since Carrera, Bird, Capablanca, Modern and many others like Grand Chess or Gothic Chess. (under many other names: Centaur, Minister, Equerry, Janus, Archbishop, Princess, Chancellor, etc. It is a Hawk in Seirawan Chess). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/cardinal.png'>
</p>
<h2>Commander</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-amazon.png'>
</p>
<p class='piece-details'>It combines the move of Queen and Knight. It was used in the Turkish-Indian Grand Chess (as a Giraffe). </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/amazon.png'>
</p>
<h2>Bull</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-bull.png'>
</p>
<p class='piece-details'>Jumps to the opposite case of a 3x4 rectangle, like an extended Knight. No matter what intermediate cases contain. Note that it always changes the same color of its square. The same move is found in Janggi, Korean Chess, for the Elephant. Under the name of Zebra, it is also a fairy piece used by problemists for compositions.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/bull.png'>
</p>
<h2>Antelope</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-antelope.png'>
</p>
<p class='piece-details'>Jumps 2 or 3 step orthogonally or diagonally. No matter what intermediate squares contain. This is an original piece, exclusive to this game.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/antelope.png'>
</p>
<h2>Rhinoceros</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-rhino.png'>
</p>
<p class='piece-details'>Jumps as a Knight then slides diagonally away. This piece is inspired by the Unicorn of mediaeval Grande Acedrex. </p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/rhino.png'>
</p>
<h2>Star</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-star.png'>
</p>
<p class='piece-details'>It moves like a Queen and needs an intermediate piece between itself and its victim to capture it. The Star jumps the intermediate and takes the victim on its square. The intermediate is left unaffected. Like the Queen is Bishop + Rook, the Star is Cannon + Bow.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/star.png'>
</p>
<h2>Lighthouse</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-lighthouse.png'>
</p>
<p class='piece-details'>It combines the Star and the Queen.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/lighthouse.png' style="width:25%;height:25%;">
</p>
<h2>Unicorn</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-unicorn.png'>
</p>
<p class='piece-details'>The Unicorn combines the Camel, Lion and Antelope and additionaly it can jump infinite times like a Knight in the same direction(like the Knightrider).</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/unicorn.png' style="width:25%;height:25%;">
</p>
<h2>Buffaloriderqueen</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-prince.png'>
</p>
<p class='piece-details'>The Buffaloriderqueen combines the Queen, Knightrider move(Infinite times like a Knight in the same direction) and the Buffalo.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/brq.png' style="width:25%;height:25%;">
</p>
<h2>Dragon</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-dragon.png'>
</p>
<p class='piece-details'>The Dragon combines the Queen and the Eagle.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='res/rules/graphs/leychess/lcb/dragon.png' style="width:25%;height:25%;">
</p>
<h2>Emperor</h2>
<p>
<img class='piece-icon' src='res/fairy/icons/w-emperor.png'>
</p>
<p class='piece-details'>The Emperor combines the Dragon, Buffaloriderqueen, Unicorn, Rhinoceros and Lighthouse. That means, that every Piece is included in the Emperor. You can only get the Emperor, when you promote a Prince.</p>
<div style='clear:both'></div>
<h1>Promotion</h1>
<h2>Pawn</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lcb/pawnpromo.png'>
<h2>Corporal</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lcb/corpopromo.png'>
<h2>Prince</h2>
<img alt='Restart your Browser' src='res/rules/graphs/leychess/lca/princepromo.png'>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,258 @@
/*
*
*
*
* authors: jerome choain
*
*/
(function() {
function createTexturedPatternCanvas(W,H,texture,clipW,clipH,mask,borderFact){
// borderFact is the percentage (/100) of the mask transition overlay border : ex 30% => .3
var cv = document.createElement('canvas');
cv.width=W;
cv.height=H;
var ctx=cv.getContext('2d');
var maskW=mask.width;
var maskH=mask.height;
var textW=texture.width;
var textH=texture.height;
var tmp = document.createElement('canvas');
ctx.globalCompositeOperation='or';
var y=0;
for (var i=0; y<=(H+clipH/2);i++){
var x=0;
for (var j=0; x<=(W+clipW/2);j++){
tmp.width=clipW; tmp.height=clipH;
ctxTmp=tmp.getContext('2d');
ctxTmp.globalCompositeOperation='xor';
ctxTmp.drawImage(texture, Math.random()*(textW-clipW),Math.random()*(textH-clipH),clipW,clipH,0,0,clipW,clipH);
ctxTmp.drawImage(mask,0,0,clipW,clipH);
ctx.drawImage(tmp,x-clipW/2,y-clipH/2,clipW,clipH);
x+=clipW-borderFact*clipW;
}
y+=clipH-borderFact*clipH;
}
return cv;
}
// Reducing the promo frame which was overflowing the board screen
View.Game.cbPromoSize = 1100;
// extending fairy pieces with some musketeer new pieces
View.Game.cbFairyTerachessPieceStyle3D = $.extend(true,{},View.Game.cbFairyPieceStyle3D,{
});
View.Game.cbDefineView = function() {
var terachessBoardDelta = {
notationMode: "out",
//notationDebug: true,
}
terachessBoardDelta3d = $.extend(true,{},terachessBoardDelta,
{
/*'colorFill' : {
".": "#575b36", // "rgba(180,213,80,.3)",
"#": "#474b36", // "black" cells
" ": "rgba(0,0,0,0)",
},*/
'colorFill' : {
"#": "rgba(204,40,0,1)",
".": "rgba(180,180,0,1)",
},
'texturesImg' : {
'crackles': '/res/images/crackles.jpg',
'tiler': '/res/images/tileralpha.png',
},
'3D':true,
'margins' : {x:.47,y:.47},
'extraChannels':[
'bump'
],
paintCell: function(spec,ctx,images,channel,cellType,xCenter,yCenter,cx,cy) {
var tW=images['crackles'].width;
var tH=images['crackles'].height;
var tClipCx=200;
var tClipCy=200;
ctx.fillStyle="#000000";
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
if(channel=="bump"){
return;
}
cx=.98*cx;
cy=.98*cy;
ctx.save();
ctx.strokeStyle = "rgba(0,0,0,1)";
ctx.lineWidth = 50;
if (channel=='diffuse')
ctx.fillStyle=spec.colorFill[cellType];
else
ctx.fillStyle=0xffffff;
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.globalCompositeOperation = 'multiply';
ctx.drawImage(images['crackles'],
Math.random()*(tW-tClipCx),Math.random()*(tH-tClipCy),tClipCx,tClipCy,
xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.restore();
},
paintBackground: function(spec,ctx,images,channel,bWidth,bHeight) {
ctx.save();
ctx.fillStyle="#ffffff";
if (channel=='diffuse')
ctx.fillStyle="#BA784A";
//ctx.fillStyle="#cc6600";
var cSize = this.cbCSize(spec);
ctx.fillRect(-bWidth/2,-bHeight/2,bWidth,bHeight);
var textureCanvas=createTexturedPatternCanvas(1200,800,images['crackles'],200,200,images['tiler'],.3);
ctx.globalCompositeOperation='multiply';
ctx.drawImage(textureCanvas,-bWidth/2,-bHeight/2,bWidth,bHeight);
ctx.restore();
},
}
);
terachessBoardDelta2d = $.extend(true,{},terachessBoardDelta,
{
'colorFill' : {
".": "#ffffc0", // "white" cells
"#": "#8F976D", // "black" cells
" ": "rgba(0,0,0,0)",
},
'texturesImg' : {}, // to avoid default wood texture
'margins' : {x:.47,y:.47},
/*'colorFill' : {
".": "rgba(224,50,0,1)",
"#": "rgba(220,220,0,1)",
},*/
}
);
var terachessBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,terachessBoardDelta3d);
var terachessBoard2d = $.extend(true,{},this.cbGridBoardClassic2DMargin,terachessBoardDelta2d);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,terachessBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,terachessBoard3d),
},
boardLayout: [
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(terachessBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(terachessBoard3d),
},
},
clicker: {
"2d": {
width: 700,
height: 700,
},
"3d": {
scale: [0.45,0.45,0.45],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"2d": {
width: 650,
height: 650,
},
"3d": {
scale: [0.3,0.3,0.3],
display: this.cbDisplayPieceFn(this.cbFairyTerachessPieceStyle3D)
},
},
"fr-amazon" :{
"3d": {
scale: [0.36,0.36,0.36],
}
},
"fr-star" :{
"3d":{scale:[0.36,0.36,0.36]},
},
"fr-rhino" :{
"3d":{scale:[0.24,0.24,0.24]},
},
"fr-bull" :{
"3d":{scale:[0.21,0.21,0.21]},
},
"fr-antelope" :{
"3d":{scale:[0.24,0.24,0.24]},
},
}),
};
}
/* Make the jumps */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geo=aGame.cbVar.geometry;
var dx=Math.abs(geo.C(aMove.t)-geo.C(aMove.f));
var dy=Math.abs(geo.R(aMove.t)-geo.R(aMove.f));
if(("_N_E_D_L_J_T_F_G_S_".indexOf("_"+aMove.a+"_")>=0) && (aGame.g.distGraph[aMove.f][aMove.t]>1))
return Math.max(zFrom,zTo)+2000;
else if(("_A_C_M_".indexOf("_"+aMove.a+"_")>=0) && dx!=dy && dx!=0 && dy!=0)
return Math.max(zFrom,zTo)+2000;
else if(("_Z_W_".indexOf("_"+aMove.a+"_")>=0) && aMove.c != null)
return Math.max(zFrom,zTo)+2000;
else
return (zFrom+zTo)/2;
}
/*
* View.Board.xdDisplay overriding to prevent displaying black xtra pieces before setup
*/
var SuperViewBoardxdDisplay = View.Board.xdDisplay;
View.Board.xdDisplay = function(xdv, aGame) {
var size = 1060;
SuperViewBoardxdDisplay.apply(this,arguments);
}
/*
* View.Game.xdInit overriding to create initial setup gadgets
*/
var SuperViewGameXdInit = View.Game.xdInit;
View.Game.xdInit = function(xdv) {
var size = 1060;
var $this=this;
SuperViewGameXdInit.apply(this,arguments);
}
})();

View file

@ -0,0 +1,340 @@
(function() {
var geometry = Model.Game.cbBoardGeometryGrid(8,8);
var USE_TYPED_ARRAYS = typeof Int32Array != "undefined";
var MASK = 0xffff; // unreachable position
var FLAG_MOVE = 0x10000; // move to if target pos empty
var FLAG_CAPTURE = 0x20000; // capture if occupied by enemy
var FLAG_STOP = 0x40000; // stop if occupied
var FLAG_SCREEN_CAPTURE = 0x80000; // capture if occupied by and a piece has been jumped in the path (like cannon in xiangqi)
Model.Game.cbDefine = function() {
return {
geometry: geometry,
pieceTypes: {
0: {
name: 'pawn-w',
aspect: 'pawn',
graph: this.cbPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
},
1: {
name: 'ipawn-w',
aspect: 'pawn',
graph: this.cbInitialPawnGraph(geometry,1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:1,p:8},{s:1,p:9},{s:1,p:10},{s:1,p:11},{s:1,p:12},{s:1,p:13},{s:1,p:14},{s:1,p:15}],
epTarget: true,
},
2: {
name: 'pawn-b',
aspect: 'pawn',
graph: this.cbPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
epCatch: true,
},
3: {
name: 'ipawn-b',
aspect: 'pawn',
graph: this.cbInitialPawnGraph(geometry,-1),
value: 1,
abbrev: '',
fenAbbrev: 'P',
initial: [{s:-1,p:48},{s:-1,p:49},{s:-1,p:50},{s:-1,p:51},{s:-1,p:52},{s:-1,p:53},{s:-1,p:54},{s:-1,p:55}],
epTarget: true,
},
4: {
name: 'knight',
graph: this.cbKnightGraph(geometry),
value: 2.9,
abbrev: 'N',
initial: [{s:1,p:1},{s:1,p:6},{s:-1,p:57},{s:-1,p:62}],
},
5: {
name: 'bishop',
graph: this.cbBishopGraph(geometry),
value: 3.1,
abbrev: 'B',
initial: [{s:1,p:2},{s:1,p:5},{s:-1,p:58},{s:-1,p:61}],
},
6: {
name: 'rook',
graph: this.cbRookGraph(geometry),
value: 5,
abbrev: 'R',
initial: [{s:1,p:0},{s:1,p:7},{s:-1,p:56},{s:-1,p:63}],
},
7: {
name: 'queen',
graph: this.cbQueenGraph(geometry),
value: 9,
abbrev: 'Q',
initial: [{s:1,p:3},{s:-1,p:59}],
},
8: {
name: 'king',
graph: this.cbKingGraph(geometry),
abbrev: 'K',
initial: [{s:1,p:4},{s:-1,p:60}],
},
},
promote: function(aGame,piece,move) {
if(piece.t==1)
return [0];
else if(piece.t==3)
return [2];
else if(piece.t==0 && geometry.R(move.t)==7)
return [4,5,6,7,8];
else if(piece.t==2 && geometry.R(move.t)==0)
return [4,5,6,7,8];
return [];
}
};
}
Model.Board.Evaluate = function(aGame) {
var debug=arguments[3]=="debug";
var $this=this;
this.mEvaluation=0;
var who=this.mWho;
var g=aGame.g;
var material;
if(USE_TYPED_ARRAYS)
material={
'1': {
count: new Uint8Array(g.pTypes.length),
byType: {},
},
'-1': {
count: new Uint8Array(g.pTypes.length),
byType: {},
}
}
else {
material={
'1': {
count: [],
byType: {},
},
'-1': {
count: [],
byType: {},
}
}
for(var i=0;i<g.pTypes.length;i++)
material["1"].count[i]=material["-1"].count[i]=0;
}
if(aGame.mOptions.preventRepeat && aGame.GetRepeatOccurence(this)>2) {
this.mFinished=true;
this.mWinner=aGame.cbOnPerpetual?who*aGame.cbOnPerpetual:JocGame.DRAW;
return;
}
var pieceValue={ '1': 0, '-1': 0 };
var pieceCount={ '1': 0, '-1': 0 };
var posValue={ '1': 0, '-1': 0 };
var pieces=this.pieces;
var piecesLength=pieces.length;
for(var i=0;i<piecesLength;i++) {
var piece=pieces[i];
if(piece.p>=0) {
var s=piece.s;
var pType=g.pTypes[piece.t];
pieceValue[s]+=pType.value;
pieceCount[s]++;
posValue[s]+=aGame.cbVar.geometry.distEdge[piece.p];
var mat=material[s];
mat.count[piece.t]++;
var byType=mat.byType;
if(byType[piece.t]===undefined)
byType[piece.t]=[piece];
else
byType[piece.t].push(piece);
}
}
if(pieceCount['1']==0) {
this.mFinished = true;
this.mWinner = 1;
return;
}
if(pieceCount['-1']==0) {
this.mFinished = true;
this.mWinner = -1;
return;
}
if(this.lastMove && this.lastMove.c!=null) {
var piece=this.pieces[this.board[this.lastMove.t]];
pieceValue[-piece.s]+=this.cbStaticExchangeEval(aGame,piece.p,piece.s,{piece:piece})
}
var evalValues={
"pieceValue": pieceValue['-1']-pieceValue['1'],
"pieceValueRatio": (pieceValue['-1']-pieceValue['1'])/(pieceValue['-1']+pieceValue['1']+1),
"posValue": posValue['-1']-posValue['1']
}
var evParams=aGame.mOptions.levelOptions;
for(var name in evalValues) {
var value=evalValues[name];
var factor=evParams[name+'Factor'] || 0;
var weighted=value*factor;
if(debug)
console.log(name,"=",value,"*",factor,"=>",weighted);
this.mEvaluation+=weighted;
}
if(debug)
console.log("Evaluation",this.mEvaluation);
}
Model.Board.cbGeneratePseudoLegalMoves = function(aGame) {
var $this=this;
var moves=[];
var cbVar=aGame.cbVar;
var who=this.mWho;
function PromotedMoves(piece,move) {
var promoFnt=aGame.cbVar.promote;
if(!promoFnt) {
moves.push(move);
return;
}
var promo=promoFnt.call($this,aGame,piece,move);
if(promo==null)
return;
if(promo.length==0)
moves.push(move);
else if(promo.length==1) {
move.pr=promo[0];
moves.push(move);
} else {
for(var i=0;i<promo.length;i++) {
var pr=promo[i];
moves.push({
f: move.f,
t: move.t,
c: move.c,
pr: pr,
ept: move.ept,
ep: move.ep,
a: move.a,
});
}
}
}
var piecesLength=this.pieces.length;
for(var i=0;i<piecesLength;i++) {
var piece=this.pieces[i];
if(piece.p<0 || piece.s!=who)
continue;
var pType=aGame.g.pTypes[piece.t];
var graph, graphLength;
graph=pType.graph[piece.p];
graphLength=graph.length;
for(var j=0;j<graphLength;j++) {
var line=graph[j];
var screen=false;
var lineLength=line.length;
var lastPos=null;
for(var k=0;k<lineLength;k++) {
var tg1=line[k];
var pos1=tg1 & MASK;
var index1=this.board[pos1];
if(index1<0 && (!pType.epCatch || !this.epTarget || this.epTarget.p!=pos1)) {
if((tg1 & FLAG_MOVE) && screen==false)
PromotedMoves(piece,{
f: piece.p,
t: pos1,
c: null,
a: pType.abbrev,
ept: lastPos==null || !pType.epTarget?undefined:lastPos,
});
} else if(tg1 & FLAG_SCREEN_CAPTURE) {
if(screen) {
var piece1=this.pieces[index1];
if(piece1.s!=piece.s)
PromotedMoves(piece,{
f: piece.p,
t: pos1,
c: piece1.i,
a: pType.abbrev,
});
break;
} else
screen=true;
} else {
var piece1;
if(index1<0)
piece1=this.pieces[this.epTarget.i];
else
piece1=this.pieces[index1];
if(piece1.s!=piece.s && (tg1 & FLAG_CAPTURE))
PromotedMoves(piece,{
f: piece.p,
t: pos1,
c: piece1.i,
a: pType.abbrev,
ep: index1<0,
});
break;
}
lastPos=pos1;
}
}
}
return moves;
}
Model.Board.GenerateMoves = function(aGame) {
var moves=this.cbGeneratePseudoLegalMoves(aGame);
var captMoves = [];
var nonCaptMoves = [];
for(var i=0; i<moves.length; i++) {
var move = moves[i];
if(move.c!=null)
captMoves.push(move);
else
nonCaptMoves.push(move);
}
if(captMoves.length>0)
this.mMoves = captMoves;
else
this.mMoves = nonCaptMoves;
if(this.mMoves.length==0) {
this.mFinished=true;
this.mWinner=this.mWho;
}
}
})();

View file

@ -0,0 +1,49 @@
<style>
table.psymbs {
text-align: center;
}
.psymb {
background-image: url({GAME}/res/images/wikipedia.png);
width: 100px;
height: 200px;
}
.psymbs td {
padding: 0 10px 0 10px;
}
.psymb-bold {
font-weight: bold;
}
.side {
float: right;
max-width: 100%;
}
@media screen and (max-width: 520px) {
.side {
float: none;
display: block;
max-width: 100%;
margin-right: auto;
margin-left: auto;
}
}
h1,h2,h3,h4 {
clear: both;
}
</style>
<p>Losing Chess is a game played by two people on a chessboard, with sixteen pieces (of six types) for each player. Each type of piece moves in a distinct way.
The goal of the game is be unable to make a move, either by not having any piece left on the board, or
by having all remaining pieces blocked.</p>
<p>Losing Chess follows the normal <a href="http://en.wikipedia.org/wiki/Rules_of_chess" target="_blank">Chess rules</a>,
with the following changes:</p>
<ul>
<li>capturing is compulsary: if there is a possible move that captures an opponent's piece, then
any move that does not result in a capture is invalid</li>
<li>the king has no special status: it can be captured and checks are not considered</li>
<li>castling is not possible</li>
<li>a pawn reaching the last row can promote to a king (in addition to Knight, Bishop, Rook and Queen)</li>
<li>stalemate is a win for the player that cannot make a move</li>
</ul>

Some files were not shown because too many files have changed in this diff Show more