From c35db75eba1f67c6d6bbca9fefe7aaefb6b6d6e9 Mon Sep 17 00:00:00 2001 From: Peter Ward Date: Sun, 29 Jul 2012 23:43:29 +1000 Subject: Add start of tutorial. --- docs/firstbot.tex | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/firstbot.tex (limited to 'docs/firstbot.tex') 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. + -- cgit v1.2.3