195k views
5 votes
The cave system is a dodecahedron. Each room connects to three others in a predetermined pattern. Compose a function make_cave which accepts no arguments and returns a dictionary mapping each room to a list of adjacent rooms. All values should be int s.

1 Answer

1 vote

Answer:

see explaination

Step-by-step explanation:

The program code.

def make_cave():

cave = {}

cave[1] = [2, 10, 11]

cave[2] = [1, 3, 12]

cave[3] = [2, 4, 13]

cave[4] = [3, 5, 14]

cave[5] = [4, 6, 15]

cave[6] = [5, 7, 16]

cave[7] = [6, 8, 17]

cave[8] = [7, 9, 18]

cave[9] = [8, 10, 19]

cave[10] = [1, 9, 20]

cave[11] = [1, 13, 19]

cave[12] = [2, 14, 20]

cave[13] = [3, 11, 15]

cave[14] = [4, 12, 16]

cave[15] = [5, 13, 17]

cave[16] = [6, 14, 18]

cave[17] = [7, 15, 19]

cave[18] = [8, 16, 20]

cave[19] = [9, 11, 17]

cave[20] = [10, 12, 18]

return cave

cave= make_cave()

print(sorted(cave[5]))

print(sorted(cave[12]))

print(sorted(cave[19]))

Refer to attachment for the screenshot.

The cave system is a dodecahedron. Each room connects to three others in a predetermined-example-1
User Pattapong J
by
6.9k points