-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
290 lines (247 loc) · 9.55 KB
/
index.html
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Game Development using Python - Organized by CSEA</title>
<meta name="description" content="Python Workshop to build a pong game and learn the basics of programming">
<meta name="author" content="Piyush Bhopalka">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h5>A workshop on</h5>
<h1><font color="#FF5722">Game Development using Python</font></h1>
<p> <a href="http://www.facebook.com/CSEA.NITC">Organized by CSEA</a></p>
<small>Press 'F' for Fullscreen</small>
<br>
<small>Press <em>Space</em> to navigate the presentation</small>
</section>
<section data-background="img/bowling.jpg">
<!-- No content for this page -->
</section>
<section>
<h2>Creating your first Python file</h2>
<p>
Open <font color="yellow">gedit</font> and type
</p>
<p>
<font color="red">print "hello world"</font>
</p>
<p>
Save the file as <code><font color="yellow">filename.py</font></code>
</p>
</section>
<section>
<h2>Running your first Python file</h2>
<p>
In your terminal, type
</p>
<pre><code data-trim contenteditable>
user:~$ python filename.py
</code></pre>
</section>
<section>
<h2>Few examples of Python statements</h2>
<pre><code data-trim contenteditable>
print "python is cool"
a = input()
b = 5
c = "hello"
d = a + b
b = b + 1
a += 1
print d, b
</code></pre>
<p><small>Try them!! Take around <font color="yellow">7 and a half minutes</font> :)</small></p>
</section>
<section>
<h2>Some powerful statements...</h2>
<p>
Conditional Statements
</p>
<pre><code data-trim contenteditable>
if <condition 1>:
statement 1
statement 2
....
</code></pre>
<p><small>Pay special attention to <font color="red">indentation</font> and the <font color="red">colon (:)</font> symbol</small></p>
</section>
<section>
<h2>Some powerful statements...</h2>
<p>
Conditional Statements
</p>
<p><small>Enhancing the if-conditions</small></p>
<pre><code data-trim contenteditable>
if <condition 1>:
statement 1
statement 2
....
elif <condition 2>:
statement 3
statement 4
else:
statement 5
....
</code></pre>
<p><small>Pay special attention to <font color="red">indentation</font> and the <font color="red">colon (:)</font> symbol</small></p>
</section>
<section>
<h2><font color="yellow">Let's try something</font></h2>
<p><i>I give you a point in the graph.</i></p>
<p><i>You tell me which quadrant it lies in. Can you?</i></p>
<pre><code data-trim contenteditable>
Sample Input (Take x as input first then y as input):
-2
3
Sample Output (Print the quadrant number):
2
</code></pre>
<p><small><font color="red">Don't</font> go to the next slide before you try this question !!</small></p>
</section>
<section>
<h2><font color="yellow">Let's see the solution</font></h2>
<p><i>Hope you tried it yourself first <font color="yellow">:)</font></i></p>
<pre><code data-trim contenteditable>
x = input()
y = input()
if x > 0 and y > 0:
print 1
elif x < 0 and y > 0:
print 2
elif x < 0 and y < 0:
print 3
elif x > 0 and y < 0:
print 4
else:
print "Not in any quadrant"
</code></pre>
<p><small>Dont forget the <font color="red">indentation</font> and <font color="red">colon (:)</font> where required</small></p>
</section>
<section>
<h2>Some powerful statements...</h2>
<p>
Looping statements
</p>
<pre><code data-trim contenteditable>
while <condition>:
statement 1
statement 2
....
</code></pre>
<p><small>Pay special attention to <font color="red">indentation</font> and the <font color="red">colon (:)</font> symbol</small></p>
</section>
<section>
<h2><font color="yellow">Let's try something</font><font color="red"> again!</font></h2>
<p><i>Give me even numbers from 1 to 100</i></p>
<pre><code data-trim contenteditable>
Sample Input:
{no input}
Sample Output:
2
4
6
8
...
...
98
100
</code></pre>
<p><small>We will try this for another <font color="yellow">7 and a half minutes :P</font></small></p>
</section>
<section>
<p>
You need to submit a Physics Assignment. What steps will you take to complete it?
</p>
</section>
<section>
<h2>Functions</h2>
<p>Functions help us stand on the shoulders of giants!</p>
<pre><code data-trim contenteditable>
import math
pi = math.pi
a = math.sin(pi/2)
print a
</code></pre>
</section>
<section>
<h2>List and tuples</h2>
<p>This is a list. <i>It is bound by <font color="red">square brackets []</font></i></p>
<pre><code data-trim contenteditable>
[1, 2, "hello", [3, 4]]
</code></pre>
<br>
<p>This is a tuple. <i>It is bound by <font color="red">round brackets ()</font></i></p>
<pre><code data-trim contenteditable>
(1, 2, "hello", [3, 4])
</code></pre>
<p><small>Once created, contents of tuples <font color="yellow">cannot be changed</font>. For a list, we can modify.</small></p>
</section>
<section>
<p>One last thing before you become a Ninja Python Programmer</p>
</section>
<section>
<h2>Revisitng loops</h2>
<p>for loop</p>
<pre><code data-trim contenteditable>
number = input()
ls = [1, 2, 3, 4]
for multiples in ls:
print number, "x", multiples, "=", multiples * number
</code></pre>
<p><small>Pay special attention to <font color="red">indentation</font> and the <font color="red">colon (:)</font></small></p>
</section>
<section>
<h2><font color="#FF5722">TAKE A BREAK!</font></h2>
<p>
Let's head over to building the game....
<a href="pygame.html">Click here</a>
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>