Comments by FergusDuniho
You're using k/K for the general, but the code you copied is using g/G. So kpos and Kpos are not being updated.
Your link is missing a query string.
The print color scheme now has its own small logo too. Since the big logo included 19th century black and white artwork of Chess pieces, I chose a more retro style that displays fairy pieces by changing the orientation of Chess piece images. According to a section of Anthony Dickins' A Guide to Fairy Chess, the inverted queen is the grasshopper, and the reclining bishop is the unicorn.
I have changed forpersonid to author in the link, and it now works.
if == 0 $mline[$mln]->movenum:
That is mixing GAME Code with PHP. GAME Code does not support classes with properties or write out array elements with brackets, and it doesn't provide read access to $mline. But you can use the value of turn
with your knowledge of which side you're concerned with to determine where you are in a game.
I am not familiar with this technique, but a problem could be that it is not just about positioning the images, but also about translating mouse clicks to cell coordinates. (Which must also work for empty cells, for entering non-captures.) In the table version I have attached event handlers to the cells for this.
With grid, you would use a <div>
tag instead of a <td>
tag for each space, and you could attach event handlers to it just as easily. What I have done in Game Courier, though, is place a transparent image over each empty space, as I have attached event handlers to the piece images.
set all == mln $maxmln; // indicates last move
Note there is no $ there, so we might be talking about different things, and this one might be a legacy variable.
This operator just outputs the value of $mln.
I cannot image how this would work if mln was not the current move number.
It works because you are comparing mln with its maximum value. When there are comments, $maxmln will be greater than any move number, but it will be no higher than mln will eventually reach.
The I.D. represents the board through a HTML table,
Game Courier used to use HTML tables for hexagonal boards, but I gave up on this in favor of using either CSS with a board image or drawing the board image. This reminds me that I was working on getting CSS to work with a generated board image so that you could view each position of the game without reloading the page, but I haven't completed that. I think I had two different approaches and wasn't sure which one to go with. I either wanted to change how I generated the board so that the image would be perfectly symmetrical, or I wanted to modify the code to work with the asymmetrical boards I was already generating. I lost sight of what I was doing when I got caught up with other projects.
in theory it should be possible to create a table with a masonry-like tiling, shifting each subsequent rank by half a cell.
I imagine this would be easier to do with CSS grid, because, as far as I know, table columns remain vertical.
I have tried this, though, and it works to some extent. But for reasons that I do not grasp yet it also changes the height of the ranks in a way that I could not control.
Using grid would probably help you avoid this problem too. With grid, you should be able to make one column or row diagonal, though I have not yet tried using grid with hexagonal boards. My CSS code for hexagonal boards uses absolute positioning, as grid was not yet part of CSS when I wrote the code. Anyway, absolute positioning is another alternative to using tables.
I think the variable 'mln' gives you the current move number in the Post-Move sections.
It does not. I have made that mistake too and had to correct it. To use $mln
to get the move number, you need to get $mline[$mln]->movenum
. $mline is an array with a separate entry for each line of the movelist, but besides containing actual moves, it contains comments. $mln
is the index that a line has in this array, but when some lines are comments, it will go out of sync with the move number.
GAME Code has turn
, which will return $mline[$mln]->turn
, but it doesn't currently have anything returning $mline[$mln]->movenum
.
The Official Glinski Coordinates preset has CSS rendering which isn't working right for hexagonal games
The board image it was using had two separate elseif clauses dealing with it in a long series of elseif clauses in image_dimensions.php, and changes I was making to the second one had no effect. But when I noticed that it had two and combined them into one, I was able to set a value for $offy that worked for the board.
Is it possible to make an Interactive Diagram use a hexagonal board?
I may make a logo for it with some of Tenniel's black and white illustrations from Through the Looking-Glass, though I'm open to other ideas.
I have now done that except that I cropped and divided one illustration instead of using two separate illustrations. Also, most of the small piece images I used are based on characters Alice encounters in Lewis Carroll's books.
Glinski's Hexagonal Chess is the featured variant for May, 2024.
Hey! New month started!
Oh, right. I was focused on updating the color schemes. I should exercise now, but I'll remember to do this soon.
The color scheme code I was working on yesterday and into today is now on the site. As I mentioned before, it will now change the theme with JavaScript as long as JavaScript is enabled. This is done mainly as a backup for older browsers that do not support :has() in CSS. It uses both JavaScript and CSS to change the color scheme so that if one method fails, the other one might still work. Generally, the CSS method will fail on older browsers, and the JavaScript method will fail if someone has JavaScript disabled.
One new feature is the Print color scheme. This is a more minimalist version of the Light color scheme. I may make a logo for it with some of Tenniel's black and white illustrations from Through the Looking-Glass, though I'm open to other ideas. For now, it uses the same logos as the Light color scheme.
Internally, I have moved the color scheme CSS to colors.css, where it is better organized and more maintainable than before. First, it creates individual custom properties for each color in each color scheme. The light ones begin with --light-, the dark ones with --dark-, etc. Since it has to define each color scheme multiple times for different selectors, it defines them in terms of the individual custom properties already created. So if I decide to change a color, there is now only one place it has to be changed.
Also, this provides page authors with the ability to customize color schemes for a particular page. By adding a style section in which you add custom properties to :root, you can rewrite individual values for particular color schemes.
On the page /index-test.html, I have augmented the CSS implementation of the color schemes with a JavaScript implementation. The CSS implementation works without JavaScript, but it requires the use of :has(), which earlier browsers do not support. The JavaScript implementation is working on both my Kindle browser and on both Chrome and Edge on my iPad 2, though the latter two require you to save your change before it takes effect. I don't think there are browsers more primitive than these that still need to be supported. By providing both a CSS and a JavaScript way to change the color scheme, this expands the number of browsers it will work well on. I plan to add the code for this to the site tomorrow. In the meantime, try it out and let me know how it works for you, particularly if you have some older device I am not using.
I could not figure out what closing tag you were mentioning.
I already fixed that bug, and it was in my code, not yours.
This ID still does not work properly!
I tested it in Safari, Edge, and Firefox this morning, and it was working in all of them, though I did have to reload the page in Firefox before the board would display.
When I go to any person information page and try to view unpublished submissions, it just shows my own submissions.
Okay, I corrected that.
There was a typo in implementing a new property I had added. I added the displayPieces property, which when set above zero will display the piece table when the page loads. This much worked as it should, but when it was not set, it omitted the closing >
in the tag, which caused what followed it to not be displayed.
It's important to maintain backwards compatibility, and anyone who doesn't like the name of Aanca is free to use a different name with an alias.
For some reason, it cannot find the description even though the path to that file is correct, but I'm not really concerned about that.
It wasn't prepending ROOT to the filename. So it was actually incorrect. I have now fixed that.
I fixed the PHP script behind this page to display the description, rules, and credits for this page, but it could not find some of the expected files.
Therefore Fergus created separate HTML pages for individual variants, which embed the Jocly applet preconfigured to run the corresponding variant, with a rule description. The overview page you refer to contains links to those individual game pages.
While I used to make separate HTML pages for individual variants, I replaced this practice with a PHP script that gets called through a semantic URL whose relative part starts with "/play/jocly/". If you want to review its code to see how it works, you can find the script at "/play/jocly/control.php". It relies on certain files being in place to display the description, rules and credits. It should work with games that have not been indexed yet, and if you do use it with unindexed games, you can, as an editor, add them to the index.
Please remove these unneeded lines from Edit Metadata also. I’ve written new page, thank you, but when I tried to revert it to Members-only, error repeated. It shows that I’m veteran contributor with nine or more submissions, so I cannot publish more if I have nine submissions to review (even if it’s not).
While it was giving you the same error message, it wasn't due to extra code again. This time, another variable was undefined, which caused its counts of the database to return the wrong values, and the solution was to add a new line assigning its value.
25 comments displayed
Permalink to the exact comments currently displayed.
I have just added thismovenum and maxmovenum. These will return $mline[$mln]->movenum and $mline[$maxmln]->movenum. It's likely that maxmovenum will be returning the same value as movenum, which returns $movenum, but using it will add clarity to your code.