</>OfferRetriever
DashboardDiscuss
NEW

Spring Hire Sale

Limited Time Deal: Unlock all premium questions for over 30% off

$10.42$7.08

08

:

03

:

13

:

48

Get this deal
Back to Dashboard

Worm Game

Medium

Question

Design a WormGame class that simulates a worm moving on a 2D grid. The worm starts at the top-left corner (0, 0) with length 1. It grows by 1 unit every 4 moves. The game ends (returning -1) if the worm goes out of bounds or collides with itself. ...