MLTI

 

MLTIlogo

Here are some links to go with the May 16, 2013 MLTI presentation entitled Under the Hood.

 Under the Hood: The Terminal Application and Game Design Using Python (v2.0)

Location: Neville 100
 
George Markowsky (School of Computing & Information Science, UMaine)
 Are you interested in unleashing the full power of your computer? Then you need to know about the Terminal Application and some of the goodies that it provides access to. One of these goodies is the programming language Python which is a commercial grade programming language used widely in applications. It is also named after Monty Python’s Flying Circus. We will show how to use Python to create a simple game using incremental development. The knowledge you will gain from this session can help you get the most from your computer. (Repeat of popular session offered last year)

Wikipedia Article on Unix

Wikipedia Article on Unix Utilities

Wikipedia Article on Apple OS X

Wikipedia Article on the Text Editor nano

Link to official nano site

Wikipedia Article on Python

Link to Python.Org

A link to the COS 125 course which features an introduction to Python programming and game design. This has links to useful, free textbooks about Python.

GuessNumber01.py

# This game has the computer guess a number and
# then the computer challenges you to guess the number.

# This is version 1

print "DONE"

GuessNumber02.py

# This game has the computer guess a number and
# then the computer challenges you to guess the number.

# Version 1 got us started

# In version 2 the computer actually picks a number and
# lets us guess.

ComputerGuess = 3

YourGuess = input("Please enter your guess. ")

if ComputerGuess == YourGuess:
    print "Congratulations"
else:
    print "Sorry"

GuessNumber03.py

# This game has the computer guess a number and
# then the computer challenges you to guess the number.

# Version 1 got us started

# In version 2 the computer actually picks a number and
# lets us guess.

# In Version 3 the computer will produce different guesses.

import random

ComputerGuess = random.randint(1,10)

YourGuess = input("Please enter your guess. ")

if ComputerGuess == YourGuess:
    print "Congratulations"
else:
    print "Sorry, the correct answer was",ComputerGuess

GuessNumber04.py

# This game has the computer guess a number and
# then the computer challenges you to guess the number.

# Version 1 got us started

# In version 2 the computer actually picks a number and
# lets us guess.

# In Version 3 the computer will produce different guesses.

# Version 4 permits 3 guesses

MaxGuesses = 3

import random

ComputerGuess = random.randint(1,10)

Guessed = False
NumGuesses = 0

while (not Guessed) and (NumGuesses < MaxGuesses):

    NumGuesses = NumGuesses + 1
    YourGuess = input("Please enter your guess. ")

    if ComputerGuess == YourGuess:
        print "Congratulations"
        Guessed = True
    else:
        print "Sorry, guess again."

GuessNumber05.py

# This game has the computer guess a number and
# then the computer challenges you to guess the number.

# Version 1 got us started

# In version 2 the computer actually picks a number and
# let's us guess.

# In Version 3 the computer will produce different guesses.

# Version 4 permits 3 guesses

# Version 5 gives hints

MaxGuesses = 3

import random

ComputerGuess = random.randint(1,10)

Guessed = False
NumGuesses = 0

while (not Guessed) and (NumGuesses < MaxGuesses):              NumGuesses = NumGuesses + 1     YourGuess = input("Please enter your guess. ")     if ComputerGuess == YourGuess:         print "Congratulations"         Guessed = True     else:         if YourGuess > ComputerGuess:
            print "Sorry, too high. Guess again."
        else:
            print "Sorry, too low. Guess again."

if not Guessed:
    print "The correct answer is",ComputerGuess