Unit We are adventure gamers 6.1 Making a text-based

1 About this unit

Software: Python and IDLE, or trinket.io Apps: Pythonista or Python 3.4 for iOS (iOS), SL4A (Android), or trinket.io via Safari or other browser, Bluetooth keyboards are recommended for tablets Hardware: Laptop/desktop computers. Python works very well on the Raspberry Pi Outcome: A text-based adventure game

UNIT SUMMARY they will have encountered previously. Encourage pupils to look for similarities and differences. It is In this unit, the pupils learn a few commands of a important that pupils first plan their program before text-based programming language (Python), enabling they start writing the code. progression from Scratch. They create a simple, text- Python is used here in a form where commands based adventure game. are executed in sequence, just as blocks are used in Scratch. The pupils meet Python’s commands CURRICULUM LINKS for repetition and selection, work with variables and a list, and use text-based input and output. Computing PoS They create their own functions to provide a clearer structure for their program. Design, write and debug programs that accomplish The pupils will encounter a new type of error (bug) specific goals, including controlling or simulating in Python programming – the syntax error – where physical systems; solve problems by decomposing spelling or punctuation mistakes prevent Python them into smaller parts. from understanding the code they write. Fixing Use sequence, selection and repetition in these mistakes is vital in text-based programming. programs; work with variables and various forms of input and output. LEARNING EXPECTATIONS Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in This unit will enable the children to: algorithms and programs. learn some of the syntax of a text-based Suggested subject links programming language English: Using Python (or other text-based use commands to display text on screen, accept languages) helps reinforce the importance of typed user input, store and retrieve data using spelling, punctuation and grammar. The pupils will variables and select from a list need to interpret Python’s error messages and plan a text-based adventure with multiple ‘rooms’ spot the mistakes in their programs. and user interaction English: The unit provides an excellent opportunity thoroughly debug the program. to develop the pupils’ descriptive writing and The assessment guidance on page 10 will help storytelling. you to decide whether the children have met these The context of the adventure game could be expectations. related to another area of the curriculum, to a class reader or to broader PSHE themes. Typically, VARIATIONS TO TRY adventure games use medieval ‘swords and sorcery’ settings, but you may prefer to give a A text-based adventure can be created using clearer, curriculum-focused theme to pupils’ work. Scratch or other visual programming languages if the additional demands of Python prove too much TRANSLATING THE COMPUTING PoS for some or all pupils. There are dedicated systems for creating text- The pupils will be designing, writing and debugging based adventure games (‘’) such a program with a specific goal in mind. They will be as Twine and Inform 7. Simple ‘choose your own working in a text-based language, allowing them adventure’ games can be created using HTML, to compare and contrast this with Scratch, which wikis or presentation software. 12

25962 SOC Year 6 UPDATE V2.indd 12 01/07/2016 15:02 2 Getting ready before embarking on this unit. Work through the steps of the unit and perhaps explore some of the online tutorials suggested in Useful links. THINGS TO DO Watch the two CPD videos: ‘Getting started with Read the ‘Quick start guide’ on the inside front Python’ and ‘Next steps with Python’. cover and the Core steps sections of Running the Think about grouping for this project – pairs would task on pages 14–19. work well, but ensure both partners contribute to Think about a context for the pupils’ adventure both the content writing and the programming. games – the pupils could choose a topic that Read the School and Home sections of Running they find interesting, or you may prefer to give a the task on pages 14–19. Do you want to use any clear curriculum focus to their work – making an of the extras provided? interactive story based on a class reader, or a Ensure you have sufficient computers/laptops/ history or geography topic could work well. Not all tablets booked in advance. pupils would find a traditional ‘swords and sorcery’ adventure interesting. THINGS YOU NEED Decide which software/tools are most accessible/ Laptop/desktop computers with either Python appropriate for use with your class. See Variations installed or access to Trinket. Parental consent to try for some alternatives to Python for this unit. is needed for pupils to register for accounts on Download and ensure you have access to your Trinket, but it can be used without registering, and chosen software/tools (see Useful links). Python programs can be copied and pasted to a Look at appropriate software tutorials. It’s worth text editor to save locally. investing some time in exploring Python for yourself Paper and pens for planning the story.

MY RISING STARS RESOURCES INCLUSION

