From c5bd51d96bb215cc8988309b6b8f63e88da5ae71 Mon Sep 17 00:00:00 2001 From: Andre Padez Date: Thu, 30 Oct 2025 22:48:42 +0000 Subject: [PATCH] test: increase initial snake size to 6 for easier testing - Change initial snake length from 3 to 6 segments - Makes it easier to test turning mechanics and buffering - Better visibility of snake movement patterns - Can be reverted once testing is complete --- src/useCursor/useCursor.ts | 21 ++++++++++++--------- src/useGame/useSnake.ts | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/useCursor/useCursor.ts b/src/useCursor/useCursor.ts index d18648a..c3ae358 100755 --- a/src/useCursor/useCursor.ts +++ b/src/useCursor/useCursor.ts @@ -15,15 +15,18 @@ export function useCursor( const lastMovedDirectionRef = useRef("up"); const nextDirectionRef = useRef(null); - const initSnake = () => { - const centerR = Math.floor(rows / 2); - const centerC = Math.floor(cols / 2); - - const initialBody: SnakeBody = [ - { r: centerR, c: centerC }, - { r: centerR + 1, c: centerC }, - { r: centerR + 2, c: centerC }, - ]; + const initSnake = () => { + const centerR = Math.floor(rows / 2); + const centerC = Math.floor(cols / 2); + + const initialBody: SnakeBody = [ + { r: centerR, c: centerC }, + { r: centerR + 1, c: centerC }, + { r: centerR + 2, c: centerC }, + { r: centerR + 3, c: centerC }, + { r: centerR + 4, c: centerC }, + { r: centerR + 5, c: centerC }, + ]; setSnakeBody(initialBody); snakeBodyRef.current = initialBody; diff --git a/src/useGame/useSnake.ts b/src/useGame/useSnake.ts index 4264a4c..76d9b46 100755 --- a/src/useGame/useSnake.ts +++ b/src/useGame/useSnake.ts @@ -15,14 +15,17 @@ export function useSnake( const lastMovedDirectionRef = useRef("up"); const initSnake = () => { - const centerR = Math.floor(rows / 2); - const centerC = Math.floor(cols / 2); - - const initialBody: SnakeBody = [ - { r: centerR, c: centerC }, - { r: centerR + 1, c: centerC }, - { r: centerR + 2, c: centerC }, - ]; + const centerR = Math.floor(rows / 2); + const centerC = Math.floor(cols / 2); + + const initialBody: SnakeBody = [ + { r: centerR, c: centerC }, + { r: centerR + 1, c: centerC }, + { r: centerR + 2, c: centerC }, + { r: centerR + 3, c: centerC }, + { r: centerR + 4, c: centerC }, + { r: centerR + 5, c: centerC }, + ]; setSnakeBody(initialBody); snakeBodyRef.current = initialBody;