Monday, April 28, 2008

Quest Project

Today we begin really working on our games. You will each be creating your own game. You will be able to converse and help each other with different aspects of the game, but I expect all coding to be typed yourself, you may NOT copy and paste any code from someone else's project.

Here are the basic requirements:

Each game needs to have at least 25 different rooms.
You need to add each of these commands:
  • Drop
  • Stats
  • Help
  • At least two special commands for your game (use, read, equip, kiss, etc)
All new methods need to have your own comments, with your initials. If you got a lot of the code from another person, you need to give them credit in the comment.
Your game needs to have an objective, a way to win and a way to lose.
When you turn in the project you will need to turn in a walk-through to explain every aspect of the game as well.

There will likely be more points added here at a later time as well.

Thursday, February 21, 2008

Chapter 4 Exercises

We are going to start class with a little quiz. Please open up notepad. I will be blocking all programs other than notepad before the quiz.

After that will we be looking at some of the exercises for chapter 4 together.

Go to this page:
http://openbookproject.net/thinkCSpy/chap04.xhtml

Scroll to exercise 3. We will do this together. Afterwards, we will work through 4, 6, 7, 8, and 9.

Assignments

You have two programs that you have been working on. Please save them into the assignments folder. Name them '[name] - numbers.py' and '[name] - gasp.py' in the folders 'NumberTest' and 'GaspPicture'.

Thursday, February 14, 2008

Today

You should be basically done with the chapter 2 exercises, if not you need to finish them today. Once you have completed them, please help others that are having trouble, or move on to chapter 3 read through the chapter again, and begin working on the exercises.

Tuesday, February 12, 2008

Firefox!

You should now all have access to Firefox Portable from your start menu. Please use this now as your web browser for this class. It will give you access to the new, improved "How to Think Like a Computer Scientist". Please load firefox, then load this page and click the link on the side. Go to chapter 2.

Skim down to the bottom and look at section 2.13 I would like you to complete the exercises listed there and record your results in a text document. Save the document as 'Chapter2Exercises - Name.txt'. Also create the file 'madlib - name.py' as directed by the page. Save each of these files into the Python Assignments folder.

Monday, January 07, 2008

Meeting the Python

Welcome to Computer Programming class. I'm looking forward to working with each of you as you learn to understand your computer better and learn to tell it what you want it to do! We will be working with a few different resources as we learn to program. Much of our time will be spent working on projects, but we will also spend a portion of each day discussing a new topic. You will need to come to this site each day as the first thing in order to get your instructions. This page will also be my way of giving you links to certain sites.

On the side you see a few links to the web-based texts we will be using.

One of your major assignments each day will be to post an entry on your own blog page. As such the first thing you need to do today is to create your own page. If you already have a blog, that is fine, but for this class all of your posts need to deal with programming class. The easiest thing is for you to create another blog for this class. You can go to blogger.com to set up your own blog. Please do that now, then click on the comment link on this page and give me your address and name. I will be adding a link to your blog on this page and I will be checking it each day to see that you have posted and to see what you are struggling with or enjoying about the day's lesson. You will be required to post each day!

Once you have created your page and commented here with your link, please click on the link: How To Think Like a Computer Scientist and read the first chapter. Create your first post discussing the things you learned in the reading.

Saturday, May 26, 2007

Final Grading

I've finished grading your programs. I posted comments on each of your sites with my comments about your games. I enjoyed many of the games, some will only take minor work to have them running well!

Thursday, April 12, 2007

Card Game

Welcome back Val and Sam! Please get your program updated from one of the others. Make sure that you know how it works as well.

So far we have created three classes:
Card
Deck
Hand

In order to recognize which hand is which, we should add a name attribute to the Hand class that stores the name of the player. This should also be added as part of the initialization.

We now need to create a new string function for the Hand class that prints the name and the cards.

Now we need to create a new class that brings them all together:
class Game():

The initialization should take a list of names, then create a hand for each of these names.
It should also create a deck of cards, then remove the Queen of Clubs from the deck.

Now create a play method that starts by shuffling the deck of cards, then deals all the cards out evenly.

Do as best you can, we'll work with them more on Monday.

Thursday, March 01, 2007

Parsing a String

Create a program that takes input from the user and converts it into a list with a string for each word in the input.

The program should then print each word on a separate line in reverse order.

Next the program asks for a single word.

Check to see if this new word occurred in the original list of words. Print a message telling whether the word given was valid or not.

Now join all the words from the original input with an underscore between them and print that string.

Wednesday, February 07, 2007

Fruitful Functions

You need to create a program that calculates the Area of any given shape.

The program should give the user a list of possible shapes:
Rectangle, Parallelogram, Triangle, Circle, Square, and Trapezoid.

Then you will need to ask for the dimensions of the figure and calculate the area.

You should create functions for each of the different shapes. These functions should have parameters for each of the dimensions of that shape.

We will be talking about the process for each of these things at the beginning of class.

Friday, February 02, 2007

Programming Assignment #1

Splash Screen

For your assignment today I'd like you to create a program that prints a splash screen (welcome screen). It should be at least 12 lines, though it can also include a couple blank lines. Try to make this welcome screen somewhat graphical and not just text (use symbols to draw it).