Unit poster – Some Python syntax Think about how best to scaffold pupils’ learning, Handout – Some common Python commands perhaps using help sheets or example code – a Pupil self-assessment information template for a completed adventure is available CPD videos – ‘Getting started with Python’; online. You might allow pupils to tackle this unit ‘Next steps with Python’ using Scratch or a similar language. Walkthrough videos of writing a simple text Some pupils might find it helpful to use speech-to- adventure text or text-to-speech software when programming Sample planning graph in a text-based language. Python includes Adventure game template file (see also: trinket.io/ access to the operating system’s text-to-speech python/7c35eac386) capabilities using the pyttsx ‘wrapper’.

ONLINE SAFETY USEFUL LINKS WWW Although Python programming is unlikely to pose Software and tools many online safety-related risks, Python does Python: www.python.org. provide programmable access to shell/operating Google drawings: docs.google.com/drawings. system commands so it must be used responsibly Trinket (online Python interpreter) trinket.io. on personal computers or school networks. Ask Pythonista for iOS: itunes.apple.com/gb/app/ your network manager to make sure that it is pythonista/id528579881. installed safely. Scripting layer for Android (including Python): Pupils can use the online trinket.io Python github.com/damonkohler/sl4a. interpreter. To save work online they will need to Online tutorials register, which requires parental consent. If pupils www.learnpython.org/. publish their work online, remind them that they Codecademy Python course: www.codecademy. are responsible for the content they create. Also com/learn/python. remind them not to share personal information www.edx.org/course/cs-all-introduction-computer- publicly via Trinket. science-harveymuddx-cs005x. Pupils might like to base their adventure game on published stories – discuss the intellectual property Information and ideas implications of this with them. Further Python activities from Code Club: www. codeclubprojects.org/en-GB/python/. Introduction to Interactive Fiction at www.willhines. net/if/harold3/IntroductionToIF.pdf. 13

25962 SOC Year 6 UPDATE V2.indd 13 01/07/2016 15:02

(range(10))

means? What print range(10) print (7*i) Extensions Encourage pupils to demonstrate Python to their parents, perhaps using trinket.io . Some might like to have a go at the interactive tutorial. happens if they type Ask the pupils to get Python print out the seven times table. Can they get it to print out the first ten square numbers? What about the first ten powers of two? Clue: A command for the seven times table would be: Is the result they expected? Can work out what on its own? for i in range (1,13):

SCHOOL HOME ). Draw their ? . Can they work out 32 / 5 “Hello, world!” and ( print 32 / 5 7 * 8, 12 + 34, 2 5 print ["Hello, world!"] print ("I like the colour",i) print (i) Show how this is entered in Python’s interactive shell. Emphasise the importance of colon and indent here. Draw the pupils’ attention to list of colours here. They will use this idea in their game later. Pupils could try typing the following to see which numbers i iterates over: Remind pupils that in Scratch they build a program using the blocks that are provided, but in Python they’ll need to write (i.e. type) their program. Demonstrate how Python can work out some simple arithmetic questions, e.g. Demonstrate how Python can print text on screen. Start with a simple command like Demonstrate how Python does repetition, using a program such as the following. The pupils could try typing the following: Show the pupils how to launch IDLE development environment. the difference between for i in range(10): for i in ["red","green","blue"]: for i in range(10): attention to the brackets and quotation marks here. Ask them to experiment with getting Python say other things.

Core steps Python and IDLE, trinket.io or other Python interpreter and editor

Running the task – We are adventure gamers 3

POSSIBLE OUTCOME FOR THIS STEP: RESOURCES Step 1: Getting started with Python Software: Python and IDLE or trinket.io Apps: Pythonista 3.4 for iOS (iOS), SL4A (Android), trinket.io. Bluetooth keyboards are recommended tablets Hardware: Laptop/desktop computers. Python works very well on the Raspberry Pi Outcome: A text-based adventure game Note: The steps below assume you’ll be using Python’s IDLE development environment installed on laptop or desktop computers. If you’re using a different tool to access Python (e.g. trink et.io Pythonista) some steps will need minor changes

14

25962 SOC Year 6 UPDATE V2.indd 14 01/07/2016 15:03 The pupils could easily add further rooms and descriptions to their graph. These simple graphs are an important data structure in computing – called binary trees. Invite the pupils to continue playing a text-based adventure game, either in book form or online. They could think about how a particular book could be made into an interactive adventure. Some children may use this time to finish their descriptive text.   SCHOOL HOME important to plan these first, i.e. work out the algorithms for their programs. Explain that this is even more important when working in text-based programming languages, as it is hard to keep track of both the idea program and spelling, punctuation and grammar of the language at same time. game. If you have any books with this sort of adventure (see the Books section on page 21), pupils could read some of these, or play an online version such as ‘The Matter the Monster’ or ‘Zork’. helpful for pupils to have a particular audience in mind their game: this could just be their fellow pupils. by drawing a tree-like graph (see Possible outcomes for this step and the example on My Rising Stars) where each room or setting is connected by possible choices to none, one two other rooms or settings. The pupils should aim for seven ‘rooms’ initially, and should just write the title for each room and show what it is connected to. They could use pencil paper, or create their graph using a drawing program, e.g. PowerPoint or Google Drawing. You may need to explain that games with more complex structures can be created but they should keep things simple initially so they can concentrate on understanding Python. of their rooms, either as notes or text blocks added to their diagram. Remind them about the importance of good, descriptive writing here, emphasising the need to choose adjectives carefully – they are writing a text-based adventure so all the player will have are their descriptions. graph) of their game on one another, asking for feedback their descriptions. Introduce pupils to the idea of a ‘choose your own adventure’ Brief the pupils on subject for their adventure. It might be Ask the pupils to work with a partner plan their adventure Ask the pupils to start writing descriptive text for each If time allows, the pupils could test algorithms (i.e. Remind pupils that when they made programs in Scratch it was eblong.com/zarf/zweb/matter/ view/5zyoqrsugeopel3ffhz_vq/zork

Google Drawing/PowerPoint ‘The Matter of the Monster’: Zork: textadventures.co.uk/games/ WWW POSSIBLE OUTCOME FOR THIS STEP: RESOURCES Step 2: Planning an adventure

15

25962 SOC Year 6 UPDATE V2.indd 15 01/07/2016 15:03 ) ' ' ' to break \ and \n command, perhaps commands for the print print Extensions adding further room descriptions to their program. descriptions of the other rooms in their adventure, without worrying for now how these rooms are connected. it up. The pupils could experiment with using this in their code. If time permits, the pupils could begin typing in Another way to print multiple lines in Python is to use three single quotes ( to start and end a block of text, simply using Enter rather than Encourage pupils to experiment further with Python’s

