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
This commit is contained in:
@@ -15,15 +15,18 @@ export function useCursor(
|
||||
const lastMovedDirectionRef = useRef<Direction>("up");
|
||||
const nextDirectionRef = useRef<Direction | null>(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;
|
||||
|
||||
+11
-8
@@ -15,14 +15,17 @@ export function useSnake(
|
||||
const lastMovedDirectionRef = useRef<Direction>("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;
|
||||
|
||||
Reference in New Issue
Block a user