Fork me on GitHub

22nd class - Pygame, more git, and (maybe) Contributor guidelines

by Elliott Hauser

11 Nov 2013

Announcements

Pygame! Starpusher! Hacking!

1 - Install pygame. You should do this via

sudo apt-get install python-pygame

2 - Fork & Clone Silshack/starpusher. Go to http://github.com/silshack/starpusher and click fork. Then,

git clone https://github.com/{your-username}/starpusher.git

(Note that github automatically adds the origin and remotes for us!)

3 - Run the program.

cd starpusher
python starpusher.py

Play around to get a sense of what you can do.

4 - Read the program. In a new terminal:

cd starpusher 
nano starpusher.py

See if you can get a sense of what the program does and how. There are some helpful variations at the top. A hint: read the program from the bottom (what it does) then the functions or classes it uses (and how).

5 - Hack the program. Close starpusher. Make a new branch:

git branch hack-starpusher     # makes branch
git checkout hack-starpusher   # moves you to branch

Now, hackity hack! Some ideas:

  • Change the frame rates or other variables at the top
  • Change the images in the images dict (you can find and download new pngs or, try installing GIMP: sudo apt-get install gimp. It's a photoshop clone and will let you modify the images with filters, etc.)
  • Change some of the rules of the game
  • Make new levels. Edit starPusherLevels.txt to do this. See if you can figure out how to jump to a specific level.

Some reminders:

  • If you want to undo your changes permanently, type: git reset --hard
  • You can make new branches for different hacks! But you should git checkout master first, so the branch is off oc master, not your hackity hack.
  • To merge changes back in (to combine image and frame rate hacks, for instance)
  • Commit early and often. You can then git reset {commit ID} to undo those commits and re-commit them more intelligibly.

Assignment

Due Weds, but totally doable today: A post showing some of the hackity hacks you've made. Screenshots & code. Bonus points for walkthrough-quality work.

If we get to it: Contributor Guidelines

We need contributor guidelines for our class site. Who can contribute? What requirements do we place on them? Once we have these guidelines, we'll make everyone in class a committer to the repo!

Elliott Hauser is a PhD Student in information science at UNC Chapel Hill. He's hacking education as one of the cofounders of Coursefork.org. Find Elliott Hauser on Twitter, Github, and on the web.
comments powered by Disqus