SCHOOL HOME is interpreted \n to show the text \ module command (or the command to display the run>run print in the description text. The \n print ("You are standing in room 0. There’s nothing here at all. You see two exits, labelled 1 and 2.") description for their starting room. What can they remember about the syntax of print command from Step 1? Their programs should be something like this: Explain that pupils will be creating a Python program (sometimes called a ‘module’) today, rather than just running individual commands. Demonstrate how they can create a new file in IDLE and save this, using the default .py extension. Explain that computers save programs using the same storage that they use for other files. Ask pupils to use a It is sometimes hard to read long lines of Python code that are split across lines like this. Show how they can the command across lines by adding If they want to include line breaks in the description, should include The pupils should save their programs. They can then run their programs using the When pupils encounter errors with their Python programs, encourage them to read the error message slowly and carefully. Encourage them to look closely at the detail in their code. F5 function key). If their program doesn’t work, they’ll need to debug it carefully – remind them that the errors are likely be because they have not got Python’s syntax exactly right. continues and pressing Enter where they want: print ("You are standing in room 0. \ There’s nothing here at all. \ You see two exits, labelled 1 and 2.") print ("You are standing in room 0.\n\ There’s nothing here at all.\n\ You see two exits, labelled 1 and 2.") by Python as code for a new line.

Core steps Python The game graphs created in Step 2

POSSIBLE OUTCOME FOR THIS STEP: RESOURCES Step 3: Printing descriptions

16

25962 SOC Year 6 UPDATE V2.indd 16 01/07/2016 15:03 , print command to elif commands inside this if and print("This is room 1. There’s It’s a bit odd.") print("This is room 2. It’s nice There are a couple of things in print("That’s not one of the input It’s worth asking pupils to think carefully about how this code works. code. check for other options in our selection statement. Pupils should edit their code so that it’s something like this: The pupils could add further rooms into their game by nesting further Ask the pupils to test their program. What happens if the player enters something else? This seems to be a bug. To fix this, we can use the Ask the pupils to experiment with these commands for themselves, perhaps writing a program that attempts to have a conversation with the user. if choice == "1" : only one thing here.\n\ elif choice == "2": and even.\n\ here.") choices! You lose")

SCHOOL HOME else:

:

