mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:17:46 +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:
parent
e24e486714
commit
b41e95b578
3 changed files with 43 additions and 20 deletions
|
@ -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; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue