Merge pull request #3 from jcfrog/master

Terachess
This commit is contained in:
Michel Gutierrez 2017-06-19 10:57:09 +02:00 committed by GitHub
commit 36322fd902
88 changed files with 2826 additions and 92 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,223 @@
/*
*
*
*
* 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: "in",
notationDebug: true,
}
gigachessBoardDelta3d = $.extend(true,{},gigachessBoardDelta,
{
/*'colorFill' : {
".": "#575b36", // "rgba(180,213,80,.3)",
"#": "#474b36", // "black" cells
" ": "rgba(0,0,0,0)",
},*/
'colorFill' : {
"#": "rgba(204,40,0,1)",
".": "rgba(180,180,0,1)",
},
'texturesImg' : {
'crackles': '/res/images/crackles.jpg',
'tiler': '/res/images/tileralpha.png',
},
'3D':true,
'margins' : {x:.47,y:.47},
'extraChannels':[
'bump'
],
paintCell: function(spec,ctx,images,channel,cellType,xCenter,yCenter,cx,cy) {
var tW=images['crackles'].width;
var tH=images['crackles'].height;
var tClipCx=200;
var tClipCy=200;
ctx.fillStyle="#000000";
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
if(channel=="bump"){
return;
}
cx=.98*cx;
cy=.98*cy;
ctx.save();
ctx.strokeStyle = "rgba(0,0,0,1)";
ctx.lineWidth = 50;
if (channel=='diffuse')
ctx.fillStyle=spec.colorFill[cellType];
else
ctx.fillStyle=0xffffff;
ctx.fillRect(xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.globalCompositeOperation = 'multiply';
ctx.drawImage(images['crackles'],
Math.random()*(tW-tClipCx),Math.random()*(tH-tClipCy),tClipCx,tClipCy,
xCenter-cx/2,yCenter-cy/2,cx,cy);
ctx.restore();
},
paintBackground: function(spec,ctx,images,channel,bWidth,bHeight) {
ctx.save();
ctx.fillStyle="#ffffff";
if (channel=='diffuse')
ctx.fillStyle="#BA784A";
//ctx.fillStyle="#cc6600";
var cSize = this.cbCSize(spec);
ctx.fillRect(-bWidth/2,-bHeight/2,bWidth,bHeight);
var textureCanvas=createTexturedPatternCanvas(1200,800,images['crackles'],200,200,images['tiler'],.3);
ctx.globalCompositeOperation='multiply';
ctx.drawImage(textureCanvas,-bWidth/2,-bHeight/2,bWidth,bHeight);
ctx.restore();
},
}
);
gigachessBoardDelta2d = $.extend(true,{},gigachessBoardDelta,
{
'colorFill' : {
".": "#ffffc0", // "white" cells
"#": "#8F976D", // "black" cells
" ": "rgba(0,0,0,0)",
},
'texturesImg' : {}, // to avoid default wood texture
'margins' : {x:.47,y:.47},
/*'colorFill' : {
".": "rgba(224,50,0,1)",
"#": "rgba(220,220,0,1)",
},*/
}
);
var gigachessBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,gigachessBoardDelta3d);
var gigachessBoard2d = $.extend(true,{},this.cbGridBoardClassic2DMargin,gigachessBoardDelta2d);
return {
coords: {
"2d": this.cbGridBoard.coordsFn.call(this,gigachessBoard2d),
"3d": this.cbGridBoard.coordsFn.call(this,gigachessBoard3d),
},
boardLayout: [
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
".#.#.#.#.#.#.#",
"#.#.#.#.#.#.#.",
],
board: {
"2d": {
draw: this.cbDrawBoardFn(gigachessBoard2d),
},
"3d": {
display: this.cbDisplayBoardFn(gigachessBoard3d),
},
},
clicker: {
"2d": {
width: 800,
height: 800,
},
"3d": {
scale: [0.51428571428571,0.51428571428571,0.51428571428571],
},
},
pieces: this.cbFairyPieceStyle({
"default": {
"2d": {
width: 742.85714285714,
height: 742.85714285714,
},
"3d": {
scale: [0.34285714285714,0.34285714285714,0.34285714285714],
display: this.cbDisplayPieceFn(this.cbFairyGigachessPieceStyle3D)
},
},
"fr-amazon" :{
"3d": {
scale: [0.41142857142857,0.41142857142857,0.41142857142857],
}
},
}),
};
}
/* Make the jumps */
View.Board.cbMoveMidZ = function(aGame,aMove,zFrom,zTo) {
var geo=aGame.cbVar.geometry;
var dx=Math.abs(geo.C(aMove.t)-geo.C(aMove.f));
var dy=Math.abs(geo.R(aMove.t)-geo.R(aMove.f));
if(("_N_E_D_L_J_T_F_G_S_".indexOf("_"+aMove.a+"_")>=0) && (aGame.g.distGraph[aMove.f][aMove.t]>1))
return Math.max(zFrom,zTo)+2000;
else if(("_A_C_M_".indexOf("_"+aMove.a+"_")>=0) && dx!=dy && dx!=0 && dy!=0)
return Math.max(zFrom,zTo)+2000;
else if(("_Z_W_".indexOf("_"+aMove.a+"_")>=0) && aMove.c != null)
return Math.max(zFrom,zTo)+2000;
else
return (zFrom+zTo)/2;
}
})();

