Linux Format

How to solve mazes using Go and maths

This month, we’re going delve into solving maze and dungeon puzzles with the help of graph theory (well, we are all in isolation–Ed). The purpose of such puzzles is to determine whether there’s a path that connects two places and find that path, keeping in mind that not all maze puzzles are solvable!

A maze is a path or a collection of paths. When we say that we want to solve a maze, we mean that we should find a way of going from the start cell (entrance), which is predefined, to the end cell (goal), which is also predefined. A similar way of thinking about solving a maze is routing through obstacles of various types from your current place to a given location. A maze might have multiple solutions, too.

To solve a maze, you just have to find a trail between the start and end points of the maze. Note that mazes can be implemented using undirected graphs and that if a maze contains isolated nodes or too many wall cells then it might not be solvable.

The way you represent a maze has nothing to do with the maze itself – it’s just a practical way of

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format2 min read
Reports And Summaries
TimeWarrior has a couple of report modes. The summary command option outputs a summary of total time taken on different tasks. There are quite a few options that can be applied to this, such as limiting the summary to a period or filtering by tag. It
Linux Format2 min read
OBS Studio
Version: 30.0.2 Web: https://obsproject.com There are lots of good options for recording screencasts, but if you want to live-stream T your desktop, one of the best options is OBS Studio. The app works with all the major online streaming providers, s
Linux Format3 min read
AMD Ryzen 5 8600G
Socket: AM5 Arch: Zen 4 (Phoenix) Process: TSMC 4nm FinFET Cores: 6 Threads: 12 Cache: 384KB L1, 6MB L2, 16MB L3 Speed: 4.3GHz (5.0GHz boost) Unlocked: Yes GPU: Radeon 760M GPU clock: 2.8GHz Compute: 8 units AI: Ryzen AI, 16 TOPS Display: Up to 4, DP

Related