Vages / svelte-snake-workshop

A workshop that teaches Svelte and SvelteKit through making the classic game Snake
https://svelte-snake-workshop.vercel.app
MIT License
13 stars 12 forks source link

Make headDirectionQueue a part of the regular tasks #5

Closed Vages closed 2 years ago

Vages commented 2 years ago

8e20ea94bd64064427d166ccca2165111f614090 introduced the variable headDirectionQueue to src/App.svelte, making it simpler for the user to perform sharp turns. This is a usability improvement, but I'm not sure if it should be part of the regular tasks or some later task.

If it is to be introduced at some pre-existing point, it either has to be introduced at task 2.2 or at task 3.5. Otherwise, we could either make a completely new task for this or leave it out altogether.

My hunch is that introducing it at 2.2 will feel premature to most workshop participants. The task currently instructs the user to disregard the possibility of the snake eating itself, and I think that it's smart to introduce as little as possible to the user at once. Task 3.5 is in my opinion a good stepping stone to understanding the need for queuing itself. This makes me think that adding a new task, for example 3.6, is the best solution.

Vages commented 2 years ago

Note that in ab4a7475138446533355a34c064fe960934dc369, I rewrote some functions, making the logic simpler and better suited as a stepping stone.

Currently, my plan is to simplify 3.5, so that the participants are instructed to disregard inputs that are the same as the current head direction. 3.6 will be about the fact that users will sometimes press two keys in sequence so quick that the snake is still able to eat itself, because the head is pointing in another direction.

The goal of 3.6 will consequently be to make the queue and the turn logic.

Vages commented 2 years ago

Done.