Spring 2015 Section
Instructor: Kyle Thomas - thomaskcr@gmail.com
Hosted by Primoris Academy - Westwood, NJ
This course is designed to introduce students to the fundamentals of programming using the Python language. The theme for this course will be games but the ultimate goal is to teach students how to examine a problem from the point of view of a programmer and then give them the tools to solve it. Games provide a way for someone with just about any interest to find a problem that interests them and then explore it.
The course will start with learning how to set up a development environment, control flow statements in Python and using basic data structures. These principles will be applied to developing different types of games every week. We will cover as many types of games as possible including card games, arcade games, board games and RPGs. Each week will introduce new programming challenges and provide a platform for students to explore topics they are interested in.
The course structure will consist of a weekly lecture based on the notes packet distributed with this course that will introduce the new topics for the week. Students will have a weekly lab to complete that will be started in class and due the next week.
This is a tentative course calendar. If you have any games, on this calendar or not, that you are excited about building let me know and I'll make sure that they are prioritized or create a lab based on your request.
The first week will cover everything needed to get started programming in Python on Windows. We will start with learning how to install the Python interpreter and use the Python shell. Once we can execute Python code, we will introduce the concept of version control and learn how to use GitHub. The class will end covering some basic features of the Python language and we will write our first programs.
- Lecture Topics
- Getting Started: Quick introduction to programming and python with information on installing the tools we'll need for this course.
- Saved Programs: We'll go through saving your Python programs to files and running them.
- GitHub Basics: You will use GitHub to turn your assignments into me.
- Python Language Basics: In this set of notes we'll cover variables, types, operators and getting user input.
- Conditionals: In these notes we'll cover the if statement.
- Random Numbers: These notes cover generating and using random numbers.
- Walkthroughs
- Python Installation Video: A walkthrough of the process of installing Python on a Windows computer and using the interactive shell to execute expressions. Below are the four things you'll need to install for this class.
- Download Python This is the site to get the Python installer. We are using Python 3.4 for this course, the current version is 3.4.3.
- Download Wing IDE 101 This is the IDE (where you write and run your programs) we'll be using for this class.
- Pygame Installer We won't be using this the first couple weeks but it doesn't hurt to have it ready to go.
- GitHub for Windows Download You'll need this to submit your assignments.
- Hello World: By tradition, the first program beginners execute in a new language prints the phrase "Hello, World!". In this walkthrough we will write the "Hello, World!" program after setting up a GitHub account and then add the program to our profile.
- Dice Game: We'll create a dice game.
- YouTube Video The Chrome screen seems to be capturing wrong. Luckily I don't spend much time there in the video. The page I have opened is the Dice Game link above. I ended up adding an extra feature in the video.
- GitHub Repo for Dice Game
- Python Installation Video: A walkthrough of the process of installing Python on a Windows computer and using the interactive shell to execute expressions. Below are the four things you'll need to install for this class.
- Lab
- Penny Drop Calculator [50 Points]
- Math Game [100 Points]
- Scratch Lab (Only due for Scratch Group)
- Scratch Dice Game [200 Points]
- Wing IDE Tutorial This site can give more information about the features of Wing IDE including many that we won't have a chance to use in this class.
- Git Community Book If you really want to learn git in depth, this book goes through all of the details.
- Invent With Python: Writing Programs: This chapter covers flow of execution, strings, data types, saving/running programs in IDLE (we use Wing IDE), the
print()andinput()functions, comments and variable naming. - Invent With Python: Guess the Number: This covers some topics from next week as well but goes into more detail about modules/imports and then covers conditionals, blocks, comparisons, type conversion and the random functions. The while statement will be covered next week and break statement will be covered later in the course.
- Lecture Topics
- Getting Started: Quick introduction to programming and python with information on installing the tools we'll need for this course.
- Saved Programs: We'll go through saving your Python programs to files and running them.
- Python Language Basics: In this set of notes we'll cover variables, types, operators and getting user input.
- Conditionals: In these notes we'll cover the if statement.
- Random Numbers: These notes cover generating and using random numbers.
- Lab
- Math Game (Python) [100 Points]
- Guessing Game (Scratch) [100 Points]
- Lecture Topics
- Loops
- Lists
- Reading/Writing Files
- Cookbook Updates:
- Loops
- Writing to Files
- Reading Files
- Lab
- Hello World: Introduction to GitHub [50 Points]
- Quiz Game [100 Points]
- Guessing Game
- Walkthrough and Lab
- Pygame Basics
- Cannon Game
- Resources
- Lecture Topics
- Unit testing
- Images
- Computer players
- Walkthrough
- Lab
For this weeks walkthrough we'll be starting from a reference point and building features into our game. Here is an outline of the rules/gameplay of our game:
- Each level lasts for 30 seconds
- The number of "koopas" trying to get you is the current level number
- If you touch a koopa you die
- You start with three lives
- Tracking and rendering remaining lives
- Initalization
- Ending game on loss
- Show remaining lives
- Adding Koopas
- Generating ternaround points
- Showing Koopas
- Copy the code found here into a file named
mario.pyin your folder - Download the following images into the same folder
Thanks to a suggestion from Thomas Mascoli, this week we will built a math game in class. Math problems are randomly generated and then fall. Players lose a point if a math problem reaches the bottom of the screen before they get it correct. If they get it correct before it reaches the bottom they get a point.
This week we will be animating mario, including making him appear to run rather than glide and face the proper direction when moving. We will also be adding a block/coin collection aspect to the game and animating the coins when collected.
-
Download the following images into the same folder
-
Copy this code listing, this will be our starting point this week
- Copy this code listing, this will be our starting point this week
- Download Python This is the site to get the Python installer. We are using Python 3.4 for this course, the current version is 3.4.3.
- Python For Beginners: This is a getting started guide from the official python website.
- Python for Non-Programmers One of the links on this page is a getting started page specifically put together for non-programmers. This is a collection of resources that can be used by a beginner to learn how to program. As you can see, there is no shortage of free resources online for learning how to program.
- Official Python Documentation This is the Python language documentation. The most relevant links on this page are the Tutorial, Library Reference and Language Reference
- Python Tutorial This is a tutorial introduces a subset of Python's features to get a developer started using the language. It may go more or less in depth than this course depending on the topic. This course lines up approximately with chapters 1-7.
- Language Reference Similar to the tutorial but much more complete and organized by topic instead of as an introduction to the language.
- Library Reference Find information about the modules/functions distributed with your python installation. This will probably be less useful for this class but is a good place to see what comes with the Python language.
- Installing Python on Windows Instructions to help walk through the installation of Python on Windows.
- Installing Python on Mac OS X For this course, we will assume students are working on Windows since it is the most common operating system but python can be run on just about any OS. These directions walk through the nuance of installing on a Mac.
- Installing Python on Linux Linux is a free and open-source operating system used often on servers and by developers. There are a lot of flavors of Linux, my personal favorite is Fedora for my development machines and CentOS (an enterprise-class relative of Fedora) for servers. If interested in Linux here are some resources to get started:
- Fedora Official Site Fedora official site. Includes links to downloads and documentation with information on getting started and installation. Fedora offers LiveCDs that allow users to run Fedora without installing it to try it out.
- Ubuntu Official Site Ubuntu is a popular Linux flavor for beginners.
- Ubuntu Community Installation Guide Gives information on installing and getting started with Ubuntu.
