Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
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
22
function
getRandomFoodPosition() {
23
let
newFoodPosition
24
while
(newFoodPosition == null || onSnake(newFoodPosition)) {
25
newFoodPosition = randomGridPosition()
26
}
27
return
newFoodPosition
28
}
Callers
2
food.js
File · 0.85
update
Function · 0.85
Calls
2
onSnake
Function · 0.90
randomGridPosition
Function · 0.90
Tested by
no test coverage detected