Check out Modern Chess, our featured variant for January, 2025.


[ 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 ]

Comments by Larry Gilbert

Earlier Reverse Order Later
Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
Larry Gilbert wrote on Wed, Sep 17, 2008 10:15 PM UTC:
Under 'User Defined Functions,' I believe the argument placeholders really are numbered starting at #0 now, contrary to the present instructions.

Larry Gilbert wrote on Fri, Sep 19, 2008 08:30 PM UTC:
I haven't been able to reproduce this 100% yet, but it seems that using cond within a function defined with def causes invalid results in all cases, not just in cases where the function is recursive.

Larry Gilbert wrote on Sat, Sep 20, 2008 12:52 AM UTC:
Okay, now I'm really going crazy.

The doc says that the 'reverse' operator takes an array and returns a new array with the elements reversed. But whenever I try to use it, it's as if it doesn't even exist in the language. In other words, what I end up with on the stack is not a reversed array but the word 'reverse' and a copy of the array I'm trying to reverse!

Help?


Larry Gilbert wrote on Sun, Sep 21, 2008 11:00 PM UTC:

Hello Fergus,

I appreciate your help with this! I'll admit that the initial learning curve has been steep for me. It's been so long since I did anything with Polish notation that I'm basically starting over (but I'm learning to appreciate it again, too).

I will study your new example of the cond operator more closely. For right now, here is some code that I think will illustrate the problem I'm having with the reverse operator. And it may either be a bug or just my misunderstanding of how things should work.

set arrayvar ray a1 1 1;
set reversedarray reverse #arrayvar;
dump;
exit;

What I was expecting to see in the dump was reversedarray having the same contents as arrayvar, but in reversed order. Instead, I get this:

    [reversedarray] => Array
        (
            [0] => Array
                (
                    [0] => b2
                    [1] => c3
                    [2] => d4
                    [3] => e5
                    [4] => f6
                    [5] => g7
                    [6] => h8
                )

            [1] => reverse
        )

Larry Gilbert wrote on Mon, Sep 22, 2008 01:53 AM UTC:
Very good; thank you!

Larry Gilbert wrote on Mon, Sep 22, 2008 03:18 AM UTC:

I have another question, and I'm sorry if this is a trivial one.

I would like to use the shift command, but it doesn't seem to accept an array, and I need to be able to give it a list of coordinates from an array. Is there any operator that will empty an array and put all of its contents back onto the stack? In other words, is there something that does the inverse of array?


Larry Gilbert wrote on Tue, Sep 23, 2008 02:50 PM UTC:
Great, I will try it out. Thank you again!

Larry Gilbert wrote on Tue, Sep 23, 2008 09:55 PM UTC:

I hope I am not being a pain yet... Unfortunately, I still can't get things to work the way we expect. I think the point of failure is with the list operator (or how I'm using it). This snippet should reproduce the problem. It ends with strcoords being empty--not an empty array, just nothing.

set arraycoords ray 0 1;
set strcoords list var arraycoords;
dump;
shift #strcoords;

Larry Gilbert wrote on Sat, Sep 27, 2008 11:19 PM UTC:
Fergus, thanks again for all of your help. The list operator looks like it's working, and so GAME Code looks like it's all working as documented now.

It still doesn't look like shift will take an array or a 'list'-ed string, but please don't worry about changing that urgently. I've had enough time to think about what I wanted to use shift for, and I think I can do it with a custom, recursive subroutine instead. If you think it needs 'fixing,' go ahead and fix it, but there is no need to do so on my account.

Thanks again for Game Courier. I haven't seen anything quite like it anywhere else on the Web.


9 comments displayed

Earlier Reverse Order Later

Permalink to the exact comments currently displayed.