Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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)

+3
−0

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.

Dodecahedron

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.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

3 comment threads

Hardcoding (1 comment)
That animated picture is seriously annoying and distracting! (3 comments)
Resource suggestion (1 comment)
That animated picture is seriously annoying and distracting!
Olin Lathrop‭ wrote almost 3 years ago

That animated picture is seriously annoying and distracting!

Razetime‭ wrote almost 3 years ago

I've changed it to a static picture.

Olin Lathrop‭ wrote almost 3 years ago

Much better. +1 now.