Well, as you said, custom scripting is always an option. I am having trouble though when it comes to custom scripting compatibility for the AI though, probably because I set the kind variable in the Tinker() function itself. Here's the code for Raichu Shogi I use, when allowing hit-and-run captures of Lions to trigger the forced pass.
function raichuTinker(m, d) {
dest = board[m[3]][m[2]] & 511;
midpoint = m[-2] > 2 ? (board[m[5]][m[4]] & 511) : 0;
if(IsLion(dest) || IsLion(midpoint)) kind |= 64; // problem line, will be replaced with: return 5;
return 0;
}
function IsLion(pieceType) { // Returns true if pieceType is a Lion
return pieceType == 20 || pieceType == 31;
}
Let's say that instead of setting it in the function, I want to return a value of 5 to indicate the forced pass, and set kind |= 64 elsewhere. Where should I set it?
When I tried in AlterMove(), and the Console gave the following error (this is in a local file),
Raichu Shogi.html:17 Uncaught RangeError: Maximum call stack size exceeded
at AlterMove (Raichu Shogi.html:17:19)
at StackMove (sourcecode.js:3068:10)
at NextLeg (sourcecode.js:3325:22)
at NextLeg (sourcecode.js:3328:9)
at NewInner (sourcecode.js:3357:7)
at NewGen (sourcecode.js:3368:3)
at GenAll (sourcecode.js:3404:41)
at AlphaBeta (sourcecode.js:3647:3)
at AlphaBeta (sourcecode.js:3678:19)
at AlphaBeta (sourcecode.js:3678:19)
, after I added an if statement telling AlterMove() to set kind |= 64 and return 0 for the normal move in the section with the Tinker() call.
Well, as you said, custom scripting is always an option. I am having trouble though when it comes to custom scripting compatibility for the AI though, probably because I set the kind variable in the Tinker() function itself. Here's the code for Raichu Shogi I use, when allowing hit-and-run captures of Lions to trigger the forced pass.
Let's say that instead of setting it in the function, I want to return a value of 5 to indicate the forced pass, and set kind |= 64 elsewhere. Where should I set it?
When I tried in AlterMove(), and the Console gave the following error (this is in a local file),
Raichu Shogi.html:17 Uncaught RangeError: Maximum call stack size exceeded
at AlterMove (Raichu Shogi.html:17:19)
at StackMove (sourcecode.js:3068:10)
at NextLeg (sourcecode.js:3325:22)
at NextLeg (sourcecode.js:3328:9)
at NewInner (sourcecode.js:3357:7)
at NewGen (sourcecode.js:3368:3)
at GenAll (sourcecode.js:3404:41)
at AlphaBeta (sourcecode.js:3647:3)
at AlphaBeta (sourcecode.js:3678:19)
at AlphaBeta (sourcecode.js:3678:19)
, after I added an if statement telling AlterMove() to set kind |= 64 and return 0 for the normal move in the section with the Tinker() call.