Mac OSX File System Organization

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:

http://linuxcommand.org/lts0020.php

http://linuxcommand.org/lts0050.php

Google Code-In has Begun…

Those of you who are participating in the Google Code-in contest, the tasks have been released and you can signup/claim tasks right away. Take a look at the tasks here:

https://codein.withgoogle.com/tasks/

Reminder, I will open the computer lab every Thursday (along with Makerspace) and you can work on tasks (ask me for help), etc…

I may open up the lab on other days for lunch as well as needed to support you…

First Python Game, Dice Roller or Guess That Number

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.

https://pmsscoding2016.wordpress.com/2016/10/05/pseudocode-part-2-assignment/

As an alternative to pseudocode, I will accept a program made by you in Snap! that simulates the same game (because block programming is essentially pseudocode).

This assignment is due next Wed Nov 30.

Google Code-In Organizations announced

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.

 

https://opensource.googleblog.com/2016/11/announcing-google-code-in-2016-orgs.html

Google Code-in officially starts for students on November 28, but students are encouraged to learn about the mentor organizations ahead of time and can get started by clicking on the links below.
  • Apertium – rule-based machine translation platform
  • BRL-CAD – computer graphics, 2D and 3D geometry modeling, and computer-aided design (CAD)
  • CCExtractor – open source tools for subtitle generation
  • Copyleft Games – building game development platforms for tomorrow
  • Drupal – content management platform
  • FOSSASIA – developing communities across all ages and borders to form a better future with Open Technologies and ICT
  • Haiku – operating system specifically targeting personal computing
  • KDE – team that creates Free Software for desktop and portable computing
  • MetaBrainz – builds community maintained databases
  • Mifos Initiative – transforming the delivery of financial services to the poor and the unbanked
  • MovingBlocks – like an open source Minecraft
  • OpenMRS – open source medical records system for the world
  • SCoRe – research lab that seeks sustainable solutions for problems faced by developing countries
  • Sugar Labs – learning platform and activities for elementary education
  • Systers – community for women involved in the technical aspects of computing
  • Wikimedia – non-profit foundation dedicated to bringing free content to the world, operating Wikipedia
  • 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.

Chp 4, Iteration and Looping

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:

http://programarcadegames.com/index.php?chapter=loops&lang=en#section_4

Submit your lab tutorial to the dropbox as usual.

There should be time for you to finish off your hardware lab writeups in case you did not finish last class.