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