A splash screen is what appears on the screen as the computer loads a program. It should be a few strings that all appear at the same time. This can be done either with a multi-line string, or with multiple print statements.

Friday, January 19, 2007

Circumnavigation

Today you should be finishing Step 13. Guido is supposed to circumnavigate a rectangle, then an irregular polygon. Both of these should be done with a while loop that is looking for Guido's starting location (a beeper that he drops at the beginning). They should take about 8 and about 12 lines respectively. When you are done with the irregular polygon talk to Travis have him make sure you are doing it properly, then you can move on to Step 14.

Don't forget to post to your blog!

Monday, January 15, 2007

Guido's Birthday

To celebrate his 18th birthday Guido displays 10010 (18 in binary). We are going to attempt a race to see who can tell Guido to display '1010000110110' in the most efficient way.

Community Service


Guido cleans the street. He should be able to clean the street with the same program even with different amounts of garbage. I will give you a couple of different worlds to work with and clean.

Tuesday, January 02, 2007

Welcome to Computer Programming!


Welcome to class! Computer Programming will be a great time to learn. We will be learning new problem solving techniques and new ways to look at problems. We will also be learning a new language with its own grammar and syntax. We will have a lot of fun, and be challenged in many ways!
Course Syllabus

  1. Content
    • How to Think Like a Computer Scientist
    • A Byte of Python
  2. Prerequisites
    • Keyboarding class (or ability to type 25 wpm)
    • Computer Applications
    • Algebra 1 & Geometry
  3. Course Goals
    • To learn the concepts and methodologies of structured computer programming.
    • To become familiar with Python.
    • To analyze problems and learn to think like a computer programmer.
  4. Course Outline
    • Weeks 1-3 Introduction
      • Understanding the thought process behind program creation
    • Weeks 4-9 Python
      • Variable, Functions, Conditionals, and Recurrsion
      • Strings, Lists, and Tuples
    • Weeks 10-18 Python
      • Object-Oriented Programming
      • Classes, objects, functions, and methods
      • Linked Lists and Stacks
  5. Grading Criteria
    • Online Journal -- 40%
    • Assignments -- 40%
    • Quizzes -- 10%
    • Final Project -- 10%

First Assignment

For this class you will need to create a blog site. On this site you will be posting a short journal entry during each class discussing things you have learned or are struggling with. You can also post about the project you are working on and difficulties you are having with it. This journal will be a large portion of your grade (40%). It does not need to be a huge task each day, but I want to be able to see how you are doing and what you are struggling with.

The blog you create needs to be solely used for this class. Be sure that you enable comments for registered users so I can comment on your posts and give you pointers.

Also, once you have created your site, comment on this post and give me the website of your blog. I will be adding links to each of your sites.

To create the page, click on the link at the top of this page "Get your own blog".

Monday, April 17, 2006

Quest Game Tasks



This week we will be working on multiple tasks to work to improve the controls and to make sure we understand the quest file.

Before we get started I want to look at the restrictions() method.

Task 1:


Edit the go() method to work for movement in all directions (north, south, east, west, up, and down).

Task 2:


Create your own world. It needs to contain 5 rooms and at 4 items. The player should be able to navigate around. These do not need to be part of your final game, just a basic world for practice.

Task 3:


You need to add a "Drop" command for dropping items from your inventory into the room.

Task 4:


You need to add a "commands" command for listing all legal commands. It should list only the primary commands and not all the variations.

You should have all of these tasks completed by the end of the week! On Friday we will be able to begin work on your actual projects.

Tuesday, April 04, 2006


def findspot(self,num,array,low,high):
mid=(low+high)/2
if high==low:
if num>array[low]:
return high
else:
return low
else:
if num return self.findspot(num,array,low,mid)
elif num>array[mid]:
return self.findspot(num,array,mid+1,high)
else:
return mid

def sort(self):

items = self.cards
sorts=[Card(),Card()]
done = 0
for i in items:
if done == 0:
sorts[0]=i
else:
spot=self.findspot(i,sorts,0,done)
sorts[spot:spot]=[i]
done=done+1
self.cards = sorts[:len(sorts)-1]

Wednesday, March 08, 2006

For today's project you need to create a function that takes an input of a string and a list. The list should contain all valid commands. The string is an input from the user. The function should return True if one of the words is in the commands list and False if it is not.

Create a test program with a list of commands.

bob

Friday, February 24, 2006

I'd like you to continue to work on the program from yesterday. If you have completed the basic form of it, work on adding a while loop to allow you to repeat. DO NOT USE RECURSION! If you are having trouble with any part, ask your classmates for help. Travis has already completed this using a while loop.

There is a discussion of the while loop in chapter 6 of BoP.

If you get this done, read the end of chapter 5 in HtTLaCS. Starting at 5.6. These talk about recursion and calculations. They give a couple of great examples of recursion. Section 5.8 gives us a great way to make sure the input for a function is correct. Now we can use this statement with any input to be sure that we are getting an integer. We can compare the type to the type of an integer. This doesn't affect this program as much, but can be very useful at a later time.

The OFFICIAL Dilbert Widget