1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:17:35 +00:00

Snake: Use a queue for the movement inputs.

This makes it a lot less finicky to make rapid moves like staircasing and
sudden turns.
This commit is contained in:
Andreas Kling 2019-04-20 03:44:01 +02:00
parent e24e486714
commit b41e95b578
3 changed files with 43 additions and 20 deletions

View file

@ -39,6 +39,9 @@ public:
const T& at(int index) const { return m_elements[(m_head + index) % Capacity]; }
const T& first() const { return at(0); }
const T& last() const { return at(size() - 1); }
class ConstIterator {
public:
bool operator!=(const ConstIterator& other) { return m_index != other.m_index; }