for " == and the indenting of command. We will store else input line and after if . Ask the pupils to add equivalent of commands. Pupils could experiment with entering 'choice' print print("This is room 1. There’s only one thing \n\ print("This is room 2. It’s nice and even. \n\ Draw pupils’ attention to the syntax here, particularly the code incorrectly and seeing what error messages are displayed if they do. following code to the end of their program, replacing 1 and 2 with the rooms that are connected to their starting room. Show the pupils how to load programs they saved at end of the previous lesson. Explain that as well outputting text on screen, we also need to allow Python accept input from the user, store it in a variable and use that to show the description of next room. To accept input, we use the The pupils can save and test their program now, debugging any syntax errors they have made. They now need to add a selection statement their program, so that Python will show the description for correct rooms. The code should be similar to this: Remind pupils to save their work. the player’s room choice in a variable (memory location) called choice = input ("Choose 1 or 2: ") if choice == "1" : here. It’s a bit odd.") There are a couple of things in here.") the at the end of around 1, to show that it is the string we’re comparing, checking if something is equal to else, the

else: Python The game graphs created in Step 2 The programs started in Step 3

RESOURCES POSSIBLE OUTCOME FOR THIS STEP: Step 4: Using selection and variables

17

25962 SOC Year 6 UPDATE V2.indd 17 01/07/2016 15:03 Extensions The pupils can change the graph of their game to create more complex structures, such as cycles (loops) of rooms, or more than two choices in some locations. As each room procedure has the same pattern, particularly gifted pupils could generalise this pattern, perhaps storing room descriptions and choices in lists or Python’s dictionary data type. Encourage the pupils to let their parents or siblings play the games they have made, making further changes on the basis of the feedback they receive.

SCHOOL HOME , : def, () to the end of their program, and run it, pupils print("That’s not one of the choices!") print ("You are standing in room 0. \n\ choice = input ("Choose 1 or 2: ") if choice == "1" : elif choice == "2": room0() Draw pupils’ attention to the syntax here, such as will see it works for the first room, but that next rooms haven’t been defined. On its own, this code won’t do anything, as all they have done is define a procedure, if they add the equivalent of: Note: This step may take more than one session to complete. A template for this adventure is online (see Resources ), which pupils could edit themselves. Explain that they could create their complete game by nesting more print, input and if statements inside the code they have written but there is a better way. One way to treat each room as a separate procedure . Ask them to edit their code so that it looks like the equivalent of this: The pupils can now add further room descriptions and choices to their program, using graph for the text and choice structure of their game. Each room should be a separate procedure, structured in a similar way to the above. The template file provided could be used to help with this. def room0(): You see two exits, labelled 1 and 2.") and the indentation.

room1() room2() else: room0() Core steps Python The game graphs created in Step 2 The programs from Step 4 A template for a completed adventure, if you wish. See trinket.io/ python/7c35eac386

WWW POSSIBLE OUTCOME FOR THIS STEP: RESOURCES Step 5: Using procedures

18

25962 SOC Year 6 UPDATE V2.indd 18 01/07/2016 15:03 The pupils could add further random elements to their game, perhaps combining two randomly chosen words in the same description. They could investigate how computers can make apparently random choices when they simply follow the instructions they are programmed to. Ask the pupils to test out their game on their parents and/or siblings, making further changes on the basis of feedback they receive.

