Mazes for Programmers: Code Your Own Twisty Little Passages (Paperback)

Jamis Buck

買這商品的人也買了...

相關主題

商品描述

Unlock the secrets to creating random mazes! Whether you're a game developer, an algorithm connoisseur, or simply in search of a new puzzle, you're about to level up. Learn algorithms to randomly generate mazes in a variety of shapes, sizes, and dimensions. Bend them into Moebius strips, fold them into cubes, and wrap them around spheres. Stretch them into other dimensions, squeeze them into arbitrary outlines, and tile them in a dizzying variety of ways. From twelve little algorithms, you'll discover a vast reservoir of ideas and inspiration.

From video games to movies, mazes are ubiquitous. Explore a dozen algorithms for generating these puzzles randomly, from Binary Tree to Eller's, each copiously illustrated and accompanied by working implementations in Ruby. You'll learn their pros and cons, and how to choose the right one for the job.

You'll start by learning six maze algorithms and transition from making mazes on paper to writing programs that generate and draw them. You'll be introduced to Dijkstra's algorithm and see how it can help solve, analyze, and visualize mazes. Part 2 shows you how to constrain your mazes to different shapes and outlines, such as text, circles, hex and triangle grids, and more. You'll learn techniques for culling dead-ends, and for making your passages weave over and under each other. Part 3 looks at six more algorithms, taking it all to the next level. You'll learn how to build your mazes in multiple dimensions, and even on curved surfaces.

Through it all, you'll discover yourself brimming with ideas, the best medicine for programmer's block, burn-out, and the grayest of days. By the time you're done, you'll be energized and full of maze-related possibilities!

What You Need:

The example code requires version 2 of the Ruby programming language. Some examples depend on the ChunkyPNG library to generate PNG images, and one chapter uses POV-Ray version 3.7 to render 3D graphics.

商品描述(中文翻譯)

解鎖創建隨機迷宮的秘密!無論您是遊戲開發者、演算法專家,還是只是在尋找新的謎題,您即將升級。學習使用各種形狀、大小和維度的演算法來隨機生成迷宮。將它們彎曲成莫比烏斯帶,折疊成立方體,並將它們包裹在球體周圍。將它們拉伸到其他維度,擠壓到任意輪廓中,並以令人眼花繚亂的方式鋪設。從這十二個小演算法中,您將發現無窮的想法和靈感。

從電子遊戲到電影,迷宮無所不在。探索一打用於隨機生成這些謎題的演算法,從二元樹到Eller's,每個演算法都有豐富的插圖,並附有Ruby的實作。您將了解它們的優缺點,以及如何選擇適合的演算法。

您將從學習六個迷宮演算法開始,從紙上繪製迷宮到編寫生成並繪製迷宮的程式。您將介紹Dijkstra's演算法,並了解它如何幫助解決、分析和視覺化迷宮。第二部分將向您展示如何將迷宮限制在不同的形狀和輪廓中,例如文字、圓形、六邊形和三角形網格等。您將學習修剪死路的技巧,以及使通道交織在一起的方法。第三部分將介紹另外六個演算法,將一切提升到更高的水平。您將學習如何在多個維度上建立迷宮,甚至在彎曲的表面上建立迷宮。

在這一切過程中,您將發現自己充滿了想法,這是對程序員的封鎖、倦怠和最灰暗的日子最好的良藥。完成時,您將充滿活力,充滿與迷宮相關的可能性!

所需材料:
示例代碼需要Ruby程式語言的2版本。一些示例依賴ChunkyPNG庫來生成PNG圖像,其中一章使用POV-Ray 3.7版本來渲染3D圖形。