Kevin Vance - ZZTers, help please!

Entries | Archive | Friends | Friends' Friends | User Info

01:52 am

ZZTers, help please!

Wednesday, January 30th, 2002
Previous Entry Share Next Entry
I think it works. My town.zzt scrambler has swapped two random boards 10,000 times to create shuffle.zzt which has shuffled boards that look to be linked correctly. I would like someone to play this game through from beginning to end, and make sure that it works. DON'T CHEAT! The point is to make sure that all the gameplay is preserved. I mean, ammo and heath cheating is okay, but play everything through in the correct order and visit all the boards. The goal is to make sure that libzzt2 has preserved the boards' content while changing their position in the file. And hey, it might be fun to play town over again :)

More technical details, for those really interested, but mostly for me to come back to later:

The heart of zztWorldMoveBoard() is determining what boards link to the board that is being moved, and then to change those links after the board is moved. Everything else is pretty much taken care of by zztWorldInsertBoard(), zztWorldDeleteBoard(), etc.

The function first goes through each board and checks for a link to the board-to-be-moved. Then it makes a record of what board to set this link to after the move has been made. The (flawed) statement I used was this:

board = (i > src && i < dest) ? i-1 : i;

board is the number of the board that will get set to the new position of the board-to-be-moved after it is moved. This worked for moving boards to higher places, but not lower.

Last night, I realized that I should be checking if it's (i > (lower number) && i < (higher number)). This didn't work either, because it was still setting it to i-1.

Finally, with the code that sets high and low to the higher/lower board between src and dest, I added a line to have it subtract 1 if it's moving up the list, or add one if it's moving down the list. This got called coefficient for some reason.

The final result looks like this:

board = (i >= low && i <= high) ? i+coefficient : i;
Link )Reply )

Comments
[User Picture]From: suppafly
2002-01-29 11:51 pm (UTC)
now write a program to play the games automatically to ensure that they work too heh..
(Reply) (Thread)
[User Picture]From: bitman
2002-02-01 12:13 am (UTC)
Well that's what you get for using ?: conditionals. Haven't your CS teachers warned you about abreviated code? And where in the world did the term coefficient come from? Delta or direction seems more appropriate since you are not multiplying. *shrugs* Oh well.
(Reply) (Thread)
[User Picture]From: kvance
2002-02-01 04:31 am (UTC)
Heh, no. My favorite CS professor encouraged them! :) And I think coefficient came purely from tiredness. The code is in CVS, if I forgot to mention.
(Reply) (Parent) (Thread)