added suicide checkers

This commit is contained in:
mig 2017-05-18 00:14:08 +02:00
parent 86796f8d14
commit d1525b241b
4 changed files with 100 additions and 2 deletions

View file

@ -66,6 +66,7 @@
this.g.drawKvs2K=true;
this.g.whiteStarts=true;
this.g.king180deg=false;
this.g.suicide=false;
if(this.mOptions.variant)
for(var k in this.mOptions.variant)
@ -499,6 +500,10 @@
this.mFinished=true;
this.mWinner=-this.mWho;
break;
case "win":
this.mFinished=true;
this.mWinner=this.mWho;
break;
default:
this.mFinished=true;
this.mWinner=JocGame.DRAW;
@ -562,12 +567,12 @@
if(this.pCount[1]==0) {
this.mFinished=true;
this.mWinner=JocGame.PLAYER_A;
this.mWinner=aGame.g.suicide ? JocGame.PLAYER_B : JocGame.PLAYER_A;
return;
}
if(this.pCount[0]==0) {
this.mFinished=true;
this.mWinner=JocGame.PLAYER_B;
this.mWinner=aGame.g.suicide ? JocGame.PLAYER_A : JocGame.PLAYER_B;
return;
}
@ -588,6 +593,9 @@
}
}
this.mEvaluation += (rowSumA-rowSumB) * aGame.g.lastRowFactor;
if(aGame.g.suicide)
this.mEvaluation = -this.mEvaluation;
}
//JocLog("Evaluation",this.mEvaluation,this.pCount);

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -901,6 +901,69 @@ exports.games = (function() {
},
"viewScripts": config_view_js_4
},
{
"name": "suicide-checkers",
"modelScripts": modelScripts_3,
"config": {
"status": true,
"model": {
"title-en": "Suicide checkers",
"summary": "A.k.a Giveaway checkers or Anti-checkers",
"rules": "rules-suicide-checkers.html",
"maxLevel": 20,
"plazza": "true",
"thumbnail": "draughts8-suicide-thumb3d.png",
"module": "checkers",
"description": "description.html",
"credits": "credits.html",
"js": modelScripts_3,
"gameOptions": {
"preventRepeat": true,
"width": 4,
"height": 8,
"initial": config_model_gameOptions_initial_2,
"variant": {
"mustMoveForwardStrict": true,
"lastRowCrown": true,
"captureLongestLine": true,
"longRangeKing": false,
"kingCaptureShort": true,
"lastRowFactor": 0.001,
"kingValue": 2,
"whiteStarts": false,
"canCaptureBackward": false,
"suicide": true,
"noMove": "win"
},
"invertNotation": true,
"uctTransposition": "state"
},
"levels": config_model_levels_7
},
"view": {
"title-en": "Draughts View",
"preferredRatio": 1,
"js": config_view_js_4,
"skins": config_view_skins_8,
"visuals": {
"600x600": [
"res/visuals/english-draughts-600x600-3d.jpg",
"res/visuals/english-draughts-600x600-2d.jpg"
]
},
"sounds": config_view_sounds_2,
"module": "checkers",
"css": config_view_css_2,
"switchable": true,
"animateSelfMoves": false,
"useNotation": true,
"useShowMoves": true,
"defaultOptions": config_view_defaultOptions,
"xdView": true
}
},
"viewScripts": config_view_js_4
},
{
"name": "brazilian-draughts",
"modelScripts": modelScripts_3,

View file

@ -0,0 +1,27 @@
<p>In all Draughts variants, the following rules apply:</p>
<ul>
<li>Players take turn by moving one piece</li>
<li>Pieces can move to an adjacent empty position</li>
<li>An adjacent opponent piece can be captured by jumping over it (which implies the next position is available)
<p style="text-align: center;"><img style="max-width:100%" src="{GAME}/res/rules/capture.jpg"/></p>
</li>
<li>When possible, several captures can be performed at the same round (with the same piece)</li>
</ul>
<p>In English Draughts, the additional rules also apply:</p>
<ul>
<li>The board and initial position is the following:
<p style="text-align: center;"><img style="max-width:100%" src="{GAME}/res/rules/brit-checkers-start.jpg"/></p>
</li>
<li>Pieces moves only on dark squares</li>
<li>Simple pieces can only move forward, even for capture</li>
<li>Promoted pieces, called kings, can move backward, but only to adjacent positions</li>
<li>After a capture, a king must stop just after the captured piece (unless it can do another capture)</li>
<li>Black starts</li>
<li>Capture is compulsory</li>
<li>Captured pieces are removed after all captures are done</li>
<li>If a piece reaches the last line during a capture sequence, it is not promoted, unless the capture finishes on the last line</li>
<li>A player who cannot play any move loses the game</li>
</ul>