View file

@ -1097,6 +1097,28 @@ exports.games = (function () {
"staunton-set-view.js",
"sweet16-view.js"
]
var modelScripts_tera = [
"base-model.js",
"grid-geo-model.js",
"terachess-model.js"
]
var config_view_js_tera = [
"base-view.js",
"grid-board-view.js",
"fairy-set-view.js",
"terachess-view.js"
]
var modelScripts_giga = [
"base-model.js",
"grid-geo-model.js",
"gigachess-model.js"
]
var config_view_js_giga = [
"base-view.js",
"grid-board-view.js",
"fairy-set-view.js",
"gigachess-view.js"
]
return [
{
"name": "classic-chess",
@ -4749,6 +4771,268 @@ exports.games = (function () {
}
},
"viewScripts": config_view_js_44
},
{
"name": "tera-chess",
"modelScripts": modelScripts_tera,
"config": {
"status": true,
"model": {
"title-en": "Terachess",
"summary": "Chess on 16x16 with fairy pieces",
"rules": {
"en": "terachess-rules.html"
},
"module": "chessbase",
"plazza": "true",
"thumbnail": "terachess-thumb.png",
"released": 1497442763,
"credits": {
"en": "terachess-credits.html"
},
"gameOptions": config_model_gameOptions,
"obsolete": false,
"js": modelScripts_tera,
"description": {
"en": "terachess-description.html"
},
"levels": config_model_levels_15
},
"view": {
"title-en": "Chessbase view",
"visuals": {
"600x600": [
"res/visuals/terachess-600x600-3d.jpg",
"res/visuals/terachess-600x600-2d.jpg"
]
},
"xdView": true,
"css": config_view_css,
"preferredRatio": 1,
"useShowMoves": true,
"useNotation": true,
"module": "chessbase",
"defaultOptions": config_view_defaultOptions,
"skins": [
{
"name": "skin3d",
"title": "3D Classic",
"3d": true,
"preload": [
"smoothedfilegeo|0|/res/ring-target.js",
"image|/res/images/cancel.png",
"image|/res/images/wikipedia.png",
"smoothedfilegeo|0|/res/fairy/pawn/pawn.js",
"image|/res/fairy/pawn/pawn-diffusemap.jpg",
"image|/res/fairy/pawn/pawn-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/corporal/corporal.js",
"image|/res/fairy/corporal/corporal-diffusemap.jpg",
"image|/res/fairy/corporal/corporal-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/prince/prince.js",
"image|/res/fairy/prince/prince-diffusemap.jpg",
"image|/res/fairy/prince/prince-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/rook/rook.js",
"image|/res/fairy/rook/rook-diffusemap.jpg",
"image|/res/fairy/rook/rook-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bishop/bishop.js",
"image|/res/fairy/bishop/bishop-diffusemap.jpg",
"image|/res/fairy/bishop/bishop-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/knight/knight.js",
"image|/res/fairy/knight/knight-diffusemap.jpg",
"image|/res/fairy/knight/knight-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/queen/queen.js",
"image|/res/fairy/queen/queen-diffusemap.jpg",
"image|/res/fairy/queen/queen-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/king/king.js",
"image|/res/fairy/king/king-diffusemap.jpg",
"image|/res/fairy/king/king-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/star/star.js",
"image|/res/fairy/star/star-diffusemap.jpg",
"image|/res/fairy/star/star-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bow/bow.js",
"image|/res/fairy/bow/bow-diffusemap.jpg",
"image|/res/fairy/bow/bow-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/rhino/rhino.js",
"image|/res/fairy/rhino/rhino-diffusemap.jpg",
"image|/res/fairy/rhino/rhino-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bull/bull.js",
"image|/res/fairy/bull/bull-diffusemap.jpg",
"image|/res/fairy/bull/bull-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/antelope/antelope.js",
"image|/res/fairy/antelope/antelope-diffusemap.jpg",
"image|/res/fairy/antelope/antelope-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/lion/lion.js",
"image|/res/fairy/lion/lion-diffusemap.jpg",
"image|/res/fairy/lion/lion-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/elephant/elephant.js",
"image|/res/fairy/elephant/elephant-diffusemap.jpg",
"image|/res/fairy/elephant/elephant-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/cannon2/cannon2.js",
"image|/res/fairy/cannon2/cannon2-diffusemap.jpg",
"image|/res/fairy/cannon2/cannon2-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/machine/machine.js",
"image|/res/fairy/machine/machine-diffusemap.jpg",
"image|/res/fairy/machine/machine-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/buffalo/buffalo.js",
"image|/res/fairy/buffalo/buffalo-diffusemap.jpg",
"image|/res/fairy/buffalo/buffalo-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/ship/ship.js",
"image|/res/fairy/ship/ship-diffusemap.jpg",
"image|/res/fairy/ship/ship-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/eagle/eagle.js",
"image|/res/fairy/eagle/eagle-diffusemap.jpg",
"image|/res/fairy/eagle/eagle-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/camel/camel.js",
"image|/res/fairy/camel/camel-diffusemap.jpg",
"image|/res/fairy/camel/camel-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/amazon/amazon.js",
"image|/res/fairy/amazon/amazon-diffusemap.jpg",
"image|/res/fairy/amazon/amazon-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/marshall/marshall.js",
"image|/res/fairy/marshall/marshall-diffusemap.jpg",
"image|/res/fairy/marshall/marshall-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/cardinal/cardinal.js",
"image|/res/fairy/cardinal/cardinal-diffusemap.jpg",
"image|/res/fairy/cardinal/cardinal-normalmap.jpg"
],
"world": config_view_skins_world,
"camera": config_view_skins_camera
},
config_view_skins_9
],
"animateSelfMoves": false,
"switchable": true,
"sounds": config_view_sounds,
"js": config_view_js_tera,
"useAutoComplete": true
}
},
"viewScripts": config_view_js_tera
},
{
"name": "giga-chess",
"modelScripts": modelScripts_giga,
"config": {
"status": true,
"model": {
"title-en": "Gigachess",
"summary": "Chess on 14x14 with fairy pieces",
"rules": {
"en": "gigachess-rules.html"
},
"module": "chessbase",
"plazza": "true",
"thumbnail": "gigachess-thumb.png",
"released": 1497771910,
"credits": {
"en": "gigachess-credits.html"
},
"gameOptions": config_model_gameOptions,
"obsolete": false,
"js": modelScripts_giga,
"description": {
"en": "gigachess-description.html"
},
"levels": config_model_levels_15
},
"view": {
"title-en": "Chessbase view",
"visuals": {
"600x600": [
"res/visuals/gigachess-600x600-3d.jpg",
"res/visuals/gigachess-600x600-2d.jpg"
]
},
"xdView": true,
"css": config_view_css,
"preferredRatio": 1,
"useShowMoves": true,
"useNotation": true,
"module": "chessbase",
"defaultOptions": config_view_defaultOptions,
"skins": [
{
"name": "skin3d",
"title": "3D Classic",
"3d": true,
"preload": [
"smoothedfilegeo|0|/res/ring-target.js",
"image|/res/images/cancel.png",
"image|/res/images/wikipedia.png",
"smoothedfilegeo|0|/res/fairy/pawn/pawn.js",
"image|/res/fairy/pawn/pawn-diffusemap.jpg",
"image|/res/fairy/pawn/pawn-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/corporal/corporal.js",
"image|/res/fairy/corporal/corporal-diffusemap.jpg",
"image|/res/fairy/corporal/corporal-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/prince/prince.js",
"image|/res/fairy/prince/prince-diffusemap.jpg",
"image|/res/fairy/prince/prince-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/rook/rook.js",
"image|/res/fairy/rook/rook-diffusemap.jpg",
"image|/res/fairy/rook/rook-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bishop/bishop.js",
"image|/res/fairy/bishop/bishop-diffusemap.jpg",
"image|/res/fairy/bishop/bishop-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/knight/knight.js",
"image|/res/fairy/knight/knight-diffusemap.jpg",
"image|/res/fairy/knight/knight-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/queen/queen.js",
"image|/res/fairy/queen/queen-diffusemap.jpg",
"image|/res/fairy/queen/queen-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/king/king.js",
"image|/res/fairy/king/king-diffusemap.jpg",
"image|/res/fairy/king/king-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/bow/bow.js",
"image|/res/fairy/bow/bow-diffusemap.jpg",
"image|/res/fairy/bow/bow-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/lion/lion.js",
"image|/res/fairy/lion/lion-diffusemap.jpg",
"image|/res/fairy/lion/lion-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/elephant/elephant.js",
"image|/res/fairy/elephant/elephant-diffusemap.jpg",
"image|/res/fairy/elephant/elephant-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/cannon2/cannon2.js",
"image|/res/fairy/cannon2/cannon2-diffusemap.jpg",
"image|/res/fairy/cannon2/cannon2-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/machine/machine.js",
"image|/res/fairy/machine/machine-diffusemap.jpg",
"image|/res/fairy/machine/machine-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/buffalo/buffalo.js",
"image|/res/fairy/buffalo/buffalo-diffusemap.jpg",
"image|/res/fairy/buffalo/buffalo-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/ship/ship.js",
"image|/res/fairy/ship/ship-diffusemap.jpg",
"image|/res/fairy/ship/ship-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/eagle/eagle.js",
"image|/res/fairy/eagle/eagle-diffusemap.jpg",
"image|/res/fairy/eagle/eagle-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/camel/camel.js",
"image|/res/fairy/camel/camel-diffusemap.jpg",
"image|/res/fairy/camel/camel-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/amazon/amazon.js",
"image|/res/fairy/amazon/amazon-diffusemap.jpg",
"image|/res/fairy/amazon/amazon-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/marshall/marshall.js",
"image|/res/fairy/marshall/marshall-diffusemap.jpg",
"image|/res/fairy/marshall/marshall-normalmap.jpg",
"smoothedfilegeo|0|/res/fairy/cardinal/cardinal.js",
"image|/res/fairy/cardinal/cardinal-diffusemap.jpg",
"image|/res/fairy/cardinal/cardinal-normalmap.jpg"
],
"world": config_view_skins_world,
"camera": config_view_skins_camera
},
config_view_skins_9
],
"animateSelfMoves": false,
"switchable": true,
"sounds": config_view_sounds,
"js": config_view_js_giga,
"useAutoComplete": true
}
},
"viewScripts": config_view_js_giga
}
]
})()
})()

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View file

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

