March 2019
Intermediate to advanced
336 pages
9h 9m
English
The AddLink method of the MapLayout class takes the places as parameters and links them together:
// Add Linkfunc (mapLayout *MapLayout) AddLink(place1 Place, place2 Place) { var exists bool if _, exists = mapLayout.GraphNodes[place1]; !exists { mapLayout.AddPlace(place1) } if _, exists = mapLayout.GraphNodes[place2]; !exists { mapLayout.AddPlace(place2) } if _, exists = mapLayout.Links[place1]; !exists { mapLayout.Links[place1] = make(map[Place]struct{}) } mapLayout.Links[place1][place2] = struct{}{}}
Read now
Unlock full access