Thursday, March 6, 2014

Undo / Redo

Over the last week or so I have been working on the data structure that represents the grid in our game. It is a three dimensional array. The first two dimensions represent x and y on the grid, and the last dimension is there because there could be up to four instructions in each square of the grid. I wrote functions that allow instructions to be inserted, deleted, copied, and moved. This may sound trivial, but because of the way Javascript handles arrays it required a little more thought than it would in a language with a conventional array system. I also created two stacks that keep track of the changes the user makes, and allow for undo and redo operations.

We are starting to tie different pieces of our program together, and I think we are close to having some visual and perhaps interactive results. This is really exciting, because much of what we have done so far has been rather abstract. It will be cool to be able to actually see our code do something.

No comments:

Post a Comment