This one could go on for a bit, so I’ll try to be short and set out things into sections.
Bugs and Fixes
So there’s been a lot of problem with bugs near the end of the programming assignment. When I first started out there was next to nothing in the way of bugs. But now it seems as I stitch the final part of the canvas, other parts are beginning to rip. My main script is programmed chronologically, so now I work at the bottom of the page, it feels like I’m working in the basement of a large building where all the little things make the building tick, strange analogy but it’s what it feels like.
What I always find, as a programmer of sorts, is that the smallest most insignificant parts of programming cause the most damage and hassle, why? Because they have to assert themselves somehow! If they’re not noticed in the final outcome then to make things equal they’re a pain in the backside behind the scenes! That’s my theory on it anyway. I’m sure I’m not the only crazy guy thinking this.
I think I’ve spent more time overall on this assignment debugging it, than actually doing some proper coding. It’s a bit annoying at times as I feel like I’m not getting anywhere, then suddenly out of nowhere I’ll manage to fully fix the problem and feel slightly better about it! Here’s a couple of the main bugs which are currently killing my will to live.
Problem Number 1
First and foremost, there is a major problem with my puzzle coding, I’ve designed it so that there are no hard-coded parts to the script, it’s all database driven. And by doing this means I only have to add new entries to the puzzle table for it to appear in the game. Dynamicity at its’ purest. Anyway at the moment I can only seem to add a maximum of two items to the puzzle, by items I mean items required to complete the puzzle. The reason is most likely to do with whitespace or something that’s going terribly wrong inside my insane two tier foreach loop:
foreach ($items_required as $item_required) {
if (in_array($item_required,$inv)) {
foreach ($objects as $object) {
if ($count == 1) {$object = str_replace(" ","",$object);}
if (in_array($object,$items_required)) { $i = $i + 1;}
}}}
Ok so for people not php orientated, or not code orientated in general. Here’s what this little beast does.
Continue reading →