September 2018
Beginner
360 pages
9h 28m
English
Make a grid that the rover can drive around on by implementing a MarsGrid type. You’ll need to use a mutex to make it safe for use by multiple goroutines at once. It should look something like the following:
// MarsGrid represents a grid of some of the surface // of Mars. It may be used concurrently by different // goroutines. type MarsGrid struct { // To be done. } // Occupy occupies a cell at the given point in the grid. It // returns nil if the point is already occupied or the point is // outside the grid. Otherwise it returns a value that can be // used to move to different places on the grid. func (g *MarsGrid) Occupy(p image.Point) *Occupier // Occupier represents an occupied ...Read now
Unlock full access