Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Algorithmically generating the grid formed by the vertices of a dodecahedron (Hunt The Wumpus)
Post
Algorithmically generating the grid formed by the vertices of a dodecahedron (Hunt The Wumpus)
I am attempting to write a program to simulate Hunt The Wumpus in the K programming language. The game requires a grid that is created by the vertices of a Dodecahedron, which is cyclic and triangular in nature.
The general approach I can find on Rosetta Code is generally a hardcoded list of points, like as follows:
Adjacent_Rooms : constant Rooms :=
((1, 4, 7), (0, 2, 9), (1, 3, 11), (2, 3, 13), (0, 3, 5), (4, 6, 14),
(5, 7, 16), (0, 6, 8), (7, 9, 17), (1, 8, 10), (9, 11, 18), (2, 10, 12),
(11, 13, 19), (3, 12, 14), (5, 13, 15), (14, 16, 19), (5, 15, 17),
(8, 16, 18), (10, 17, 19), (12, 15, 18));
basically encoding the indices of the points that each point links to. I seek to find out a way to algorithmically generate these points (not necessarily using math), or somehow simulate the grid with an ordinary 1D or 2D array somehow.
Since K isn't a popular language, I would appreciate answers in a pseudocode format so I can translate the approach correctly.
3 comment threads