[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Performance problem with 0-based arrays
- From: Norman Ramsey <nr@...>
- Date: Tue, 24 Nov 2020 10:45:57 -0500
> > Not only does the 0 case run as fast as the 1 case, but it runs a bit
> > faster overall as there's only two loops doing work, not three.
> >
>
> Because you are only seeing it as it runs on the initial startup, beginning
> with an empty table. Egor stated that, "It clears the cells which may
> contain "black" or "white" pieces from the previous game." In other words,
> this function will be run after *every* game, and after a game has been
> played, pieces may be in random positions, and the middle of the board
> needs to be explicitly set to nil to remove those pieces.
Perhaps not germane to the discussion, but why wouldn't you simply
allocate a fresh table? Then there is only one code to get right:
the creation of a fresh game state. Why try to reuse an old one?
Norman