Check out Glinski's Hexagonal Chess, our featured variant for May, 2024.


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

Single Comment

GAME code table-driven move generator[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Tue, Jul 28, 2020 10:41 PM UTC in reply to H. G. Muller from 09:09 PM:

But what if I want to do it in a loop, to add the elements one by one?

I recently added better support for arrays. See this comment for details:

https://www.chessvariants.com/index/listcomments.php?id=39825

Is there a way to create an empty array?

Set it to an empty pair of parentheses, like so:

set ra ();

Can I push something to a so-far unused variable to create an array of one element?

Yes, there is a push command.

Can I push something to a scalar variable to make it an array of two elements?

I hadn't thought of that. You can now. The previous behavior was to hang the program without a helpful error message. So, changing that is not going to break anything.

Can I use setelem on a so-far unused variable?

Yes. You can now also use set. See the link above.