View file

@ -0,0 +1,6 @@
<p>Bigger than bigger ! This is a Chess variant with 24 different pieces on a 16 x 16 board, an unrealistic summum.</p>
<p>They are 256 cases and 64 pieces per side which gives the same density than for Orthodox Chess.</p>
<p>In Terachess one will find again 20 kinds of men encountered in Shako , Tamerlane 2000, Metamachy and Gigachess. The 4 newcomers are the <b>Star</b> (Cannon+Bow), the <b>Rhinoceros</b>, a sort of Eagle's counterpart, the <b>Bull</b>, a long leaper whose move exists in Korean Chess and the <b>Antelope</b>, an original leaper.</p>

View file

@ -0,0 +1,548 @@
/*
* 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() {
// classic chess pieces
var piecesTypes = {
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 : true,
epTarget : true,
},
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 : true,
epTarget : true,
},
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:21},{s:1,p:22},{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}],
epCatch : true,
epTarget : true,
},
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:229},{s:-1,p:230},{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}],
epCatch : true,
epTarget : true,
},
4: {
name : 'princew',
abbrev : 'I',
aspect : 'fr-prince',
graph : this.cbPrinceGraph(geometry,1,confine),
value : 2.2,
initial: [{s:1,p:38},{s:1,p:41}],
epTarget : true,
},
5: {
name : 'princeb',
abbrev : 'I',
aspect : 'fr-prince',
graph : this.cbPrinceGraph(geometry,-1,confine),
value : 2.2,
initial: [{s:-1,p:214},{s:-1,p:217}],
epTarget : true,
},
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}],
},
}
// 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_star=11
var T_bow=12
var T_rhino=13
var T_bull=14
var T_antelope=15
var T_lion=16
var T_elephant=17
var T_cannon=18
var T_machine=19
var T_buffalo=20
var T_ship=21
var T_eagle=22
var T_camel=23
var T_amazon=24
var T_marshall=25
var T_cardinal=26
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 || piece.t==T_bull) && ((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];
if (piece.t==T_antelope && ((geometry.R(move.t)==lastRow && piece.s > 0) || (geometry.R(move.t)==firstRow && piece.s < 0)) )
return [T_star];
return [];
},
};
}
var SuperModelBoardGenerateMoves=Model.Board.GenerateMoves;
Model.Board.GenerateMoves = function(aGame) {
var $this = this;
SuperModelBoardGenerateMoves.apply(this,arguments); // call regular GenerateMoves method
}
var SuperModelBoardApplyMove=Model.Board.ApplyMove;
Model.Board.ApplyMove = function(aGame,move) {
// console.log("ApplyMove entrance",aGame,move);
var $this = this;
SuperModelBoardApplyMove.apply(this,arguments); // call regular GenerateMoves method
}
})();

View file

@ -0,0 +1,296 @@
<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 16 x 16 checkered squares with a white one at the right end of each player.</p>
<p>
<img class='piece-graph' src='{GAME}/res/rules/terachess/terachess-start.png'>
</p>
<p>There are 64 pieces per side:
<ul>
<li>1 Amazon, 1 Marshall, 1 Cardinal, 1 Star, 1 Rhinoceros, 1 Buffalo, 2 Cannons, 2 Bulls,</li>
<li>2 Bows, 2 Camels, 2 Antelopes on 1st row,</li>
<li>1 Lion, 1 Eagle and 14 Corporals on 2nd row,</li>
<li>1 King, 1 Queen, 2 Princes, 2 Ships, 2 Bishops, 2 Knights, 2 Rooks, 2 Machines,</li>
<li>2 Elephants on 3rd row,</li>
<li>16 Pawns on 4th row.</li>
</ul>
</p>
<p>The white King is placed on the center of the third row on a black square, the black King being on a white square. The Queen lays beside the King. The Eagle is just behind the King, and the Lion is beside the Queen. They are the only major pieces on the second raw, the rest being populated by the Corporals. On the 1st row, the Amazon is in the back line of the King and commands a side with Marshall and Cardinal. On the opposite side, there is the Star on Queen side with Rhinoceros and Buffalo.</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>Pawn</h2>
<p>
<img class='piece-icon' src='{GAME}/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. When the Pawn reaches the last row it promotes to a Queen.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/pawn.png'>
</p>
<h2>Corporal</h2>
<p>
<img class='piece-icon' src='{GAME}/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. Promotes to Queen on last row.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/corporal.png'>
</p>
<h2>Prince</h2>
<p>
<img class='piece-icon' src='{GAME}/res/fairy/icons/w-prince.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 Amazon.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/prince.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>
<h2>Bull</h2>
<p>
<img class='piece-icon' src='{GAME}/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. When a Bull 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/bull.png'>
</p>
<h2>Antelope</h2>
<p>
<img class='piece-icon' src='{GAME}/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. When an Antelope reaches the last row it promotes to a Star.</p>
<div style='clear:both'></div>
<p>
<img class='piece-graph' src='{GAME}/res/rules/graphs/antelope.png'>
</p>
<h2>Rhinoceros</h2>
<p>
<img class='piece-icon' src='{GAME}/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='{GAME}/res/rules/graphs/rhino.png'>
</p>
<h2>Star</h2>
<p>
<img class='piece-icon' src='{GAME}/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='{GAME}/res/rules/graphs/star.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-bull.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><tr><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-antelope.png'>
</td><td>promotes to
</td><td><img class='piece-icon-promo' src='{GAME}/res/fairy/icons/w-star.png'>
</td></tr></table>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,257 @@
/*
*
*
*
* 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: "in",
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);
}
})();