This is for students who complete the regular assigned activities early or are looking for more challenges. This is an advanced option for inquisitive students interested in challenging themselves with more advanced programming tasks. Mr. James will help you, direct you to resources, and answer questions but there will not be any formal instruction on these activities, and much of the support will be performed over email outside of regular class hours.
Ask Mr. James to give you a ComputerCraft computer to program inside Minecraft, or use one of the computers placed in the world. Ctrl-click it to access it. Type “help” for some commands to get you started. Type “programs” to list the built-in programs and games including the classic Adventure and Worm games.
As you type a command, it will suggest the completed command. Rather than typing the whole command you can hit the tab key for auto-complete.
If you need to terminate a running program, hold ctrl-T down until it exits.
The computers can save programs to and load programs from PasteBin. Do not count on anything being saved unless you upload it to Pastebin. Learn about using pastebin with ComputerCraft.
When you have a program ready for Mr. James to review: save it to PasteBin and submit the PasteBin ID of your program using this form:
Lua Programming Assignments
Assignment 0: Getting to know Lua
Objectives: get acquainted with the basics of writing a Lua program, including use of variables, loops, producing output for the user, and receiving text input (answers to questions) from the user. Use PasteBin to save and load programs.
ctrl-click the computer to access its terminal and enter commands.
To start editing a new program called myguesser type the below command. Feel free to call your program a different name.
Enter this “guess the number” program and customize it. Use your own messages, change the range of numbers to be guessed, etc. The sample code has at least one bug which is easy to find and fix, and it doesn’t give a message when you win, so fix those things!
Don’t want to type everything in manually? Learn about using pastebin with ComputerCraft. The guess the number program is available at pastebin A14HyrSV. Capitalization matters with PasteBin identifiers. To get it and save it with a program name of “guesser”, enter:
pastebin get A14HyrSV guesser
After downloading a program, you can customize it to add your own creative ideas:
You can edit the built-in programs. For example:
and change the color of the worm.
You can load others’ programs from pastebin, and then edit them. For example, here is a good version of Hangman that you can install, run, and edit:
pastebin run u15WwrLd
GU3JXc61 is a Magic 8 Ball fortune-teller you can try and modify.
Assignment 1: Flappy Bird
Here is a simple Flappy Bird game:
pastebin get 4kqJKA42 FlappyPixel
Make some changes to it:
- Make it easier. Slow down the speed and make the obstacles easier to get through
- Change the colors
- Add a new kind of obstacle or enemy of your choosing
Learning more about how to program in Lua, the language of ComputerCraft:
Do a Google search constrained to results from the ComputerCraft.info website:
lua tips site:computercraft.info
More Programming Assignments
Want to work on some advanced programming assignments using the ComputerCraft computers and Lua? Here is a list of more assignments. You can also design your own project and get it approved if you think of something more exciting you would like to work on.
Save your work to pastebin and be sure to write down your pastebin ID so you can load it again later.