Comments by FergusDuniho
Yes, I was thinking that we no longer need the quickedit script. It was made back when I was still accessing the site through dial-up. Now that we're all using broadband, dial-up speeds are no longer a bottleneck. Besides that, I have since reduced the size of the edititem script by replacing four separate but identical drop-down lists with a single datalist that gets used by four different fields.
update test
When representing a 4D game in two dimensions, which is what we're limited to on a computer screen, it makes sense to pair together a higher-dimensional label with a lower-dimensional one. This is especially so with something like Game Courier, which gives you only files and ranks to work with. This can lead to a coordinate like Dc23, which I hovered over randomly, which transposes the second and third dimensions. Bearing that in mind, it looks like this game has 5 ranks, 5 files, 5 3D rows or levels, and 5 4D columns or realms.
4d games are rare enough that I wouldn't have bothered to add a database column.
Since I was adding code to the footer to indicate a board's dimensions, it seemed more appropriate than treating them as 3D games.
It will probably cause confusion for new authors.
I have added tooltips to the Edit Item form, and if there are other forms they should be added to, I can do that. I have also used parentheses to make it clearer what the dimensions of a board refer to. For 3D boards, a single pair of parentheses go around the files-by-ranks part, and levels goes on its left. For 4D boards, another pair of parentheses goes around the 3D board dimensions, and the 4th dimension goes on the left. The convention I'm following places increasing dimensions on the left, and it treats the number of ranks as the first dimension. This is because in the typical Chess variant, the board has two sides, and each player starts with all his pieces on one side. So, the distance between two sides would be the number of ranks. The second dimension, the number of files, is about how much space each side has to spread out its forces. Since we normally write files before ranks in algebraic notation, it makes sense to add higher dimensions to the left side. Also, this was the convention followed in some 3D games I looked at last night. And it's also sort of how Arabic numerals work. The leftmost digit in a numeral has a higher value than those to the right.
The diagram on the page superficially resembles that of Sphinx Chess, but it has only two axes of movement, the vertical and the horizontal. If you follow the lines of movement of pieces on this board, you will see that multiple boards have been placed together to create a larger playing area on which pieces are still moving in two dimensions.
Extending the number of ranks and files to infinity does not also increase the axes of movement through individual spaces. This is a large 2D game, but it is not 3D or 4D. So, I have removed it from those categories.
Since a toroidal board does not count as a 4D board, I removed the 4D category from this page. A 4D board is one where each coordinate is designated by 4 values, each one representing a different dimension. But each coordinate in this game is designated only by its rank and file.
I have updated the database and relevant scripts to better accommodate 4D games by including a new field for the 4th dimension called BoardRealms. However, I'm not sure what value to give it for this game or what value to change BoardLevels to now that it doesn't have to do all the work for both the 3rd and 4th dimensions.
Since people keep wanting to use tags for information that is already stored in the database, I have modified the footer script to include categories and board dimensions just above the tags section.
There was a syntax error, which I've now corrected. As a test, I updated your profile and changed it back.
I have now modified it to use the update_row function, which should fix things.
I checked my Chess,_Large.zrf file, and while it had them at a1 and j1, at b1 and i1, and twice at g1 and d1, it didn't have them at c1 and h1. I like how the mid position on each flank lets the Archbishop cover most of the Pawns on its side while the neighboring Bishop covers the Pawn in front of it.
Okay, that's fixed now.
Should this script be calling update_row (or some other indexing func) instead of its ad hoc query?
Yes, these functions are more secure and error-proof than ad hoc code may be, and it's best to not reinvent the wheel each time we need to access the database. So, I have now rewritten the script to use update_row and replace_row. I have left the other code in comments in case I made a mistake and need to reference it.
What I've done for now is provide an individual default for each parameter instead of giving them all an empty string as the default. I'll do some more work later.
7:44 am CST would be 13:44 UTC, and I got this for that time:
[23-Jan-2023 13:44:07 UTC] PHP Fatal error: Uncaught PDOException: SQLSTATE[22007]:
Invalid datetime format: 1366 Incorrect integer value: '' for column
`chessvariants`.`Item`.`BoardRows` at row 1 in /home/chessvariants/public_html/index/membersubmission2.php:385
Stack trace:
#0 /home/chessvariants/public_html/index/membersubmission2.php(385): PDOStatement->execute()
#1 {main}
thrown in /home/chessvariants/public_html/index/membersubmission2.php on line 385
Instead of using replace
, I should probably use insert
if the row doesn't exist and update
if it does, as I have already fixed this problem for the update_row
function. Since BoardRows is not even a datetime field, this is a weird message, but the underlying problem is that replace
is getting an empty string instead of whatever it is expecting.
I'm not sure if this is due to the server move, but member-submission of External Link pages doesn't seem to be working.
As a preliminary test, I made a link page to PyChess, and it worked. So, I have not been able to repeat the problem you encountered. If you have any further problem with it, let me know the time and details do that I can check the error log.
I'll look into it tomorrow.
I have made some updates to the sections Preprocessing Substitutions and Expressions. For the latter, I compared the documentation with the code and added entries for operators and built-in functions I had not yet documented.
The documentation was incorrect. You do not need the logic
keyword.
With expressions enclosed in parentheses, it's even possible to construct variable names and create some very obfuscated code. For example:
set a.1 Adam;
set a.2 Abel;
set Abel.brother.1 Cain;
set Abel.brother.2 Seth;
echo #a.{- 5 4};
echo #{#{chr - ord b 1}.2}.b{rot}her.{!= brother keeper};
The output is:
Adam
Cain
Note that rot
is just a bare string, and {rot}
just gets replaced with rot
during preprocessing.
I didn't get the same output as you. I got this:
Array
(
[0] => w
[1] => se
[2] => s
[3] => nw
[4] => e
[5] => n
)
Would it work to combine direction with where like this?
where c3 logic direction a1 c3
As long as your code is using logical directions that match the output of direction
. If you have not setup logical directions, and your code only uses mathematical relations between spaces, then it will not work.
You may use braces where you don't need them, such as in set
, if
or elseif
. You may do this for stylistic reasons or because you can't remember which commands normally work with expressions.
set c {join e 2};
if {== #c e1}:
echo "Partridge";
elseif {== #c e2}:
echo "Turtledoves";
elseif {== #c e3}:
echo "French Hens";
endif;
This outputs Turtledoves
.
Here's an example of including expressions between braces, first as a lone argument, then inside of a string.
set c e2;
echo {space e2} "{var c}-{join filename var c + rankname var c 2}";
Here's the output:
P e2-e4
25 comments displayed
Permalink to the exact comments currently displayed.
It was using the wrong case for the promotion. It will now enter that move as
N 7g-5j; +N-dest
and work correctly.