SCHOOL HOME , : def, () ] for the list. command at the top of command, but that this isn’t a import random library command. Draw pupils’ attention to random.choice to the end of their program, and run it, pupils print("That’s not one of the choices!") print ("You are standing in room 0. \n\ choice = input ("Choose 1 or 2: ") if choice == "1" : elif choice == "2": options = ["red","blue","green"] " book in here. ") room0() Draw pupils’ attention to the syntax here, such as Again, draw their attention to the syntax of using [ Notice how the list options is passed as a parameter to random.choice will see it works for the first room, but that next rooms haven’t been defined. the spaces inside text strings before and after random word. These are needed as otherwise they would just run straight into the picked word. standard Python command. has lots of additional command libraries that extend the language in very powerful ways. To use the commands for random numbers and choices, add the On its own, this code won’t do anything, as all they have done is define a procedure, if they add the equivalent of: Note: This step may take more than one session to complete. A template for this adventure is online (see Resources ), which pupils could edit themselves. Explain that they could create their complete game by nesting more print, input and if statements inside the code they have written but there is a better way. One way to treat each room as a separate procedure . Ask them to edit their code so that it looks like the equivalent of this: The pupils can now add further room descriptions and choices to their program, using graph for the text and choice structure of their game. Each room should be a separate procedure, structured in a similar way to the above. The template file provided could be used to help with this. Ask pupils to load their programs from Step 5 and explain carefully what the Python code does on each line. Ask them to discuss the particular Python syntax they have noticed as they have been writing their programs. Explain that their games could be made more interesting by including some random elements in room descriptions. Ask them to think where they could change their game include some randomly chosen text in the descriptions, such as colour of a book as below, and what possibilities they might include. Show how they can create a list of possible text strings to choose from inside one of their room procedures, e.g.: Explain that to pick randomly from the list, we need use Python’s We can then edit the room descriptions to include a word picked at random from the list, e.g.: Ask the pupils to compare experience of programming in Scratch and Python. What have they particularly liked about Python? What have they found particularly frustrating? program code. def room0(): You see two exits, labelled 1 and 2.") def room1(): print ("There is a " + random.choice(options) \ and the indentation.

room1() room2() else: room0() ... Python The game graphs created in Step 2 The programs from Step 5

POSSIBLE OUTCOME FOR THIS STEP: RESOURCES Step 6: Using lists

19

25962 SOC Year 6 UPDATE V2.indd 19 01/07/2016 15:03 4 Assessment guidance Use this page to assess the children’s computing knowledge and skills. You may wish to use these statements in conjunction with the badges provided online and/or with your own school policy for assessing work.

ALL CHILDREN SHOULD BE ABLE TO: BADGE COMPUTING PoS REFERENCE

LOGICAL THINKER Type 2 some commandsCOMMUNICATOR at Python’sPROGRAMMER 2 PROBLEM SOLVER 2 Write programs that accomplish specific interactive shell goals LOGICAL THINKER Create 2 a plan COMMUNICATORfor a text-based adventurePROGRAMMER 2 PROBLEM SOLVER 2 Design programs that accomplish specific goals

Use the printLOGICAL command THINKER 2 in PythonCOMMUNICATOR PROGRAMMER 2 PROBLEMWork SOLVER with 2 various forms of output

CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER Use variablesLOGICAL and THINKER selection 2 in PythonCOMMUNICATOR PROGRAMMER 2 PROBLEMUse SOLVERselection; 2 work with variables

CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER LOGICAL THINKER Use 2 proceduresCOMMUNICATOR in Python PROGRAMMER 2 PROBLEM SOLVER 2 Solve problems by decomposing them into smaller parts CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER Create a list inLOGICAL Python THINKER 2 COMMUNICATOR PROGRAMMER 2 PROBLEMWork SOLVER with 2 variables

MOST CHILDREN WILL CONTENTBE ABLE CREATOR 2 TO: ONLINE SAFETY 2 SEARCHER

CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER Correct mistakes in commands typed at LOGICAL THINKER 2 COMMUNICATORUse logical reasoningPROGRAMMER to detect 2 and PROBLEM SOLVER 2 Python’s interactive shell correct errors in programs CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER LOGICAL THINKER Draw 2 a graph COMMUNICATORto show the locationsPROGRAMMER in a 2 PROBLEM SOLVER 2 Design programs that accomplish text-based adventure specific goals Spot and correct syntax errors in Python LOGICAL THINKER 2 COMMUNICATORUse logical reasoningPROGRAMMER to detect 2 and PROBLEM SOLVER 2 print commands correct errors in programs CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER Use variablesLOGICAL and THINKER if 2/ elif / COMMUNICATORelse PROGRAMMER 2 PROBLEMUse SOLVERselection; 2 work with variables selection in Python CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER LOGICAL THINKER Define 2 multipleCOMMUNICATOR procedures in Python,PROGRAMMER 2 PROBLEM SOLVER 2 Solve problems by decomposing them correctly observing the syntax rules into smaller parts CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER Choose randomlyLOGICAL THINKER from 2 a Python COMMUNICATORlist PROGRAMMER 2 PROBLEMWork SOLVER with 2 variables

CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER SOME CHILDREN WILL BE ABLE TO:

CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER

Experiment withLOGICAL commands THINKER 2 usingCOMMUNICATOR Python’s PROGRAMMER 2 PROBLEMUse SOLVERrepetition 2 in programs

interactive shell, includingCONTENT the CREATOR for 2 and ONLINE SAFETY 2 SEARCHER range commands LOGICAL THINKER 2 COMMUNICATOR PROGRAMMER 2 PROBLEM SOLVER 2 Design programs that accomplish Describe tree-like graphs, such as one for a specific goals choose your own adventure game Experiment withLOGICAL line-breaks THINKER 2 and COMMUNICATORtext blocks PROGRAMMER 2 PROBLEMWork SOLVER with 2 various forms of output in Python print commandsCONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER LOGICAL THINKER Explain 2 what aCOMMUNICATOR procedure is PROGRAMMER 2 PROBLEM SOLVER 2 Solve problems by decomposing them into smaller parts CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER LOGICAL THINKER Explain 2 what aCOMMUNICATOR library is in PythonPROGRAMMER 2 PROBLEM SOLVER 2 Solve problems by decomposing them into smaller parts PROGRESSION CONTENT CREATOR 2 ONLINE SAFETY 2 SEARCHER

The followingCONTENT CREATOR units 2 will allowONLINE yourSAFETY 2 children to SEARCHERdevelop their knowledge and skills further.

Unit CONTENT6.2 –CREATOR We 2 are computationalONLINE SAFETY 2 thinkers SEARCHER Unit 6.5 (first edition) – We are app developers

20

25962 SOC Year 6 UPDATE V2.indd 20 01/07/2016 15:03 5 Classroom ideas Practical suggestions to bring this unit alive!

DISPLAYS AND ACTIVITIES VISITS

As with any programming, it is really useful for the There may be governors, parents or other friends pupils to be able to step through algorithms and of the school who program professionally; they programs for themselves. They should do this at may be willing to come in to support pupils in this the planning stage, by getting classmates to play unit or to talk about their work. their adventures based on the graphs. They could Local secondary schools may well teach Python also do this at the coding stage, by having one and could provide support or extension for pupils pupil act as the Python interpreter, perhaps writing in this unit. any print output down on paper and the contents The pupils could base the adventure game itself on of any variables. an educational visit, writing descriptive text about Do provide an opportunity for others to try the pupils’ some of the places they have or will visit. games, both within the class or with those from any intended target audience, such as younger pupils. BOOKS It is interesting to compare and contrast the Python and Scratch code for the same adventure Briggs, J. Python for Kids: A Playful Introduction to game, and this could be used as a starting point Programming. (No Starch Press, 2012) for a classroom display. Jackson, A. and Livingstone, I. The Warlock of Firetop Mountain (Puffin Adventure Gamebooks, WWW WEBLINKS 1982); plus other texts in the Fighting Fantasy series Some other approaches to developing text-based Lotriet, C. Learn to Code Practice Book 4. (Rising adventures using Python include: en.wikibooks.org/ Stars, 2015) wiki/Choose_Your_Own_Pyventure, blog.trinket.io/ Montfort, N. Twisty Little Passages: An Approach python-text-adventure/, letstalkdata.com/2014/08/ to Interactive Fiction. (The MIT Press, 2005) how-to-write-a-text-adventure-in-python/. Roffey, C. Python Basics, Level 1 (Coding Club). There are many resources for text-based adventures/ (Cambridge University Press, 2012) interactive fiction online but not all of them are Sande, W. and Sande, C. Hello World! Computer suitable or accessible from school networks. Choose Programming for Kids and Other Beginners. carefully from those available at textadventures. (Manning Publications, 2014) co.uk/, chooseyourstory.com/ and ifdb.tads.org/. Scott, B. Python for Kids for Dummies. (John Wiley There is a comprehensive list of introductory Python and Sons, 2015) books at wiki.python.org/moin/IntroductoryBooks, and some online tutorials at wiki.python.org/moin/ BeginnersGuide/Programmers.

6 Taking it further When you’ve finished, you might want to extend the project in the following ways.

Some pupils might like to develop more interactive are artists, using Python’s Turtle library to recreate stories, perhaps using general purpose tools such as their drawings using Python, or their educational PowerPoint, or using software designed specifically games from Unit 4.1 – We are software developers, to for this purpose such as Twine (twinery.org/), Inform make text-based versions of these in Python. It would 7 (inform7.com/), Quest (www.textadventures.co.uk/ be possible to rewrite the cryptography programs from quest/) or TADS (www..org/). They could create Unit 5.2 – We are cryptographers using Python too. an interactive version of a favourite text, or make an The program pupils create for a choose your own interactive tour of the school. adventure game could be easily adapted to make Pupils can do much more with Python than create a classification key or branching database, for text-based adventures. They could perhaps revisit example to identify minibeasts, as this also uses a some of the Turtle graphics work from Unit 5.3 – We very similar binary-tree data structure. 21

25962 SOC Year 6 UPDATE V2.indd 21 01/07/2016 15:03