forked from hhhrrrttt222111/PyBox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaze.html
More file actions
195 lines (146 loc) · 9.14 KB
/
Maze.html
File metadata and controls
195 lines (146 loc) · 9.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:title" content="PyBox - Python Games">
<meta property="og:type" content="website">
<meta property="og:description" content="Python Games to increase your skill and experience in Python">
<!-- <meta property="og:image" content="">
<meta property="og:url" content=""> -->
<meta name="twitter:title" content="PyBox - Python Games">
<meta name="twitter:site" content="@hhhrrrttt222111">
<meta name="twitter:creator" content="@hhhrrrttt222111">
<meta name="twitter:description" content="Python Games to increase your skill and experience in Python">
<link rel = "icon" href ="..\assets\icons\logo-png.png" type = "image/x-icon">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="games.css">
<title>PyBox - Maze</title>
</head>
<body>
<nav class="navbar static-top">
<div class="container">
<a class="navbar-brand" href="../index.html"><img src="..\assets\icons\logo-png.png" class="nav-logo" alt="PyBox"></a>
<button onclick="goBack()" class="btn btn-dark">Go Back</button>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-sm-4">
<h1 class="game-title">Maze</h1>
<p class="game-desc">The name is pretty much self explanatory. You have in front of you a confusing set of passages.
Find a way out of this and you win!</p>
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="fa fa-2x fa-github" href="https://github.com/hhhrrrttt222111/PyBox/blob/master/Games/Maze.py" target="_blank" rel="noopener noreferrer"></a>
<a href="https://github.com/hhhrrrttt222111/PyBox/stargazers" target="_blank" rel="noopener noreferrer" class="git-star"><img alt="GitHub stars" src="https://img.shields.io/github/stars/hhhrrrttt222111/PyBox?style=social"></a>
</li>
</ul>
<hr class="d-sm-none">
</div>
<div class="col-sm-8">
<div class="download">
<h4 class="dwnld">Download</h4>
<a class="btn" href="Text/Maze.txt" download><i class="fa fa-2x fa-file"></i></a>
<a class="btn" href="../Games/Maze.py" download><img src="../assets/icons/python-icon.png" alt="python-icon" class="python-icon"></i></a>
</div>
<!-- CODE -->
<pre class="code">
<span class="comment">
# This game is from the official documentation of freegames
# https://pypi.org/project/freegames/
# pip install freegames
# import modules </span>
<span class="in-built">import</span> turtle as t
<span class="in-built">from</span> <span class="function">random</span> <span class="in-built">import</span> <span class="function">random</span>
<span class="in-built">from</span> freegames <span class="in-built">import</span> <span class="function">line</span>
<span class="comment"># Set window title, color and icon</span>
t.<span class="function">title</span>("Maze")
<span class="variable">root</span> = t.<span class="function">Screen</span>()._root
<span class="variable">root</span>.<span class="function">iconbitmap</span>("logo-ico.ico")
t.<span class="function">bgcolor </span>('#b3ffe6')
<span class="comment">
# Functions
# Draw maze </span>
<span class="in-built">def</span> <span class="function">draw</span>():
t.<span class="function">color</span>('black')
t.<span class="function">width</span>(5)
<span class="in-built">for</span> x <span class="in-built">in </span><span class="function">range</span>(-200, 200, 40):
<span class="in-built">for</span> y <span class="in-built">in </span><span class="function">range</span>(-200, 200, 40):
<span class="in-built">if</span> <span class="function">random</span>() > 0.5:
<span class="function">line</span>(x, y, x + 40, y + 40)
<span class="in-built">else</span>:
<span class="function">line</span>(x, y + 40, x + 40, y)
t.<span class="function">update</span>()
<span class="comment"># Draw line and dot for screen tap</span>
<span class="in-built">def</span> <span class="function">tap</span>(x, y):
<span class="in-built">if</span> <span class="function">abs</span>(x) > 198 or <span class="function">abs</span>(y) > 198:
t.<span class="function">up</span>()
<span class="in-built">else</span>:
t.<span class="function">down</span>()
t.<span class="function">width</span>(2)
t.<span class="function">color</span>('red')
t.<span class="function">goto</span>(x, y)
t.<span class="function">dot</span>(4)
t.<span class="function">setup</span>(420, 420, 370, 0)
t.<span class="function">hideturtle</span>()
t.<span class="function">tracer</span>(False)
<span class="function">draw</span>()
t.<span class="function">onscreenclick</span>(tap)
t.<span class="function">done</span>()
</pre>
<!-- CODE -->
<br>
<div class="images">
<div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/Maze-1.PNG" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="img/Maze-2.PNG" class="d-block w-100" alt="...">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleFade" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleFade" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="buyme">
<a href="https://ko-fi.com/hhhrrrttt222111" target="_blank" rel="noopener noreferrer"><span class="buy">Buy Me A Coffee</span><img src="../assets/icons/kofi.png" alt="ko-fi" class="coffee"></a>
</div>
</div>
</div>
</div>
<div class="footer">
<p class="footer-heart">
Made with <g-emoji class="g-emoji" alias="heart" fallback-src="https://raw.githubusercontent.com/hhhrrrttt222111/etudia/master/assets/necro.png?token=AKLVDPY75U5YNHZ7PRA4Y4K6TRB2I">
<img class="emoji" alt="heart" height="20" width="20" src="https://raw.githubusercontent.com/hhhrrrttt222111/etudia/master/assets/necro.png?token=AKLVDPY75U5YNHZ7PRA4Y4K6TRB2I">
</g-emoji> by <a href="http://hhhrrrttt222111.me/" target="_blank">HRT</a>
</p>
</div>
<script>
function goBack() {
window.history.back();
}
</script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>