Check out Grant Acedrex, our featured variant for April, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Latest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments by FergusDuniho

LatestLater Reverse Order EarlierEarliest
Apothecary Chess-Modern. Large Board variant obtained trough tinkering with known games.[All Comments] [Add Comment or Rating]
🕸Fergus Duniho wrote on Mon, Aug 31, 2020 12:54 PM UTC in reply to Aurelian Florea from 08:07 AM:

You should set your random values to constants, not to variables, since the same random values have to be re-used throughout a game. The setconst command will assign a new value only if the constant's value is not already on record. Unlike variables, constants will get stored in the log. If a constant's value was written to the log at an earlier time, it will be retrieved and reused instead of setting the constant's value again.


Apothecary chess preset error[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Mon, Aug 31, 2020 04:19 AM UTC in reply to Greg Strong from Sun Aug 30 08:57 PM:

Would editing the settings change the seed?

Not usually, but it could change the order that random numbers are generated in, the range of random numbers, the number of random numbers, or how random numbers are used. Using the same seed preserves things only so long as everything else regarding random number generation and usage remains the same. Since we cannot count on PHP continuing to use the same randomization algorithm, it is best to store the final result in a constant and to use that.


Grand Chess. Christian Freeling's popular large chess variant on 10 by 10 board. Rules and links. (10x10, Cells: 100) (Recognized!)[All Comments] [Add Comment or Rating]
🕸Fergus Duniho wrote on Mon, Aug 31, 2020 02:13 AM UTC in reply to Greg Strong from Sun Aug 2 11:45 PM:

My game against the interactive diagram. I played White and won.

  1. f5 Nh7 2. Nh4 Ng5 3. e4 Cf7 4. Nc4 Rag10 5. g4 Nc7 6. Bf4 h6 7. Ng6 Nce6 8. Nge5 Nxf4 9. Cxf4 Ch8 10. h4 Nf7 11. Nxf7 gxf7 12. Cxh6 Rg7 13. Rjg1 Rg8 14. g5 Cg7 15. Cxg7 Rxg7 16. f6 Rg6 17. d4 Rjg10 18. e5 R6g8 19. Bf5 d7 20. Rg3 e6 21. fxe7 Bxe7 22. Rf1 Rg7 23. Nb6 Bxa3 24. Nxa8 Be7 25. Rgg1 R10g8 26. Ra1 Qe8 27. Nc7 Qd8 28. Ra9 Ke10 29. Rxf9 Kxf9 30. Nd5 Ba3 31. Qa2 Be7 32. Qa9 Kg10 33. Ra1 Rg9 34. Qa10 Kf9 35. Ra9 Ke8 36. Qc10 Rd9 37. Qe10 Re9 38. Rxe9 Qxe9 39. Qxc8 Bd8 40. Bxd7

Is there any way to replay past games with the interactive diagram?


Apothecary chess preset error[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Sun, Aug 30, 2020 08:48 PM UTC:

I think the main problem is the random setup. When you randomize the setup, you have to take measures to keep it the same throughout the game. This used to be done by reusing the same seed. But ever since a change in PHP's randomization algorithm screwed this up, the preferred method has been to store the random factors or results in a constant. If the relevant constants exist, use the values already stored in them. Use random values only on the very first time, set the constant values immediately, and then just use the constants.


🕸Fergus Duniho wrote on Sun, Aug 30, 2020 06:38 PM UTC in reply to Aurelian Florea from 05:10 AM:

I updated the die command to print the last move in this situation. This will point you to where the problem is.


Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Sat, Aug 29, 2020 05:47 PM UTC:

I have updated movepiece.js again. In case you want to use one-click moving when there is more than one move available, what you can do next has become a bit more intuitive. When it turns out that all matching legal moves start with movement by the same piece, and this was not the first piece clicked on, the clicks array is modified to include a click on that piece as the first click. Also, the only spaces that get highlighted are those that can disambiguate the move further. One consequence of this is that you can sometimes click on a space twice in a row to move a piece there.

Thanks to misremembering what was stored in the clicks array, the showNextLegal() function was not handling drops, and the showAllLegal() function was picking up the slack, which was causing the move options requester to pop up for drop moves. I stopped this by fixing showNextLegal() to handle drops correctly.


🕸📝Fergus Duniho wrote on Sat, Aug 29, 2020 02:18 AM UTC in reply to H. G. Muller from Fri Aug 21 11:13 AM:

BTW, since you seem to synthesize the move texts from the square pairs given to setlegal, which you will have to do for backward compatibility, it might be better to extend the capabilities of setlegal to also accept multi-leg moves, so that there is a unified way to submit moves for highlighting. E.g. you could add to the specs that when the (only) argument of setlegal is an array, it will treat it as a multi-leg move. (You can still distinguish that from the other formats, which always have to start with a square.) The array could then be interpreted as a sequence of (from, to) pairs for each of the legs, from which a move text would be generated by concatenating them, using hyphens and semiclons as separators where appropriate. E.g.

setlegal (c6 e5 e5 d4 Q dest);
setlegal (e2 e7 @ e8 N e6);

I have extended setlegal to treat an initial array and any subsequent array after a first array as a multi-part move. So far, this works only with coordinates, not with pieces. Also, it specifies a path. So, setlegal (c6 e5 d4) would result in "[piece notation] c6-e5; e5-d4". I might change it to something simpler, like what you're suggesting, since it would make it easier to include pieces.

I have also extended it to add strings to the $extralegal array. This lets you construct any legal move you like as a string. Now that variables can be included in strings when enclosed in braces, this should prove an easy way to add legal moves.

Finally, legal moves are now being validated. After all legal moves have been assigned, they are run through a filter to make sure they are well-formed.


A Wizard for GAME-Code Generation. A tutorial on using the Play-Test Applet for automating Game Courier presets.[All Comments] [Add Comment or Rating]
🕸Fergus Duniho wrote on Thu, Aug 27, 2020 09:14 PM UTC:

Since my copy of Mighty Lion Chess wasn't handling en passant capture, I updated it to the latest code. After doing so, I was unable to move pieces by clicking on them. This was so both in the code I was testing and in the already-tested stable code. On investigation, I found out that the list of legal moves included the move "zzz,rlbqkbnrpppppppp32PPPPPPPPRLBQKBNR,4". This was screwing things up. Please limit the use of the list of legal moves to properly formatted moves.

In case you need to pass other data to JavaScript, I have just added the command setjsvar. Use this like you would set. It will store values into an associative array keyed to the variable names, and after the program runs, it will write JavaScript variable assignments. It will write numeric values as is, put quotation marks around strings, and JSON encode arrays. It will write the assignments before the legalList assignment, so that you cannot use it to overwrite this variable.


Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Wed, Aug 26, 2020 02:43 PM UTC in reply to H. G. Muller from 06:38 AM:

But you do that when the opponent is on move. Otherwise nothing would be shown anyway. When we say 'opponent' in these discussion, we mean the opponent of the side that is on move in the displayed position. Not necessarily that of the player who is looking at the page.

In normal usage, a game typically has two players, and each player is the other player's opponent. According to the variable names used in Game Courier, $player is the player whose turn it is to move, and $opponent is the other player. In this specialized usage, only the player's moves are ever shown, and the opponent's moves are never shown. More precisely, only the current player's moves are ever available to be shown, and the attacks the opponent could make are not available to be shown.

When a player moves, $player and $opponent switch values, and that player can then see the moves available to his opponent up until his opponent moves. It would probably be even more useful to show attacks from the opponent when it is not that opponent's turn, but that would take additional programming, and it would be incompatible with another useful feature I just added, which is the ability to capture an opponent's piece in one click if there is only one legal move to its space.

In hindsight, I would like to undo the use of $player and $opponent as variables, because they have hindered my ability to program multi-player games. But at this stage, it would require a lot of reprogramming.


🕸📝Fergus Duniho wrote on Wed, Aug 26, 2020 02:26 AM UTC:

Since it took less work, I moved the requester to its own function, selectMove(), and I used it in three places in movePiece().


🕸📝Fergus Duniho wrote on Tue, Aug 25, 2020 05:27 PM UTC in reply to H. G. Muller from 08:27 AM:

I can see little reason for clicking an opponent piece or empty square without the intention to move there with fewer clicks

That's what I was thinking.

In case of ambiguity this means the order of the first two clicks would be swapped.

This occurred to me while I was while trying to sleep last night, and I just programmed it to do that.

Now that it does that, I think I want to combine clicking the first time and clicking subsequent times for legal moves. Right now, they are currently handled separately, and a first click does not pop up the requester for multiple move options. Alternately, I may make put the requester in its own function and call it from different places.


🕸📝Fergus Duniho wrote on Tue, Aug 25, 2020 03:34 AM UTC:

I was interrupted when I was writing before, and I just now remembered something I wanted to include. By using showNextLegal(), the code can tell that a piece has no legal moves of its own, and by using showAllLegal(), it can then tell how many legal moves there are to that space. It is through using both together that one-click moving to a space occupied by an enemy piece is made possible.


🕸📝Fergus Duniho wrote on Tue, Aug 25, 2020 01:45 AM UTC in reply to Fergus Duniho from Mon Aug 24 09:54 PM:

Since this would not work properly with moving pieces by clicking on the destination first, I removed that capability. It will now only show where the piece clicked on can move to. It will no longer show which pieces can move to a particular space.

I have restored that ability, and I enhanced the ability to quickly make moves. I renamed the old showLegal() function to showAllLegal(), and I renamed the new one to showNextLegal(). As these names suggest, showNextLegal does not always show as many legal moves as showAllLegal() does. Since showNextLegal() applies clicks in order, it may exclude moves that showAllLegal(), which does not apply clicks in order, would not exclude. Because showAllLegal() returns all possible moves involving a space, it can be used to determine if there is only one legal move involving that space. This allows Game Courier to play a move right away when it determines that there is only one legal move involving the space clicked on. This now works for enemy pieces as well as empty space. But it will not work when you click on one of your own pieces to see its legal moves. In that case, it will display the legal moves even if there is only one, and it will not play the move automatically.


What moves can your opponent do.[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Mon, Aug 24, 2020 10:11 PM UTC in reply to wdtr2 from 09:31 PM:

In the past, if I clicked on an opponent piece at this time, I could see the legal moves that he/she could do on his/her turn.

That ability has been restored. The code was referencing a new element that didn't exist on the preview page, and that was causing the movePiece() function to crash.


Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Mon, Aug 24, 2020 09:54 PM UTC in reply to H. G. Muller from Sat Aug 22 06:50 AM:

More serious is that when I try to play a distant Lion move beyond the Pawn (e.g. l d6-e4) it does not immediately accept the move, but still wants me to choose between the simple move and "l d6-e5; l e5-e4", highlighting both e4 and e5 to make that choice. This is a consequence of the "any order" policy, rather than using the order of entry of clicks 2 and 3 to distinguish between the shooter and the multi-mover case.

For me that issue is still important enough to prefer my own adaptation of the JavaScript.

I had a different issue with the any order mechanism for selecting moves. When I clicked on one of my own pieces in Fusion Chess, it would show both that piece's moves and any fusion moves to that space by another piece. This could be confusing, and I decided it would be better to just show the moves for the piece clicked on. To accomplish this, I rewrote showLegal() to require that the steps of a move be entered in order. When the same space is clicked twice, this signals that moves with more steps should not be accepted, and that the move's final destination must be the space that was clicked on again. This is useful for selecting a shorter move from longer continuations of the same move or for selecting a move that returns to its origin.

Since this would not work properly with moving pieces by clicking on the destination first, I removed that capability. It will now only show where the piece clicked on can move to. It will no longer show which pieces can move to a particular space.


Game Courier. PHP script for playing Chess variants online.[All Comments] [Add Comment or Rating]
🕸💡📝Fergus Duniho wrote on Mon, Aug 24, 2020 03:49 PM UTC in reply to H. G. Muller from 02:54 PM:

Okay, I see we were talking about different things. I have now added a line to set clicks to [] after the code you quoted.


🕸💡📝Fergus Duniho wrote on Mon, Aug 24, 2020 02:34 PM UTC in reply to H. G. Muller from 11:35 AM:

I think the problem is that the array 'clicks' is not cleared when canceling the move through the popup.

That was the problem before I fixed it the other day.

It is cleared from resetBoard(), but the popup does not call that; it calls clearBorders().

The popup does call it. The Cancel button calls resetBoard() when it is clicked.


🕸💡📝Fergus Duniho wrote on Sun, Aug 23, 2020 07:06 PM UTC in reply to A. M. DeWitt from 04:24 PM:

It worked in my tests. In case it helps, I have purged the script from Cloudflare's cache.


🕸💡📝Fergus Duniho wrote on Sun, Aug 23, 2020 03:41 PM UTC in reply to A. M. DeWitt from 02:16 PM:

I also found another bug that prevents Game Courier from displaying legal moves after trying to make an illegal move with the mouse and then cancelling it with the popup.

That's now fixed. It wasn't resetting a new variable I started using.


🕸💡📝Fergus Duniho wrote on Sun, Aug 23, 2020 01:29 PM UTC in reply to H. G. Muller from 05:48 AM:

The new code is too careless in deciding whether a square coordinate is mentioned in a move string: it uses the JavaScript endsWith method.

Okay, I have corrected it to not use endsWith(). It now stores the final step into a variable before reducing the array to unique values, and it uses a comparison with that variable where it used to use endsWith(). I tested the new code on fission moves in Fusion Chess, and it worked.


Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Sun, Aug 23, 2020 01:15 PM UTC in reply to H. G. Muller from 05:35 AM:

You mean showLegal() in the JavaScript.

Yes, I have made the correction now.


🕸📝Fergus Duniho wrote on Sun, Aug 23, 2020 02:04 AM UTC:

I modified showLegal() slightly to leave out piece notation when parsing a move string. So, the only steps it considers are coordinates and piece notation concatenated with an * for drops. I also modified it to strip out forward slashes, which are used for inline comments. These two modifications are useful because of a trick I came up with for writing fission moves in Fusion Chess. I realized I could write the remaining part of the fission move as a comment, and even though it was a comment, this would allow a player to make a fission move by clicking on the origin space for the third click. After all, there is nothing in setLegal() that distinguishes between real moves and comments. In this case, the comment helps reveal something about the move that distinguishes it from the standard move. Since clicking on a space twice works only when all steps in a move have been used up, I had to eliminate piece notation as steps. This is fine, since they play no role in narrowing down legal moves.


Moves via mouse click[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Sat, Aug 22, 2020 09:46 PM UTC in reply to Fergus Duniho from 09:07 PM:

It was hanging at the clearBorders function. This function used a for of loop, which iterates through the values of an array. When I changed it to the older style that matches for in C or PHP, it worked. However, it did display legal moves, and the showLegal() function also uses for of loops. Maybe it just had a problem with using that kind of loop with an array of HTML elements. Anyway, it seems to be the only thing I had to change. Since I was already planning on it, I also removed showLegalFrom() and showLegalTo() while updating this function.


🕸Fergus Duniho wrote on Sat, Aug 22, 2020 09:20 PM UTC in reply to Fergus Duniho from 09:07 PM:

Although H. G. Muller's code let me move as White by tapping the screen, it did not let me move as Black. It had the same problem as my code had from the start.


🕸Fergus Duniho wrote on Sat, Aug 22, 2020 09:07 PM UTC:

I can't move by mouse on my iPad2. I have tried Chrome, Edge, Safari, and Dolphin, and they all have the same problem. It will highlight the legal moves when I tap a piece, but when I tap the space to move to, it does not update the moves field or submit the move. It will also not show the requester for multiple move options. My guess is that something in my JavaScript is not supported on the iPad2. This is an older model that doesn't support all modern browsers, and I think it requires any browser it does support to use Safari's WebKit.

I tried H. G. Muller's code with Mighty Lion Chess on Chrome, and it does work. So, it looks like it is something I introduced just recently.


25 comments displayed

LatestLater Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.