diff options
author | Peter Ward <peteraward@gmail.com> | 2012-07-29 23:43:29 +1000 |
---|---|---|
committer | Peter Ward <peteraward@gmail.com> | 2012-07-29 23:43:29 +1000 |
commit | c35db75eba1f67c6d6bbca9fefe7aaefb6b6d6e9 (patch) | |
tree | d32b851da74ed9b053248351f308a734b8c2a8b6 /docs/firstbot.tex | |
parent | b62e033801895ad633f702685e50cf367ae0adee (diff) |
Add start of tutorial.
Diffstat (limited to 'docs/firstbot.tex')
-rw-r--r-- | docs/firstbot.tex | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/firstbot.tex b/docs/firstbot.tex new file mode 100644 index 0000000..221928c --- /dev/null +++ b/docs/firstbot.tex @@ -0,0 +1,22 @@ +\section{Your First Bot} +\fasttrack{Always move up.} + +Alright, let’s get started. +If you think back to when you started programming, chances are the first program +you ever wrote was one which printed out the immortal phrase “Hello World”. +Well we can’t print stuff here, but our first bot is going to be almost as +useless as that: our bot is just going to continually move up. + +Let’s have a look at the code: +\pythonfile{firstbot.py} + +If you run this script (\texttt{python firstbot.py}), +you should see a nice big board with some apples scattered over it, and a snake +continually moving upwards. +That snake is our bot: each time the game decides that our snake is allowed to +move, it calls the \texttt{up\_bot} function, which immediately returns the +string \mint{python}|'U'|, which means it should move the snake upwards. + +Got all that? +Once you’re ready, we’ll move on to something a little more interesting. + |