Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Snakes shouldn't spawn on top of other snakes. #12

Open
46bit opened this issue Nov 14, 2016 · 1 comment
Open

Snakes shouldn't spawn on top of other snakes. #12

46bit opened this issue Nov 14, 2016 · 1 comment

Comments

@46bit
Copy link
Member

46bit commented Nov 14, 2016

At present snakes are spawned as a single segment in a randomly chosen cell. This is unfortunate because it means snakes will sometimes spawn on top of other snakes.

A naive solution is:

(1) Generate a random cell C
(2) Loop over all snakes, checking if they have C as a segment, and going back to (1) if so

This will loop infinitely if all cells are occupied. That will not always be possible under the rules, unless spawning into an existing game.

Come up with a decent solution for now.

@46bit
Copy link
Member Author

46bit commented Nov 14, 2016

Also - should snakes be allowed to spawn on top of food?

@46bit 46bit modified the milestone: Coming together. Jan 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant