June 23, 2009 by mattalui
So we decided to go from a number guessing game to an animal guessing game. We wanted it to be somewhat like 20 questions. The computer is supposed to guess the animal you are thinking of. We needed to figure out how the computer will know which animal you are thinking by the questions it asks. So we started working on classes and sub-classes.
We broke animals into two basic groups-vertebrate and invertebrate. Then we broke that into Mammels, fish, etc.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
'''Animal types.'''
class Animal:
'''A Base Animal type.'''
class Vertebrate(Animal):
'''An Animal with a backbone.'''
def has_backbone(self):
return True
class Invertebrate(Animal):
'''An Animal without a backbone.'''
def has_backbone(self):
return False
class Fish(Vertebrate):
'''A Vertebrate with no fur.'''
def has_fur(self):
return False
class Mammal(Vertebrate):
'''A Vertebrate with fur.'''
def has_fur(self):
return True
class Human(Mammal):
'''vertebrate with fur.'''
class Lion(Mammal):
'''vertebrate with fur'''
class monkey(Mammal):
'''vertebrate with fur'''
class jellyfish(invertebrate):
'''not sure, but cool'''
class bear(Mammal):
'''hairy monster!!!'''
class Matt(vertebrate):
'''We're not sure exactly...'''
|
Posted in Uncategorized | Leave a Comment »
April 4, 2009 by mattalui
I have finally written my first game. It is not the funnest game you will ever play. It is a simple number guessing game. I made it because my brother said “It’s just a few easy lines of code”. It turned out to be a two-and-a-half-day project. We started out with learning the raw_input builtin. That made a few things MUCH easier. Then we added a few if statements to tell you whether you should guess higher or lower or you got it right. When we finally figured all of that out we decided to put in a loop so that you don’t have to keep running the code until you got it right. We used a while loop and talked about the differences between the while loop and the for loop. When we figured that out then we had to do a lot of editing because my indentions suck so it was causing problems with the code. Then we noticed that it didn’t tell you when you won, it just stopped. So we fixed that by taking the if statement out of the loop and put it after the loop. Now it works!
import random
compnumber = random.randint(1, 100)
usrnumber = 0
while usrnumber != compnumber:
usrnumber = raw_input(‘Your number please:’)
usrnumber = int(usrnumber)
if usrnumber > compnumber:
print “Too high!”
if usrnumber < compnumber:
print “Not quite high enough…”
if usrnumber == compnumber – 1:
print “So close…”
if usrnumber == compnumber + 1:
print “So close…”
print “Yay! You did it!”
Posted in Uncategorized | Leave a Comment »
January 5, 2009 by mattalui
So we have recently upgraded my laptop (even though it is still a slow piece of crap) and during that process we ran into some technical difficulties. For some reason the new upgrade changed my mouse pad settings. It had turned it off.(Of course at the time we didn’t know it was that simple). So we tried to plug in an external mouse and that worked so for a while I just used that. Then for a cure we switched me from Gnome to Xfce. I was on that for a while. One day my computer was being really slow so i rebooted it. When i logged back in i had no task bar. So i was without internet for a while and then i got idea. If I could get an external mouse then i could log back into Gnome and change my settings from there and log out then log back into Xfce then my internet would work again. I couldn’t find a mouse so I stole the one from off of my dad’s computer. Curiosity got the best of me and i went into my mouse settings to see if there was anything i could do in there to help my mouse problem. So I disabled the mouse pad then turned it on again and it worked. I was so relieved. I don’t much like Xfce as much as I like Gnome. Of course I had to hide while my dad tried to figure out what was wrong with his mouse. At least now my computer is back to normal again.
Tags: Xfce Gnome mouse troubles broken bad internet connection laptop upgrading
Posted in Uncategorized | Leave a Comment »
June 7, 2008 by mattalui
So I recently finished chapter two of my book. This is the chapter where things are starting to get a little more complicated.
I have been learning about boolean logic, statements, and operators. It’s pretty much a lot tougher now. But the cool thing is I’m actually writing stuff that looks like python now. It’s a lot more lengthy. It’s not just the simple stuff I used to do, like making strings and adding them together.
It’s especially cool cause In the Python in Practice section of the book we actually wrote a program that makes a bunch of tanks fight each other. I changed the numbers around a little so that the tank Bob would win.
I also wrote a little program that would pretty much do the same thing as rolling a die. It would randomly pick a number from one through 6. Yet again I played with the numbers a little so that it would randomly pick a number one through 100.
That’s pretty much everything I’ve been doing. I change a lot of the code around so I can learn it better. If I didn’t I would probably drive my self crazy with the word FUGU!
Posted in Uncategorized | 3 Comments »
June 5, 2008 by mattalui

Okay so today I started working on making a game with my brother. It’s fairly easy, except for some of the little details. It is going to be a game we make using python. We’re using a book to help me start learning python. It’s called Beginning Game Development with Python and Pygame.
So today by brother quizzed me on chapter one. It was pretty easy. Then we started chapter two. That’s when all the problems started. I was having problems with extra spaces at the end of the things that you can’t even see when the books give you examples of what it looks like. But it’s okay.
I learned about loops. We also talked about the differences between lists and tuples. Tuples load faster, but are immutable. It is pretty much cool!
Posted in Uncategorized | 1 Comment »