10-print-maze
v1.0.2
Published
A simple 10 PRINT maze generator. / 一個簡單的 10 PRINT 迷宮生成器。
Downloads
30
Maintainers
Readme
10-print-maze
10 PRINT 迷宮生成器 / 10 PRINT Maze Generator
一個簡單的 10 PRINT 迷宮生成器,使用 TypeScript 實作。 A simple 10 PRINT maze generator implemented in TypeScript.
安裝 / Install
yarn add 10-print-maze
yarn-tool add 10-print-maze
pnpm add 10-print-maze
npm install 10-print-maze使用方法 / Usage
TypeScript / ES Module
import { mazeGenerator } from '10-print-maze';
// 生成一個無限的迷宮生成器,每行 10 個字符
// Create an infinite maze generator with 10 characters per line
const generator = mazeGenerator(10);
// 生成 10 行迷宮
// Generate 10 lines of maze
for (let i = 0; i < 10; i++) {
const row = generator.next().value;
console.log(row.join(''));
}CommonJS
const { mazeGenerator } = require('10-print-maze');
const generator = mazeGenerator(20);
console.log(generator.next().value.join(''));關於 / About
本專案基於經典的 Commodore 64 BASIC 單行程式: This project is based on the classic Commodore 64 BASIC one-liner:
10 PRINT CHR$(205.5 + RND(1)); : GOTO 10它會隨機列印 ╱ (U+2571) 或 ╲ (U+2572) 來組成迷宮般的圖案。
It randomly prints ╱ (U+2571) or ╲ (U+2572) to form a maze-like pattern.
