MCPcopy Create free account
hub / github.com/codemistic/Web-Development / onSnake

Function onSnake

Snake Game /snake.js:33–38  ·  view source on GitHub ↗
(position, { ignoreHead = false } = {})

Source from the content-addressed store, hash-verified

31}
32
33export function onSnake(position, { ignoreHead = false } = {}) {
34 return snakeBody.some((segment, index) => {
35 if (ignoreHead && index === 0) return false
36 return equalPositions(segment, position)
37 })
38}
39
40export function getSnakeHead() {
41 return snakeBody[0]

Callers 3

updateFunction · 0.90
getRandomFoodPositionFunction · 0.90
snakeIntersectionFunction · 0.85

Calls 1

equalPositionsFunction · 0.85

Tested by

no test coverage detected