adding gigachess files

This commit is contained in:
jcfrog 2017-06-18 16:44:40 +02:00
parent 0190c1c651
commit e8bdf6c054
6 changed files with 906 additions and 0 deletions

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,445 @@
/*
* 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 : '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 : '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/terachess/terachess-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>

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;
}
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB