Random crash bug

BlitzMax Forums/BlitzMax Beginners Area/Random crash bug

Xerra(Posted 2014) [#1]
Happy new year, guys. Here's one for all you clever types that might be able to find what I'm doing wrong. Hangovers permitting, of course :)

I've recently started programming with Bmax again after a long time out so I've been familiarising myself with some pretty simple programs to get back into the swing of it again. Because I fancy making a maze game remake from something I played on my Vic20 as a kid, I decided to try and convert a simple game called Hunt the Wumpus to get a handle on arrays and the like.

It's a bit hacked together as I've not put anything into types or methods, because I'm still a bit iffy with using them as yet but you can get the general idea of what I'm doing as it does work with what I've written so far.

Hunt the wumpus is a simple web game Click here!

And you can read about it Click here!

My problem is reseting the board in-game which usually causes it to crash after a random amount of resets with no error message, and involves the task manager to force it to close out so I can edit again. If I don't reset the board then I can move around just fine but I've not put in any feedback for hitting a hazzard or finishing the game as yet.

Question being: Why? Here's the code to see for yourself. Appologies if i've made a mess of the forum codes putting this in...




jsp(Posted 2014) [#2]
Hi Xerra,
you don't initialize your GridArray again when entering your init() function during the reset!


Xerra(Posted 2014) [#3]
Sorry, Jens, you lost me there. How do you mean reinitialise it? I thought it was defined as a 5*5 grid and that's it. I don't see how this would crash it?


Xerra(Posted 2014) [#4]
Oh, hang fire. I get it now.

You mean i had the whole grid set to have stuff in it so that when I was looping through trying to find a blank square it would be an endless trap. Bingo!

Thanks, mate.


Xerra(Posted 2014) [#5]
I pretty much went as far with this as I wanted to go to learn some new stuff so I'm posting the complete source code here in case anyone else can make use of it. If you think I've done something incorrectly, or could have improved on it, then I'd love some advice as I'm just getting to grips with stuff like methods/functions/types so probably could learn a lot.




AdamStrange(Posted 2014) [#6]
I'd heard about the Wumpus, but never actually hunted one. And now I have. Great work.

To make work on a mac, just remove the d3d framework reference :)


Xerra(Posted 2014) [#7]
Wow! My first game - sort of - and somebody has already ported it to a Mac. Let's get it on Steam, eh? :)