Friday, July 31, 2015

Flappy Bird Code

Here is a link to download the code for Flappy Bird that we finished today:
Download

Introduction to Python Packet

Here is the link to a pdf of our Introduction to Python Packet, which we used throughout the week.
Link

Thursday, July 30, 2015

Deck class - 7/30

Here is the code for the Deck class and Card class that we wrote today during class:

import random

class Card:
    def __init__(self, card_suit, card_number):
        self.suit = card_suit
        self.number = card_number

class Deck:
    def __init__(self):
        self.deck = []
        for x in range(1, 14):
            self.deck.append(Card("hearts", x))
            self.deck.append(Card("diamonds", x))
            self.deck.append(Card("spades", x))
            self.deck.append(Card("clubs", x))
        self.shuffle()
    def draw_card(self):
        x = self.deck.pop(0)
        return x
    def shuffle(self):
        random.shuffle(self.deck)
       
myDeck = Deck()
for x in myDeck.deck:
    print str(x.number) + " of " + x.suit

Sunday, July 26, 2015

Instructions For Mac OS X

Mac installation should be fairly straightforward. Python 2.7 will comes pre-installed on Mac OS X machines. If you are running Mac OS X 10.6+ (Lion, Mountain Lion, or Yosemite), use this link. Otherwise use this link. Install the pygame package that is included in the package you downloaded and you should be good to go!

Friday, May 22, 2015

Downloads For Windows

Hi!

Here are some things you will need to download for the Python class at the Math Science Nucleus!
Please install both Python and Pygame using the installers found in the downloads below:

Edit: If you had trouble using Pygame with the 64 bit Python installation, try downloading using the below link instead.

Python 2.7 & Pygame download bundle:
For Windows