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.

商品描述(中文翻譯)

解鎖創建隨機迷宮的秘密!無論你是遊戲開發者、算法愛好者,還是單純尋找新謎題的人,你都將提升自己的技能。學習各種形狀、大小和維度的隨機迷宮生成算法。將它們彎曲成莫比烏斯帶,折疊成立方體,並包裹在球體上。將它們拉伸到其他維度,壓縮成任意輪廓,並以令人眼花繚亂的方式進行拼貼。從十二個小算法中,你將發現一個龐大的創意和靈感庫。

從視頻遊戲到電影,迷宮無處不在。探索十二種隨機生成這些謎題的算法,從二元樹(Binary Tree)到艾勒算法(Eller's),每個算法都有豐富的插圖和在 Ruby 中的可運行實現。你將學習它們的優缺點,以及如何選擇適合工作的算法。

你將從學習六種迷宮算法開始,並從在紙上製作迷宮過渡到編寫生成和繪製迷宮的程序。你將接觸到 Dijkstra 算法,並了解它如何幫助解決、分析和可視化迷宮。第二部分將展示如何將你的迷宮限制為不同的形狀和輪廓,例如文本、圓形、六邊形和三角形網格等。你將學習剔除死胡同的技術,以及如何讓通道交錯穿過彼此。第三部分將介紹另外六種算法,將一切提升到新的層次。你將學習如何在多維空間中構建迷宮,甚至在曲面上構建迷宮。

在這一切中,你將發現自己充滿了創意,這是解決程序員瓶頸、倦怠和灰暗日子的最佳良藥。當你完成時,你將充滿活力,並擁有無限的迷宮相關可能性!

你需要的:

示例代碼需要 Ruby 編程語言的版本 2。一些示例依賴於 ChunkyPNG 庫來生成 PNG 圖像,還有一章使用 POV-Ray 版本 3.7 來渲染 3D 圖形。