Debugging Challenges

@Galador would it help if I went through all the code and added comments every few lines telling you what each section is doing? It’s a habit I should really try and get into.

@cjw Yes please. I didn’t understand it well either and I’d absolutely no idea what @dfabulich 's code was doing other than hurting my brain. :slight_smile:

@dfabulich when coding a Fibonacci sequence (1,1,2,3,5,8,13 etc.) would it not be easier to just use 3 variables (e.g. fib1 fib2 and fib3) and then have 1 and 2 add up to set a new value for 3, 2 and 3 add up to do set a new value for 1 and then 3 and 1 add up to set a new value for 2, with the sequence repeating until a certain number is reached? Sorry if I haven’t explained this very well, but I’m in a bit of a rush and so haven’t got time to code it all out as I would do normally!

@Galador @FairyGodfeather
Here you go http://pastebin.com/RXkzgAgP :slight_smile:

I heavily use *elseif – not sure why coders don’t use it. Stringing together text is easier and making lots of checks in sequence is best with elseif.

*if dex > 19
*elseif dex > 14
*else

would have to be written as
*if (dex > 19)
*if (dex > 14) and (dex < 20)
*if (dex < 15)

Well, I had a migraine all of yesterday and was in no state to try to figure this out, but here it goes… If I ever do figure it out, even with the hints and stuff that CJW added, it probably won’t be for like another week!

@Galador I look forward to seeing what improvements you can make! :slight_smile:

@JimD

actually its possible to code that like this.


The zombie staggers towards you. Frantically looking for a weapon all you find is one of those stupid singing "Billy Bass" toys. You pull it off the wall and throw it at the zombie.

*if (dex >19)
  The plastic fish smacks off the zombie's head and it drops to the floor. 
  *goto flee

*if (dex >14)
  The plastic fish hits the zombie's chest and it staggers back. 
  *goto flee

*if (dex <15)
  The plastic fish smashes harmlessly on the wall behind the zombie. 
  *goto flee

*label flee
Cursing your luck you run out the room...

edit: not sure why the < br / > appears though?

@Nocturnal_Stillness true but then you have the Quicktest issue Dan mentioned. I got used to elseif, and I’d shoot myself without Quicktest and Randomtest :slight_smile:

I never used the tests because I could never understand them lol

@Nocturnal_Stillness, if you need help with testing, check this link. I just learned using the tests today and it is very easy and helpful