diff --git a/src/games/chessbase/gigachess-view.js b/src/games/chessbase/gigachess-view.js index dcba909..10e071d 100644 --- a/src/games/chessbase/gigachess-view.js +++ b/src/games/chessbase/gigachess-view.js @@ -50,11 +50,12 @@ }); View.Game.cbDefineView = function() { - + var gigachessBoardDelta = { - notationMode: "in", - notationDebug: true, + notationMode: "out", + //notationDebug: true, } + gigachessBoardDelta3d = $.extend(true,{},gigachessBoardDelta, { /*'colorFill' : { diff --git a/src/games/chessbase/index.js b/src/games/chessbase/index.js index 8cec09c..98f9e64 100644 --- a/src/games/chessbase/index.js +++ b/src/games/chessbase/index.js @@ -1119,6 +1119,17 @@ exports.games = (function () { "fairy-set-view.js", "gigachess-view.js" ] + var modelScripts_wtamerlane = [ + "base-model.js", + "grid-geo-model.js", + "wild-tamerlane-model.js" + ] + var config_view_js_wtamerlane = [ + "base-view.js", + "grid-board-view.js", + "fairy-set-view.js", + "wild-tamerlane-view.js" + ] return [ { "name": "classic-chess", @@ -5033,6 +5044,102 @@ exports.games = (function () { } }, "viewScripts": config_view_js_giga + }, + { + "name": "wild-tamerlane-chess", + "modelScripts": modelScripts_wtamerlane, + "config": { + "status": true, + "model": { + "title-en": "Wild Tamerlane", + "summary": "Chess on 11x11 with fairy pieces", + "rules": { + "en": "wild-tamerlane-rules.html" + }, + "module": "chessbase", + "plazza": "true", + "thumbnail": "wild-tamerlane-thumb.png", + "released": 1497874349, + "credits": { + "en": "wild-tamerlane-credits.html" + }, + "gameOptions": config_model_gameOptions, + "obsolete": false, + "js": modelScripts_wtamerlane, + "description": { + "en": "wild-tamerlane-description.html" + }, + "levels": config_model_levels_15 + }, + "view": { + "title-en": "Wild Tamerlane view", + "visuals": { + "600x600": [ + "res/visuals/wild-tamerlane-600x600-3d.jpg", + "res/visuals/wild-tamerlane-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/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/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/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" + ], + "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_wtamerlane, + "useAutoComplete": true + } + }, + "viewScripts": config_view_js_wtamerlane } + ] })() diff --git a/src/games/chessbase/res/rules/wildtamerlane/wild-tamerlane-start.png b/src/games/chessbase/res/rules/wildtamerlane/wild-tamerlane-start.png new file mode 100644 index 0000000..502724e Binary files /dev/null and b/src/games/chessbase/res/rules/wildtamerlane/wild-tamerlane-start.png differ diff --git a/src/games/chessbase/res/visuals/wild-tamerlane-600x600-2d.jpg b/src/games/chessbase/res/visuals/wild-tamerlane-600x600-2d.jpg new file mode 100644 index 0000000..657ca58 Binary files /dev/null and b/src/games/chessbase/res/visuals/wild-tamerlane-600x600-2d.jpg differ diff --git a/src/games/chessbase/res/visuals/wild-tamerlane-600x600-3d.jpg b/src/games/chessbase/res/visuals/wild-tamerlane-600x600-3d.jpg new file mode 100644 index 0000000..29c7455 Binary files /dev/null and b/src/games/chessbase/res/visuals/wild-tamerlane-600x600-3d.jpg differ diff --git a/src/games/chessbase/terachess-view.js b/src/games/chessbase/terachess-view.js index d2c2054..e825a23 100644 --- a/src/games/chessbase/terachess-view.js +++ b/src/games/chessbase/terachess-view.js @@ -51,10 +51,11 @@ View.Game.cbDefineView = function() { - var terachessBoardDelta = { - notationMode: "in", - notationDebug: true, + var terachessBoardDelta = { + notationMode: "out", + //notationDebug: true, } + terachessBoardDelta3d = $.extend(true,{},terachessBoardDelta, { /*'colorFill' : { diff --git a/src/games/chessbase/wild-tamerlane-credits.html b/src/games/chessbase/wild-tamerlane-credits.html new file mode 100644 index 0000000..df19495 --- /dev/null +++ b/src/games/chessbase/wild-tamerlane-credits.html @@ -0,0 +1,6 @@ +

Jocly implementation

+ \ No newline at end of file diff --git a/src/games/chessbase/wild-tamerlane-description.html b/src/games/chessbase/wild-tamerlane-description.html new file mode 100644 index 0000000..03d4c20 --- /dev/null +++ b/src/games/chessbase/wild-tamerlane-description.html @@ -0,0 +1,5 @@ +

This game is a variant of Tamerlane 2000.

+ +

The fact that strong pieces can only appear after promotion gives an original taste to this large Chess Variant but can appear + as too slow to some modern players. Those looking for strategies around "bloody" battles, may appreciate a simple this variant + where Princes and Ship are replaced by Queens and Eagles (i.e. Gryphons) from the initial set-up.

diff --git a/src/games/chessbase/wild-tamerlane-model.js b/src/games/chessbase/wild-tamerlane-model.js new file mode 100644 index 0000000..1585ad4 --- /dev/null +++ b/src/games/chessbase/wild-tamerlane-model.js @@ -0,0 +1,233 @@ +/* + * 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=10; + var firstCol=0; + var lastCol=10; + + var geometry = Model.Game.cbBoardGeometryGrid(11,11); + + // graphs + + + Model.Game.cbEagleGraph = function(geometry){ + var $this=this; + + var flags = $this.cbConstants.FLAG_MOVE | $this.cbConstants.FLAG_CAPTURE; + var graph={}; + for(var pos=0;pos0) + 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 + .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; + } + + +

Initial setup

+ + +

The board has 11 x 11 squares. The 11 files respect the original configuration of Tamerlane's Chess with a central King. + The 11 ranks give more space to the game allowing to arrange the piece before struggling. Moreover, they place Bishops + and Camels on same colors allowing attack of opposite counterparts and mutual protection.

+ +

+ +

+ +

There are 28 pieces per side: 1 King, 2 Queens, 2 Gryphons, 2 Bishops, 2 Knights, 2 Rooks, 2 Elephants, 2 Camels, 2 Cannons + and 11 Pawns.

+ + +

Pieces

+ +

King

+

+ +

+

Moves as in usual Chess, except there is no castling.

+
+

+ +

+

Queen

+

+ +

+

Exactly as in usual Chess.

+
+

+ +

+

Bishop

+

+ +

+

Exactly as in usual Chess.

+
+

+ +

+

Knight

+

+ +

+

Exactly as in usual Chess.

+
+

+ +

+

Rook

+

+ +

+

Exactly as in usual Chess.

+
+

+ +

+

Elephant

+

+ +

+

Moves one or two squares diagonally. When an Elephant moves two squares, it is allowed to jump, i.e., the intervening square does not have to be empty. The Elephant moves as the combined Alfil and Firzan (Ferz) from Shatranj, two pieces which were also present in mediaeval Chess and have disappeared with the birth of modern moves for Queen and Bishop.

+
+

+ +

+

Camel

+

+ +

+

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.

+
+

+ +

+

Cannon

+

+ +

+

moves without taking like a Rook, but it takes by going in a straight horizontal and vertical line and jumping over exactly one piece. When a Cannon takes a piece, there must be exactly one piece between the original and final square of the Cannon's move - this piece may be of either color. (This is identical to the move of the Cannon in Xiangqi.)

+
+

+ +

+

Gryphon

+

+ +

+

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. In my other more recent chess variants, this piece is called an Eagle.

+
+

+ +

\ No newline at end of file diff --git a/src/games/chessbase/wild-tamerlane-thumb.png b/src/games/chessbase/wild-tamerlane-thumb.png new file mode 100644 index 0000000..4fdd9f1 Binary files /dev/null and b/src/games/chessbase/wild-tamerlane-thumb.png differ diff --git a/src/games/chessbase/wild-tamerlane-view.js b/src/games/chessbase/wild-tamerlane-view.js new file mode 100644 index 0000000..69a7556 --- /dev/null +++ b/src/games/chessbase/wild-tamerlane-view.js @@ -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.cbFairyWTamerlanePieceStyle3D = $.extend(true,{},View.Game.cbFairyPieceStyle3D,{ + + }); + + View.Game.cbDefineView = function() { + + var wtamerlaneBoardDelta = { + notationMode: "out", + //notationDebug: true, + } + + wtamerlaneBoardDelta3d = $.extend(true,{},wtamerlaneBoardDelta, + { + /*'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(); + }, + } + ); + + wtamerlaneBoardDelta2d = $.extend(true,{},wtamerlaneBoardDelta, + { + '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 wtamerlaneBoard3d = $.extend(true,{},this.cbGridBoardClassic3DMargin,wtamerlaneBoardDelta3d); + var wtamerlaneBoard2d = $.extend(true,{},this.cbGridBoardClassic2DMargin,wtamerlaneBoardDelta2d); + + return { + coords: { + "2d": this.cbGridBoard.coordsFn.call(this,wtamerlaneBoard2d), + "3d": this.cbGridBoard.coordsFn.call(this,wtamerlaneBoard3d), + }, + boardLayout: [ + ".#.#.#.#.#.", + "#.#.#.#.#.#", + ".#.#.#.#.#.", + "#.#.#.#.#.#", + ".#.#.#.#.#.", + "#.#.#.#.#.#", + ".#.#.#.#.#.", + "#.#.#.#.#.#", + ".#.#.#.#.#.", + "#.#.#.#.#.#", + ".#.#.#.#.#.", + ], + board: { + "2d": { + draw: this.cbDrawBoardFn(wtamerlaneBoard2d), + }, + "3d": { + display: this.cbDisplayBoardFn(wtamerlaneBoard3d), + }, + }, + clicker: { + "2d": { + width: 1018.1818181818, + height: 1018.1818181818, + }, + "3d": { + scale: [0.65454545454545,0.65454545454545,0.65454545454545], + }, + }, + pieces: this.cbFairyPieceStyle({ + "default": { + "2d": { + width: 945.45454545455, + height: 945.45454545455, + }, + "3d": { + scale: [0.43636363636364,0.43636363636364,0.43636363636364], + display: this.cbDisplayPieceFn(this.cbFairyWTamerlanePieceStyle3D) + }, + }, + "fr-amazon" :{ + "3d": { + scale: [0.52363636363636,0.52363636363636,0.52363636363636], + } + }, + }), + }; + } + + /* Make the knight jump when moving */ + 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_J_".indexOf("_"+aMove.a+"_")>=0) && (aGame.g.distGraph[aMove.f][aMove.t]>1)) + return Math.max(zFrom,zTo)+2000; + /*else if(("__".indexOf("_"+aMove.a+"_")>=0) && dx!=dy && dx!=0 && dy!=0) + return Math.max(zFrom,zTo)+2000;*/ + else if(("_C_W_".indexOf("_"+aMove.a+"_")>=0) && aMove.c != null) + return Math.max(zFrom,zTo)+2000; + else + return (zFrom+zTo)/2; + } + +})();