Compare commits
139 commits
Author | SHA1 | Date | |
---|---|---|---|
beb3e37348 | |||
3b6a138342 | |||
|
61e7b77e1a | ||
|
27db157069 | ||
|
d0dddafbd9 | ||
|
75beea223b | ||
|
afd6558369 | ||
|
52aa3f13e3 | ||
|
54499701a0 | ||
|
b200ad8127 | ||
|
71ce15a5c5 | ||
|
3ac8a77e31 | ||
|
37da8c2e67 | ||
|
055f63a977 | ||
|
57577dcd44 | ||
|
1b593b2f3d | ||
|
21715f24db | ||
|
8727c790f3 | ||
|
87838dc819 | ||
|
8d9ab54204 | ||
|
b9b3284205 | ||
|
895fc8e254 | ||
|
6a0635c54e | ||
|
9dfbf9e7b1 | ||
|
da03f87c42 | ||
|
3584ae207d | ||
|
977ecf5ddb | ||
|
a3ff533500 | ||
|
2d34b9fc0f | ||
|
a83e15dd63 | ||
|
9f99a717ca | ||
|
95ad3de4af | ||
|
18349373f1 | ||
|
3b0a940577 | ||
|
907d1684b2 | ||
|
dda3af9297 | ||
|
e663e6c693 | ||
|
7e65da9ad2 | ||
|
3af6513018 | ||
|
b1a9ab268d | ||
|
6924d27d88 | ||
|
feaec5ed73 | ||
|
4eed648df5 | ||
|
d0c154fe58 | ||
|
803c4c33e4 | ||
|
843ea4a122 | ||
|
0defcba49e | ||
|
2f18bf8b3b | ||
|
09da4b90eb | ||
|
b4f545f9e7 | ||
|
36ae844cbb | ||
|
fd0a5bc07c | ||
|
f28982381a | ||
|
f24f454560 | ||
|
4e1243acf8 | ||
|
7464de6f52 | ||
|
dbd83f5c46 | ||
|
ccd521c25c | ||
|
3fb10a7d4f | ||
|
e76371d419 | ||
|
4a6de5ec2a | ||
|
43eb2beca5 | ||
|
fd7836345e | ||
|
9c02256e23 | ||
|
c738c2edde | ||
|
d67815098c | ||
|
d7167d4346 | ||
|
5938905660 | ||
|
3d9508310d | ||
|
31f7b0037f | ||
|
279634ec0e | ||
|
fa3eca7841 | ||
|
d52c3a2ffb | ||
|
d5622e9ff6 | ||
|
9f72e57d0b | ||
|
6fd0ccdd93 | ||
|
92063a72cb | ||
|
e6558a7e98 | ||
|
fa9c25f985 | ||
|
e604a5955d | ||
|
ab2ad40c5d | ||
|
6611dd95f1 | ||
|
4fd4891627 | ||
|
403849773c | ||
|
d42c8ab046 | ||
|
d8b9dc46ad | ||
|
bdc6ede882 | ||
|
d119b81bea | ||
|
832ee5991c | ||
|
676c3a8a56 | ||
|
77ea33c020 | ||
|
22876ee813 | ||
|
656277ff83 | ||
|
4b284ec90b | ||
|
36322fd902 | ||
|
250e9d2001 | ||
|
23dbe33464 | ||
|
4482eb45fc | ||
|
e8bdf6c054 | ||
|
0190c1c651 | ||
|
c2a3146339 | ||
|
5b86fd34fe | ||
|
12aaf4931a | ||
|
c2baab5e3b | ||
|
2421d2693a | ||
|
6b35b34b27 | ||
|
93acc32024 | ||
|
639ed7202c | ||
|
42928a6aca | ||
|
8d91c4e9d0 | ||
|
30760c5bab | ||
|
25787b5713 | ||
|
3ff0e9f3db | ||
|
d3dd80dec6 | ||
|
cd9f39f6b2 | ||
|
ebfbada4d6 | ||
|
c765691454 | ||
|
9be43c2b02 | ||
|
597e57c2a1 | ||
|
7171ccbbba | ||
|
282c504e66 | ||
|
c2f26b2781 | ||
|
908533070a | ||
|
10838e81cc | ||
|
fd4eae3a9a | ||
|
1624f3f89c | ||
|
1fe9fab785 | ||
|
d7ce85d358 | ||
|
d1525b241b | ||
|
86796f8d14 | ||
|
531d33a56f | ||
|
87c59055e3 | ||
|
d9f25de47c | ||
|
161626ea9a | ||
|
dd34506c8a | ||
|
245977c2e8 | ||
|
9b1b8252bb | ||
|
2392a87d42 | ||
|
c75582324b |
19
README.md
|
@ -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,13 +9,13 @@ 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)
|
||||
|
||||
|
@ -65,7 +62,7 @@ Building
|
|||
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 --games xiangqi:classic-chess build` only generates Jocly for Classic Chess and XiangQi
|
||||
- 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
|
||||
|
|
|
@ -182,7 +182,7 @@ gulp.task("build-node-games", function () {
|
|||
});
|
||||
|
||||
function ProcessJS(stream, concatName, skipBabel) {
|
||||
if (!argv.prod)
|
||||
if (!argv.prod && concatName)
|
||||
stream = stream.pipe(sourcemaps.init());
|
||||
if (!skipBabel)
|
||||
stream = stream.pipe(babel({
|
||||
|
@ -197,7 +197,7 @@ function ProcessJS(stream, concatName, skipBabel) {
|
|||
});
|
||||
if (concatName)
|
||||
stream = stream.pipe(concat(concatName));
|
||||
if (!argv.prod)
|
||||
if (!argv.prod && concatName)
|
||||
stream = stream.pipe(sourcemaps.write("."));
|
||||
return stream;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jocly",
|
||||
"version": "0.9.7",
|
||||
"version": "0.9.12",
|
||||
"description": "Board games 3D/2D UI and AI web library",
|
||||
"keywords": [
|
||||
"board games",
|
||||
|
|
|
@ -2724,8 +2724,16 @@ if (window.JoclyXdViewCleanup)
|
|||
break;
|
||||
|
||||
case "stopAnimations":
|
||||
var animCount = TWEEN.getAll().length;
|
||||
TWEEN.removeAll();
|
||||
var animCount = 0;
|
||||
var toBeDeleted = [];
|
||||
TWEEN.getAll().forEach(function(tween) {
|
||||
animCount++;
|
||||
if(tween !== threeCtx.dolly)
|
||||
toBeDeleted.push(tween);
|
||||
});
|
||||
toBeDeleted.forEach(function(tween) {
|
||||
TWEEN.remove(tween);
|
||||
});
|
||||
resolve(animCount > 0);
|
||||
break;
|
||||
|
||||
|
@ -2813,6 +2821,7 @@ if (window.JoclyXdViewCleanup)
|
|||
delete threeCtx.animateCallbacks["dolly"];
|
||||
TWEEN.remove(threeCtx.dolly);
|
||||
delete threeCtx.dolly;
|
||||
threeCtx.animControl.stop(0);
|
||||
}
|
||||
break;
|
||||
case "move":
|
||||
|
@ -2831,6 +2840,16 @@ if (window.JoclyXdViewCleanup)
|
|||
}
|
||||
|
||||
function SpinCamera(options) {
|
||||
function GetKalman() {
|
||||
var R = .001;
|
||||
if(typeof options.smooth!="undefined")
|
||||
R = options.smooth;
|
||||
return new KalmanFilter({R: R});
|
||||
}
|
||||
var kalman = {
|
||||
x: GetKalman(),
|
||||
y: GetKalman(),
|
||||
}
|
||||
var x0 = threeCtx.cameraControls.camTarget.x;
|
||||
var y0 = threeCtx.cameraControls.camTarget.z;
|
||||
var x1 = threeCtx.body.position.x;
|
||||
|
@ -2840,7 +2859,7 @@ if (window.JoclyXdViewCleanup)
|
|||
if(options.direction=="ccw")
|
||||
angle1 = angle0 + 2 * Math.PI;
|
||||
var radius = Math.sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
|
||||
if(threeCtx.dolly)
|
||||
if(threeCtx.dolly)
|
||||
TWEEN.remove(threeCtx.dolly);
|
||||
var state = {};
|
||||
function StartSpinning() {
|
||||
|
@ -2856,8 +2875,8 @@ if (window.JoclyXdViewCleanup)
|
|||
threeCtx.animateCallbacks["dolly"] = {
|
||||
_this: null,
|
||||
callback: function() {
|
||||
threeCtx.body.position.x = x0 + radius * Math.cos(state.angle);
|
||||
threeCtx.body.position.z = y0 + radius * Math.sin(state.angle);
|
||||
threeCtx.body.position.x = kalman.x.filter(x0 + radius * Math.cos(state.angle));
|
||||
threeCtx.body.position.z = kalman.y.filter(y0 + radius * Math.sin(state.angle));
|
||||
}
|
||||
};
|
||||
StartSpinning();
|
||||
|
@ -2867,7 +2886,7 @@ if (window.JoclyXdViewCleanup)
|
|||
|
||||
function MoveCamera(options) {
|
||||
function GetKalman() {
|
||||
var R = .2;
|
||||
var R = .001;
|
||||
if(typeof options.smooth!="undefined")
|
||||
R = options.smooth;
|
||||
return new KalmanFilter({R: R});
|
||||
|
|
|
@ -748,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);
|
||||
|
||||
|
@ -995,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={};
|
||||
|
@ -1033,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")
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
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)
|
||||
|
@ -499,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;
|
||||
|
@ -562,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;
|
||||
}
|
||||
|
||||
|
@ -588,6 +593,9 @@
|
|||
}
|
||||
}
|
||||
this.mEvaluation += (rowSumA-rowSumB) * aGame.g.lastRowFactor;
|
||||
|
||||
if(aGame.g.suicide)
|
||||
this.mEvaluation = -this.mEvaluation;
|
||||
}
|
||||
|
||||
//JocLog("Evaluation",this.mEvaluation,this.pCount);
|
||||
|
|
BIN
src/games/checkers/draughts8-suicide-thumb3d.png
Normal file
After Width: | Height: | Size: 11 KiB |
|
@ -901,6 +901,69 @@ exports.games = (function() {
|
|||
},
|
||||
"viewScripts": config_view_js_4
|
||||
},
|
||||
{
|
||||
"name": "suicide-checkers",
|
||||
"modelScripts": modelScripts_3,
|
||||
"config": {
|
||||
"status": true,
|
||||
"model": {
|
||||
"title-en": "Suicide checkers",
|
||||
"summary": "A.k.a Giveaway checkers or Anti-checkers",
|
||||
"rules": "rules-suicide-checkers.html",
|
||||
"maxLevel": 20,
|
||||
"plazza": "true",
|
||||
"thumbnail": "draughts8-suicide-thumb3d.png",
|
||||
"module": "checkers",
|
||||
"description": "description.html",
|
||||
"credits": "credits.html",
|
||||
"js": modelScripts_3,
|
||||
"gameOptions": {
|
||||
"preventRepeat": true,
|
||||
"width": 4,
|
||||
"height": 8,
|
||||
"initial": config_model_gameOptions_initial_2,
|
||||
"variant": {
|
||||
"mustMoveForwardStrict": true,
|
||||
"lastRowCrown": true,
|
||||
"captureLongestLine": true,
|
||||
"longRangeKing": false,
|
||||
"kingCaptureShort": true,
|
||||
"lastRowFactor": 0.001,
|
||||
"kingValue": 2,
|
||||
"whiteStarts": false,
|
||||
"canCaptureBackward": false,
|
||||
"suicide": true,
|
||||
"noMove": "win"
|
||||
},
|
||||
"invertNotation": true,
|
||||
"uctTransposition": "state"
|
||||
},
|
||||
"levels": config_model_levels_7
|
||||
},
|
||||
"view": {
|
||||
"title-en": "Draughts View",
|
||||
"preferredRatio": 1,
|
||||
"js": config_view_js_4,
|
||||
"skins": config_view_skins_8,
|
||||
"visuals": {
|
||||
"600x600": [
|
||||
"res/visuals/english-draughts-600x600-3d.jpg",
|
||||
"res/visuals/english-draughts-600x600-2d.jpg"
|
||||
]
|
||||
},
|
||||
"sounds": config_view_sounds_2,
|
||||
"module": "checkers",
|
||||
"css": config_view_css_2,
|
||||
"switchable": true,
|
||||
"animateSelfMoves": false,
|
||||
"useNotation": true,
|
||||
"useShowMoves": true,
|
||||
"defaultOptions": config_view_defaultOptions,
|
||||
"xdView": true
|
||||
}
|
||||
},
|
||||
"viewScripts": config_view_js_4
|
||||
},
|
||||
{
|
||||
"name": "brazilian-draughts",
|
||||
"modelScripts": modelScripts_3,
|
||||
|
@ -960,56 +1023,6 @@ exports.games = (function() {
|
|||
},
|
||||
"viewScripts": config_view_js_4
|
||||
},
|
||||
{
|
||||
"name": "brazilian-draughts-hlwn",
|
||||
"modelScripts": modelScripts_3,
|
||||
"config": {
|
||||
"status": true,
|
||||
"model": {
|
||||
"title-en": "Halloween Draughts",
|
||||
"summary": "Same as international checkers on a 8x8 board.",
|
||||
"thumbnail": "halloweenthumb.png",
|
||||
"module": "checkers",
|
||||
"maxLevel": 20,
|
||||
"obsolete": true,
|
||||
"plazza": "broken",
|
||||
"rules": "rules-brazilian-draughts.html",
|
||||
"description": "description.html",
|
||||
"credits": "credits.html",
|
||||
"js": modelScripts_3,
|
||||
"gameOptions": config_model_gameOptions,
|
||||
"levels": config_model_levels_7
|
||||
},
|
||||
"view": {
|
||||
"title-en": "Draughts View",
|
||||
"preferredRatio": 1,
|
||||
"js": config_view_js_5,
|
||||
"skins": [
|
||||
{
|
||||
"name": "halloween",
|
||||
"title": "Halloween"
|
||||
}
|
||||
],
|
||||
"visuals": {
|
||||
"600x600": [
|
||||
"res/visuals/halloween-draughts-600x600-2d.jpg",
|
||||
"res/visuals/halloween-draughts-b-600x600-2d.jpg"
|
||||
]
|
||||
},
|
||||
"module": "checkers",
|
||||
"css": config_view_css_2,
|
||||
"switchable": true,
|
||||
"animateSelfMoves": false,
|
||||
"useNotation": true,
|
||||
"useShowMoves": true,
|
||||
"defaultOptions": config_view_defaultOptions,
|
||||
"preloadImages": {
|
||||
"pieces": "res/images/pieces.png"
|
||||
}
|
||||
}
|
||||
},
|
||||
"viewScripts": config_view_js_5
|
||||
},
|
||||
{
|
||||
"name": "german-draughts",
|
||||
"modelScripts": modelScripts_3,
|
||||
|
|
29
src/games/checkers/rules-suicide-checkers.html
Normal 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>
|
9
src/games/chessbase/4board-credits.html
Normal 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>
|
1
src/games/chessbase/4board-description.html
Normal 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>
|
264
src/games/chessbase/4board-model.js
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
42
src/games/chessbase/4board-rules.html
Normal 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>
|
BIN
src/games/chessbase/4board-thumb.png
Normal file
After Width: | Height: | Size: 15 KiB |
100
src/games/chessbase/4board-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
9
src/games/chessbase/armychess-credits.html
Normal 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>
|
1
src/games/chessbase/armychess-description.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>Army Chess is a Chess Variant, where Black has an Army unroyal Kings.</p>
|
159
src/games/chessbase/armychess-model.js
Normal 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"},
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
28
src/games/chessbase/armychess-rules.html
Normal 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>
|
BIN
src/games/chessbase/armychess-thumb.png
Normal file
After Width: | Height: | Size: 13 KiB |
92
src/games/chessbase/armychess-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
|
@ -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 @@
|
|||
};
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
139
src/games/chessbase/cavalier-custom-model.js
Normal 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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
114
src/games/chessbase/cavalier-custom-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
11
src/games/chessbase/cavalierchess-credits.html
Normal 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>
|
1
src/games/chessbase/cavalierchess-description.html
Normal 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>
|
29
src/games/chessbase/cavalierchess-rules.html
Normal 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>
|
|
@ -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,
|
||||
|
|
20
src/games/chessbase/cubic-rules.html
Normal 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>
|
||||
|
|
@ -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 @@
|
|||
};
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -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 @@
|
|||
};
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
})();
|
||||
|
|
175
src/games/chessbase/fairychess-model.js
Normal 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"},
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
BIN
src/games/chessbase/fairychess-thumb.png
Normal file
After Width: | Height: | Size: 13 KiB |
92
src/games/chessbase/fairychess-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
6
src/games/chessbase/gigachess-credits.html
Normal 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>
|
4
src/games/chessbase/gigachess-description.html
Normal 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>
|
||||
|
447
src/games/chessbase/gigachess-model.js
Normal 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 [];
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
228
src/games/chessbase/gigachess-rules.html
Normal 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>
|
BIN
src/games/chessbase/gigachess-thumb.png
Normal file
After Width: | Height: | Size: 16 KiB |
224
src/games/chessbase/gigachess-view.js
Normal 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;
|
||||
}
|
||||
})();
|
|
@ -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 @@
|
|||
};
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
153
src/games/chessbase/grandcavalier-custom-model.js
Normal 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;
|
||||
})();
|
116
src/games/chessbase/grandcavalier-custom-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
11
src/games/chessbase/grandcavalierchess-credits.html
Normal 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>
|
1
src/games/chessbase/grandcavalierchess-description.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>Grand Cavalier Chess is a greater Variant of Cavalier Chess, with two Cannons.</p>
|
33
src/games/chessbase/grandcavalierchess-rules.html
Normal 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>
|
BIN
src/games/chessbase/knight-inv-thumbnail.png
Normal file
After Width: | Height: | Size: 12 KiB |
9
src/games/chessbase/knightetchess-credits.html
Normal 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>
|
1
src/games/chessbase/knightetchess-description.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>Knightet Chess is a 8*8 Chess Variant with Knightet Pieces.</p>
|
152
src/games/chessbase/knightetchess-model.js
Normal 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"},
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
29
src/games/chessbase/knightetchess-rules.html
Normal 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>
|
92
src/games/chessbase/knightetchess-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
137
src/games/chessbase/knightmate-model.js
Normal 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"},
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
92
src/games/chessbase/knightmate-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
188
src/games/chessbase/koth-model.js
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
92
src/games/chessbase/koth-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
11
src/games/chessbase/leychessalpha-credits.html
Normal 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>
|
1
src/games/chessbase/leychessalpha-description.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>LeyChessAlpha is a 12*12 Chess Variant with Fairy Pieces based on Metamachy.</p>
|
574
src/games/chessbase/leychessalpha-model.js
Normal 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;
|
||||
}
|
||||
|
||||
})();
|
177
src/games/chessbase/leychessalpha-rules.html
Normal 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'>
|
BIN
src/games/chessbase/leychessalpha-thumb.png
Normal file
After Width: | Height: | Size: 14 KiB |
219
src/games/chessbase/leychessalpha-view.js
Normal 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);
|
||||
}
|
||||
|
||||
})();
|
13
src/games/chessbase/leychessbeta-credits.html
Normal 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>
|
1
src/games/chessbase/leychessbeta-description.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>LeyChessBeta is a 16*16 Chess Variant with Fairy Pieces based on Terachess</p>
|
591
src/games/chessbase/leychessbeta-model.js
Normal 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
|
||||
}
|
||||
|
||||
})();
|
269
src/games/chessbase/leychessbeta-rules.html
Normal 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'>
|
BIN
src/games/chessbase/leychessbeta-thumb.png
Normal file
After Width: | Height: | Size: 14 KiB |
258
src/games/chessbase/leychessbeta-view.js
Normal 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);
|
||||
}
|
||||
})();
|
340
src/games/chessbase/losing-model.js
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
49
src/games/chessbase/losing-rules.html
Normal 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>
|
|
@ -111,8 +111,8 @@
|
|||
},
|
||||
|
||||
castle: {
|
||||
"2/0": {k:[1],r:[1],n:"O-O"},
|
||||
"22/20": {k:[21],r:[21],n:"O-O"},
|
||||
"2/0": {k:[1],r:[1,2],n:"O-O"},
|
||||
"22/20": {k:[21],r:[21,22],n:"O-O"},
|
||||
},
|
||||
|
||||
evaluate: function(aGame,evalValues,material) {
|
||||
|
@ -186,4 +186,4 @@
|
|||
};
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -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([
|
||||
|
@ -30,7 +30,7 @@
|
|||
],posNames);
|
||||
|
||||
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 },
|
||||
}
|
||||
|
||||
|
@ -226,4 +226,4 @@
|
|||
};
|
||||
}
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
150
src/games/chessbase/mightylion-model.js
Normal file
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* 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:6},{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-king',
|
||||
isKing: true,
|
||||
graph: this.cbKingGraph(geometry),
|
||||
abbrev: 'K',
|
||||
initial: [{s:1,p:4},{s:-1,p:60}],
|
||||
},
|
||||
|
||||
9: {
|
||||
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:1},{s:-1,p:57}],
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
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"},
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
BIN
src/games/chessbase/mightylion-thumb.png
Normal file
After Width: | Height: | Size: 13 KiB |
92
src/games/chessbase/mightylion-view.js
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
})();
|
BIN
src/games/chessbase/res/fairy/antelope/antelope-diffusemap.jpg
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
src/games/chessbase/res/fairy/antelope/antelope-normalmap.jpg
Normal file
After Width: | Height: | Size: 41 KiB |
16
src/games/chessbase/res/fairy/antelope/antelope.js
Normal file
BIN
src/games/chessbase/res/fairy/bow/bow-diffusemap.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
src/games/chessbase/res/fairy/bow/bow-normalmap.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
16
src/games/chessbase/res/fairy/bow/bow.js
Normal file
BIN
src/games/chessbase/res/fairy/buffalo/buffalo-diffusemap.jpg
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
src/games/chessbase/res/fairy/buffalo/buffalo-normalmap.jpg
Normal file
After Width: | Height: | Size: 38 KiB |
16
src/games/chessbase/res/fairy/buffalo/buffalo.js
Normal file
BIN
src/games/chessbase/res/fairy/bull/bull-diffusemap.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
src/games/chessbase/res/fairy/bull/bull-normalmap.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
16
src/games/chessbase/res/fairy/bull/bull.js
Normal file
BIN
src/games/chessbase/res/fairy/corporal/corporal-diffusemap.jpg
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
src/games/chessbase/res/fairy/corporal/corporal-normalmap.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
16
src/games/chessbase/res/fairy/corporal/corporal.js
Normal file
BIN
src/games/chessbase/res/fairy/icons/w-amazon.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
src/games/chessbase/res/fairy/icons/w-antelope.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
src/games/chessbase/res/fairy/icons/w-bow.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
src/games/chessbase/res/fairy/icons/w-buffalo.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
src/games/chessbase/res/fairy/icons/w-bull.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/games/chessbase/res/fairy/icons/w-cardinal.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
src/games/chessbase/res/fairy/icons/w-corporal.png
Normal file
After Width: | Height: | Size: 4.8 KiB |