Spider Solitaire Bug Fix
August 20th, 2007
While playing one of my card games, spider solitaire, I discovered an error—which I think I’ve now honed in on. The problem came when clicking the “new cards” button, adding 10 cards to the tableau, or layout, of the game screen. Flash produced a null-pointer exception, which caused me to believe that one or more cards in the game had been somehow deleted while I was playing spider solitaire.
Well, I played a little more, and I discovered that cards placed previously into the tableau by clicking on the stack might be the source of this solitaire bug. After they’ve been added to other cascading cards in the layout, the previous cards in the cascade are grayed out—indicating that they are no longer “active.” The way this solitaire feature is represented in the card game’s code is by having a pointer to the card above, within the card class, to keep track of what the grayed out card (to activate it when the stacked cards above it are moved). When these “added” cards are dragged to an empty cell, they sometimes disappear or, as in the case below, are erroneously shifted to a different position. This seems to remove them from the card game array, causing an error when the “new cards” button is placed.
Stay tuned for more updates. I plan to get rid of this spider solitaire bug by the end of the day, and then get onto making further improvements to my card games
fixed by removing pointer card as parent from card pointing to it in clearParent() function. Logic previously used to clear pointer is now in the clearPointer() function, which I called by clearPointer(), since the two always appear in tandem.