Month: November 2016

Before we get into Pygame on Python3, we have to learn a little about how to access the command line, how to navigate the file system hierarchy, how to run python programs, and how make files executable. This will make it much easier to run your programs, especially since running your Pygame program in Wing IDE 101 can be problematic and on the Mac OSX system it will usually hang.

Commands we will be learning:

how to launch “terminal”

pwd

ls, ls -l

cd

mkdir

mv

rm

cp

python3 ______

nano

cat

#!/usr/local/bin/python3

chmod 755, chmod +x

./_____

If you get lost, here are a couple of websites that the tutorial is based on:

For your first python game assignment, you will either create a dice rolling simulator game, or a guess that number game. The dice rolling simulator is easier, so if you choose the guess that number game, you will get some bonus marks for completing it.

Dice rolling simulator game requirements:

This game simulates rolling dice and will keep a running total of the dice rolls as the user continues to play the game. When the program runs, the user will be asked:

a) Roll the dice

b) Quit the game

If the user chooses ‘a’, it will randomly choose a number between 1 and 6. (Or whatever other integer you prefer — the number of sides on the die is up to you.) The program will print what that number is. The program will also keep a running total of all dice throws since the start of the program, and it will print the total sum of all dice throws so far. For this project, you’ll need to set the min and max number that your dice can produce. For the average die, that means a minimum of 1 and a maximum of 6. You’ll also want a function that randomly grabs a number within that range and prints it. You’ll also want a variable that keeps track of the sum of dice throws.

Concepts to keep in mind:

Random

Integer

Print

Variables

Sums

While Loops

Guess that number requirements:

The program will first randomly generate a number unknown to the user. When the program runs, the user will be asked:

a) Guess a number between 1 and 100

b) Quit the game

If the user chooses ‘a’, then the user needs to guess what that number is. If the user’s guess is wrong, the program should return whether the number entered is too high or too low. If the user guesses correctly, a positive indication should appear. You’ll need functions to check if the user input is an actual number, to see the difference between the inputted number and the randomly generated numbers, and to then compare the numbers.

Concepts to keep in mind:

Random function

Variables

Integers

Input/Output

Print

While loops

If/Else statements

For either assignment, you will need to create pseudocode using the syntax we learned earlier in the year.

Copy and pasted below from the main google website, here are the organizations you can work with for this year’s Google Code-in contest. Remember, I will open up the computer lab lunch time on Thursdays (along with Makerspace club) and possibly more days if necessary to facilitate your projects.

Zulip – powerful, threaded open source group chat with apps for every major platform

Mentor organizations are currently creating thousands of tasks for students covering code, documentation, user interface, quality assurance, outreach, research and training. The contest officially starts for students on Monday, November 28th at 9:00am PST.

We are continuing our way through Python by going through Chapter 4, learning about FOR statements (ITERATION in pseudocode), nested loops. If you get lost, you can follow along here, go to the end of section 4.3: