Add food

Bug #628180 reported by Josh Brown
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snakes
Fix Released
High
Tom Bell

Bug Description

Currently there is no food for the snake to grow. Food needs to be added to the board at random.

Tags: feature

Related branches

Josh Brown (joshbrown)
Changed in snakes-game:
importance: Undecided → High
status: New → Triaged
milestone: none → 1.0
Revision history for this message
Tom Bell (bushbaby2511) wrote :

Randomised food drops added. The food appears elsewhere when the snakes head moves over it

Revision history for this message
Josh Brown (joshbrown) wrote :

An interesting way of doing things - having each piece of food as a perpetually moving object. I probably would have done things a different way, but it'll do fine for now. Thanks!

Changed in snakes-game:
assignee: nobody → Tom Bell (bushbaby2511)
status: Triaged → Fix Committed
Revision history for this message
Josh Brown (joshbrown) wrote :
Changed in snakes-game:
status: Fix Committed → Fix Released
Revision history for this message
Tom Bell (bushbaby2511) wrote :

Fair enough, as far as I was aware the classic snakes had randomised food drops but this can always be changed. No problem.

Revision history for this message
Josh Brown (joshbrown) wrote :

Tom, what I meant was that a piece of food moving about of it's own accord after it's been eaten seems illogical to me, so I'd delete the piece of food, then create a new piece in a random location.

Your code, in itself, works fine, it's just the object-orientated illogicalness that I object to. But then again, I'm no programming expert so maybe OOP is supposed to be done your way.

Revision history for this message
Tom Bell (bushbaby2511) wrote :

Ah apologies, I misinterpreted, you're quite right. thanks for the edit.

Revision history for this message
Tom Bell (bushbaby2511) wrote :

Here's the more logical object-orienteered approach

Revision history for this message
Josh Brown (joshbrown) wrote :

Thanks for the patch Tom, we may as well remove the `update` function altogether.

Josh Brown (joshbrown)
tags: added: feature
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.