COSC 250 SP2015

Broken Snake Code

from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from random import randint window = 0 width,height = 500,500 field_width, field_height = 50,50 snake = [(20,20)] snake_dir = (1,0) interval = 200 food = [] def refresh2d_custom(width,height,…Continue Reading →

Graphics Games with Python

1. Graphics.py reference – http://mcsp.wartburg.edu/zelle/python/graphics/graphics/graphics.html 2. Snake Tutorial (note: we will be modifying this): http://noobtuts.com/python/snake-game 3. PyOpenGL –  http://pyopengl.sourceforge.net/  (file needed)  

Final Project

Your final project will consist of an adventure game written in Python. The game may either use simple graphics or text based interactions. Your game should consist of a basic game engine that can read and interpret user input and…Continue Reading →

in Class Code 4-16-15

Compound Interest Graph: from graphics import * def main():     print(“This program plots the growth of a 10-year investment.”)     principal = eval(input(“Enter the initial principal: “))     apr = eval(input(“Enter the annualized interest rate: “))     win = GraphWin(“Investment…Continue Reading →

Graphics Py File

http://mcsp.wartburg.edu/zelle/python/   http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/   from graphics import * def main(): win = GraphWin(“Click Me!”) for i in range(10): p = win.getMouse() print(“You clicked at: “, p.getX(), p.getY()) main()

In Class Code 3-26-15

#def main(): #sayHello() # temp() #def temp(): # print(“Sure is hot in here”) #def sayHello(): # print(“Hello class!”) #Old MacDonald Game def main(): animals = [“cow”, “chicken”, “pig”, “horse”] sounds = [“moo, moo”, “cluck, cluck”, “oink, oink”, “neigh, neigh”] num…Continue Reading →

Homework 4

Create several small programs that answer the following questions: 1. Question One Read a nonnegative integer N (range 0 to 20) and print the powers of 2 from 1 to 2N. You do not need to validate that the integer is…Continue Reading →

In Class Code 3/12/15

#if eyecolor == “brown”: # if haircolor == “brown”: # print(“Wave your hands”) # elif haircolor == “blond” # print(“Jump up and down”) # else # print(“Do a dance”) #elif eyecolor == “green” #import math #def main(): # print(“This program…Continue Reading →