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

Function getRandomFoodPosition

Snake Game /food.js:22–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22function getRandomFoodPosition() {
23 let newFoodPosition
24 while (newFoodPosition == null || onSnake(newFoodPosition)) {
25 newFoodPosition = randomGridPosition()
26 }
27 return newFoodPosition
28}

Callers 2

food.jsFile · 0.85
updateFunction · 0.85

Calls 2

onSnakeFunction · 0.90
randomGridPositionFunction · 0.90

Tested by

no test coverage detected