maze_magic 0.2.1 → 0.2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -8
- data/lib/maze_magic/renderer/console_renderer.rb +1 -0
- data/lib/maze_magic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb317cd3c86320f1a7623933c05e7cd48cc8f48a
|
4
|
+
data.tar.gz: 85c9ca375dddded5129e4ac13dc3746bae3e7479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f789ce926446fc33b2b46362e00b4133c5bedb36c870c8810786b5388c8bfdffe36cab0caf6b9f5e211fe6c7a17a38d60524fe1c9fe8cdf789988caba8dbed8c
|
7
|
+
data.tar.gz: 14e2800aaf2ae2c9a0d431bdfde5b845e30e06ee2f01a5cebf521966d99e93b88a6ec6e09f9e87506d8e7187f5cab0647718213c472b784ba2dbe349f5ec62a2
|
data/README.md
CHANGED
@@ -5,6 +5,20 @@
|
|
5
5
|
|
6
6
|
Ruby Maze generating gem.
|
7
7
|
|
8
|
+
```
|
9
|
+
_______________________________________________________________________________________________________________________
|
10
|
+
| | | _________ _____ |___ | _ | _____ | ___ |___ ___ | _ | ___ | |___ _| ___________ | |
|
11
|
+
| | | | _ | |_| |_ |___ | _| _| | | ___| | | |_ | _| | _| |_ |_ | | | |___ |_____| _ | _ | | |_| |
|
12
|
+
| |_____|_ | |_ | |_|___ | |_| | _| | _____| _| |_____| | _| | | ___|_____| ___| _ | | |___| | | |_ | |
|
13
|
+
|_______ |_| | _| | | _ | | | _|_| | _|_ |___ | | _ | | | | | |_| ___ | |___ | | | |___ | | | | _| |
|
14
|
+
|_ | ___| _| |___| | | | | | | | ___| | _|___ | | |_|_ | | | | |___|_ _____| | _____| | |_ | | |_| | | |___ |
|
15
|
+
| | | _ |_________| |___ | | _____| | | ___| |_______| | | |___| |_ | ___|_ | _ | | _|_______| | _| |
|
16
|
+
| | | |_ |_ | | _| _ |_| |___| ___| | | | ___|_ | ___| |_______|_ |_| | | ___|___| | _| _________| |_____|
|
17
|
+
| | |_ |___| |___| | ___|_ |_______| _| |___|___ ___| | | | _______| _| |_ | _____|_ | | | ___| | | |
|
18
|
+
| |___| | | | ___| | | _______| _ | _| | |_| ___| | | | |_ |_ |_ | _| |_ | | |___| _| | ___|___| |
|
19
|
+
|_________|___|_________|_____________|_______|___|_____|_____|___|_________|_____|_________|___|_________|_____________|
|
20
|
+
```
|
21
|
+
|
8
22
|
## Installation
|
9
23
|
|
10
24
|
Add this line to your application's Gemfile:
|
@@ -24,13 +38,6 @@ And then execute:
|
|
24
38
|
```ruby
|
25
39
|
require 'maze_magic'
|
26
40
|
|
27
|
-
def generate_maze
|
28
|
-
MazeMagic::Generate
|
29
|
-
.new(height: 5, width: 5)
|
30
|
-
.tap { |g| g.generate_maze }
|
31
|
-
.maze
|
32
|
-
end
|
33
|
-
|
34
41
|
# maze is a 2 dimensional array of these singleton objects:
|
35
42
|
#
|
36
43
|
# MazeMagic::Edge.instance # ' '
|
@@ -42,8 +49,14 @@ end
|
|
42
49
|
#
|
43
50
|
# [[Edge, HW, HW, HW, HW, Edge],[VW, P, P,VW,P,P,P, HW],...]
|
44
51
|
#
|
45
|
-
|
52
|
+
def generate_maze(height: 5, width: 5)
|
53
|
+
MazeMagic::Generate
|
54
|
+
.new(height: height, width: width)
|
55
|
+
.tap { |g| g.generate_maze }
|
56
|
+
.maze
|
57
|
+
end
|
46
58
|
|
59
|
+
maze = generate_maze
|
47
60
|
|
48
61
|
# optional: render in console
|
49
62
|
MazeMagic::Renderer::ConsoleRenderer.new(cells_grid: maze).call
|
data/lib/maze_magic/version.rb
CHANGED