Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not sure what's going on here
#1
My alien breeder program seems to lock up, on pass two through the data - on fight 27, too.

Not sure if this is a compiler error, or my messing up - though adding one to a dimensioned variable (the line it seems to stop on) shouldn't be too stressful.

Locks up on this bit:
Code:
print at 21,16;2
        alienRankings(i+1,SCORE)=alienRankings(i+1,SCORE)+1
    END IF
    print at 21,17,"+"

It prints the 2, and doesn't print the "+".

What I don't understand is why it locks up on the 3rd loop round? There's nothing different there, which is why I suspect there's a compiler error.


Attached Files
.zip   AlienBreeder.zip (Size: 24.42 KB / Downloads: 310)
Reply
#2
I've been *TERA*busy these last days, sorry for the delay (it's been exhausting).
I've fixed another *nasty* bug (see this thread) that might be related to this one.
Please, could you check it and see if the program still crashes??

Update: It still crashed to me. :oops: Anyway, can you check if you see something different this time?
Still debugging...
Update II: apparently the problem lies within the fightAliens function. Removing these function (e.g. returning always 1), makes the program to work again.
Will investigate it further...
Reply
#3
Update III: After some more investigation, it seems it's a bug in your code.
The While condition:
Code:
while tempAlienStatBlocks(0,DHP) > 0 AND tempAlienStatBlocks(1,DHP) > 0
is always true for some reason. Printing these values within the loop shows they're 60 and 70 respectively. :?:
Reply
#4
boriel Wrote:Update III: After some more investigation, it seems it's a bug in your code.
The While condition:
Code:
while tempAlienStatBlocks(0,DHP) > 0 AND tempAlienStatBlocks(1,DHP) > 0
is always true for some reason. Printing these values within the loop shows they're 60 and 70 respectively. :?:

Aha!

Sorry. That was completely my cockup in debugging. Despite thinking I'd checked for a case of attack strength=0 it was coming through with one anyway - as a result, each alien was having their hit points reduced by 0 each round. And so neither was winning!


Kludged with: IF attackStrength=0 THEN attackStrength=1 : END IF

And it doesn't get stuck.

Edit: better yet, check for >= in the initial check, not > only! doh!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)