Comments by ChessShogi
It seems that the new move handler isn't updating the part of the diagram that shows which piece is selected.
I am having problems with my new preset for Suzumu Shogi. For some reason, it just keeps echoing "Please report any bugs or errors to Adam DeWitt" over and over again instead of showing the preset like it should. Any help would be greatly appreciated.
I was thinking banning burning Fire Demons and Heavenly Tetrarches (possibly allowing it if something else is burned first), but allowing these pieces to be captured directly or via igui (the latter which is a locust capture). I tried doing it with the BadZone function used in the last version, and most of the time it worked perfectly, but for some reason the part testing for the evic parameter value would cause the area move (and sometimes non-capture moves) to disappear if two burning pieces were within burning distance of their orthogonal ranging moves. Right now, I am happy with the current version. Fire Demons can still be traded, but at least now it is easier for the moving Fire Demon to grab an additional piece without risking recapture thanks to the strengthened burning ability.
I guess I didn't make the link clear enough (Edit: Suzumu Shogi on the Chess Variants Game Courier). What I have should work. I don't see any typos in the code. But of course I'm probably overlooking something.
Edit: I found it. Turns out the remind messages in the Post-Game sections had typos in them.
I fixed most of the issues. Now the only problem that I can see is that the Heavenly Tetrarch's first burn is being rejected when it shouldn't be when the distance between the origin and destination of the first part of the move is at least 2. The problem is likely in the HT subroutine, since it controls the function definition for the second and third parts of the Tetrarch's move, but I could be wrong.
Here is the link for the preset's Edit form: Edit: Suzumu Shogi on the Chess Variants Game Courier
And here's the list of moves for which the error occured:
1. d 8k-8j 1... D 9f-9g 2. p 7l-7k 2... P 10e-10f 3. bg 6m-8k 3... BG 11d-9f 4. fd 7n-6k 4... FD 10c-11f 5. fd 6k-8i 5... FD 11f-9h; pass 6. fd 8i-5f; fd 5f-5e; fd 5e-4e 6... FD 9h-12k; FD 12k-12l; FD 12l-13l 7. fd 5f-7f; pass 7... FD 12k-10k; pass 8. fd 7f-7e; fd 7e-7f; fd 7f-8f 8... FD 10k-10l; FD 10l-10k; FD 10k-9k 9. bg 8k-15d; +bg-dest 9... BG 9f-2m; +BG-dest 10. dk 5n-5o 10... DK 12c-12b 11. cs 4o-14e; +cs-dest 11... CS 13b-3l; +CS-dest 12. +cs 14e-14d; +cs 14d-14e; +cs 14e-13d 12... +CS 3l-3m; +CS 3m-3l; +CS 3l-4m 13. +cs 14e-11b; +cs 11b-10a // <- ERROR: You may not move a +cs from 11b to 10a
That was what I was thinking as well, and given that the rest of the code is fine, we are probably right. Unfortunately, simply getting rid of that clause won't really solve the issue. The Heavenly Tetrarch has a unique mechanic that causes it to jump over the first square it travels over, so the preset needs to take that into account. It might be possible to get rid of it with clever use of the cond statemenet though.
Edit: Turns out I was using the wrong variables to account for the distance of the first part of the move. The values of origin and dest were updated before the move was evaluated, so the distance would always be 1 and the move would thus get rejected. I fixed this by using ori and dst instead, which stay the same for all parts of the move.
Yes, (though this extends to burning pieces in general) and the BadZone code from the last version mostly worked (if you include "in addition to burning another piece"), but like I said earlier, the section testing the evic value (the intermedate square) caused parts of the Demon's area move to disappear when they were within one rank of each other, so I decided to just remove the restriction altogether so I didn't have to worry about it. I think I'll wait until the new function that combines BadZone, WeirdPromotion, etc. is finished.
I can make a revision with the BadZone code in it if you want.
Here is the BadZone function's code:
function badzoneZone(x2, y2, piece, color, x1, y1, ex, ey) { if(touched) return 0; // not during ShowMoves() if(piece == 35 || piece == 65 || piece == 66) // Fire Demons and Heavenly Tetrarches { evic = (ex >= 0) ? board[ey][ex] & 511:-1; // intermediate square if(evic == 35 || evic == 65 || evic == 66) { // Problem area if((x1 == x2 && y1 == y2) || (ex == x2 && ey == y2)) return 0; // Allow direct capture or igui else return 1; // else reject } } return 0; } }
Eventually I hope to make it so that burning pieces cannot burn each other at all.
You can view a diagram with this function implemented here.
The part of the wizard where you add pieces to the board is still broken. The board shows up, but nothing else.
I wonder how the game would be different if the jumping Generals instead had range capturing moves like their Taikyoku Shogi cousins?
There seems to be a bug with the checkahop operator, in that it seems to allow both the hop in the intended direction and the hop in the opposite direction, at least on the second part of a multi-move. This can be demonstrated in this game of Suzumu Shogi (the experimental version w/ triple capturing versions of the jumping Generals)
1. rg 7m-7d; +rg-dest
1... RG 10d-10m; +RG-dest
2. wb 11n-12o // begin setup for bug demo
2... WB 6c-5b
3. +rg 7d-6c
3... +RG 10m-11n
4. fe 8m-10m
4... FE 9d-7d
5. lh 9m-8k
5... LH 8d-9f
6. d 12k-12j
6... D 5f-5g
7. d 12j-11k
7... D 5g-6f
8. p 14l-14k
8... P 3e-3f // end setup for bug demo
// in this position, when +rg 7c is clicked after 9. +rg 6c-7c, it shows the two intended hops plus another (unintended) hop on 4c which jumps over the first piece in the opposite direction, which is incorrectly accepted by the rule enforcement code.
I'm pretty sure this is a server-side bug and not a bug involving my code. Any help would be much appreciated.
Thanks for fixing checkahop.
As for the rest of the RANGECAPTURE code, the not so compact cx and cy assignments were me trying to fix the bug before realizing it was a server-side issue. I can just use cmp there since the jumping Generals can only jump along the eight cardinal directions. Since they use #ori and #dst (the variables that store origin and dest), and the jumping Generals cannot change direction mid-move, there is no need to compare directions, as using cx and cy with checkaride and checkhop returns the same direction as that of the first part of the move. The if statement with the checkaride clause is there to enforce the two jump limit for these pieces. If that checkaride clause fails but the ismultimove subroutine succeeds, the moving pieces has jumped over a piece (and another piece which it just captured) already, and thus cannot jump any more pieces.
Fair enough.
It seems I had an extra parameter in the israngecapture subroutine from when I was trying to use a subroutine to determine whether a range capturing piece had any legal moves left mid-move. It is fixed now. The responsibility of determining whether a piece has any moves left mid-move has been moved to the Post-Game sections, making use of the legalmoves2 subroutine's return value. I also fixed Mitsugumi Shogi's GC preset, which had the same problem.
Edit: I also got rid of the from parameter in the israngecapture subroutine and the statements that call it. Since it wasn't being used within the subroutine itself, there was no need to include it in the parameter list.
It seems there is a bug affecting certain XBetza moves enclosed in parentheses that prevents their highlights from displaying properly. For example, this bug will show up after executing the following moves in Suzumu Shogi's interactive diagram:
1. HFmm11 HFxm12xm13+
After promoting the Falcon to Bishop General (XBetza (cmpaf)2cBmcB), click on it and then click on the Lance in the corner. If done right, the highlights for the second part of the move will not show up at all.
The bug seems to be coming from this line in the NewClick function:
var h = hlights[k], victim = board[h[1]][h[0]], col = ((h[3] & 3) == 1 ? h[3] & 64 ? '#00C000': '#00FF00' : h[3] & 64 ? '#C0C000' : '#FFFF00');
Any help fixing this would be greatly appreciated, as I could potentially reduce the length of the most complicated Suzumu piece's Betza strings significantly.
Suzumu Shogi and Mitsugumi Shogi have been moved to different pages. There is no longer a hyphen separating the words "suzumu/mitsugumi" and "shogi," so if those could be updated that would be greatly appreciated.
Also, Hanten Shogi and Gyaku-sama Shogi no longer exist, so they can be removed from the list.
Yes, using cpaf instead of cmpaf does work, but only if it used once. (cpaf)2cB only covers a subset of the moves that (cmpaf)2cB covers. Remember, the p and a modifiers exclude the m modality if only c and/or d are specified in the modifiers immediately before it, per their definitions. Thankfully, this problem can easily be solved by writing the missing legs separately, yielding B(cpaf)2cBcafpafcBpafcafcB. Longer for sure, but it won't have the same search explosion problem, at least for the (cpaf)2 part. The other two multi-leg parts may have search explosions since paf is (usually) equivalent to mpaf (which can lead to the same problem as before), but they will be much more subtle explosions since paf is only used once.
I will update the diagram at the page I used to demonstrate the Suzumu Shogi BadZone bug (which can be found here) to include this bug, for future reference.
I have implemented k now such that in combination with c it disables capture of royals. (A combination that before was not different from plain c.)
Actually this means that k now can do what the t modifier (for 'tame') does in XBoard. Without using an extra letter!
That's fantastic. Brings Tenjiku Shogi one step closer to being implementable in an interactive diagram. The range jumping piece's moves (in this case the Bishop General) can now be written as B(paf)0ckB, where ck takes care of the restriction against capturing royals by jumping. The current BadZone function could easily handle the rest of the rankings for the jumping Generals. Now just to figure out what to do for the burn...and how to specify options to accomodate how the burning move behaves. Once I have a way to do this, I can take care of the rest.
BTW, I have played Tenjiku at high level according to 'modern' rules, where the King can be jump-captured. To my surprise this was very playable, and not too unbalanced. If you know the correct opening lines. Which my Tenjiku engine was able to determine.
In addition I came to realize that the King has highest rank does not necessarily have to refer to capture. Originally I thought that outlawing jumping over a King only would be pointless, as you would never be interested in doing that when you could also capture it. But it could also refer to your own King. So the evidence that historic rules did not allow King capture is starting to get flimsy.
Jumping Generals are not allowed to jump over a King or Prince (or other higher-ranking pieces) of either side, regardless of which ruleset you use, so the fact that the rankings could refer to friendly pieces is a rather dubious piece of evidence for allowing jump-captures of royals. Besides, even if the evidence for forbidding jump-captures of royals is indeed flimsy, it still improves the gameplay, as allowing jump-capturing of the King creates a critical weaknesses in the opening after 1. 7k (2. VG 2g#) which is only solvable via 1... SE3f. Furthermore, this weakness persists throughout much of the game, as the King remains boxed in throughout the opening and (early) middlegame, the Soaring Eagle on 3f (and other pieces defending 2g and 1h) can easily be threatened with capture, and one wrong move can result in a smothered mate. The point is, you should not need to use an AI to find a good opening.
Unfortunately this is not so easy, because BadZone only gets the locust squares passed. Not the pieces jumped over. The non-destructive intermediate squares are not part of the internal move representation. But I suppose BadZone could be made such that it scans the board for high-rank blockers along the path from origin to destination itself.
You can just use board[y][x] & 511 for the piece type, and a call to a recursive function that scans the in-between squares to handle the rest.
Ok, fair enough.
Yeah, that doesn't seem like a good idea.
This is probably a stupid question, but can a subroutine have zero parameters?
Example:
sub <subname>;
<...code...>
endsub;
25 comments displayed
Permalink to the exact comments currently displayed.
Mitsugumi Shogi is ready