Posts tagged with programming - Gameful

Just Playing with some game code

May 7, 2011 at 12:11 pm in post by Liam Boyle

Well, I’ve finished reading through “How to Think Like a Computer Scientist,” and I think I’m getting a pretty good handle on the python programming language.  I still need to do a lot more work on GUI and I need to start figuring out graphics and sound.  Anyway, I sat down yesterday with the PyGame tutorial (yes, I know it’s actually written for kids but hey that just makes it easy to follow), and the first few program examples are straight out of the tutorial, but the Math Tutor I didn’t draw from the tutorial even though I think there might be something similar in it.

#————-
# Name:        Guess The Number from PyGame Tutorial
# Purpose:      Learning to program
#
# Author:      Liam P Boyle
#
# Created:     05/05/2011
# Copyright:   (c) Liam P. Boyle 2011
# Licence:     <your licence>
#————-
#!/usr/bin/env python

def main():
    ## This is a guess the Number game

    import random

    guessesTaken = 0

    print (“Hello, what is your name?”)
    myName = input()

    number = random.randint(1,20)
    print (“Well, ” + myName + “, I am thinking of a number between 1 and 20.”)
    while guessesTaken < 6:
        print (“Take a guess”)
        guess = input()
        guess = int(guess)
        guessesTaken = guessesTaken + 1
        if guess < number:
            print(“Your guess is too low”)
        if guess > number:
            print(“Your guess is too high”)
        if guess == number:
            break
    if guess == number:
        guessesTaken = str(guessesTaken)
        print (“Good Job ” + myName + “! You guessed my number in ” + guessesTaken + ” tries.”)
    if guess != number:
        number = str(number)
        print (“No.  The number I was thinking of was ” + number)

if __name__ == ‘__main__’:
    main()
## End

Just for fun (Yes, I remember the Zork games and choose your own adventure books)

#————-
# Name:        Dragon Realm from the PyGame tutorial
# Purpose:      Learning to program
#
# Author:      Liam P Boyle
#
# Created:     06/05/2011
# Copyright:   (c) Liam P Boyle 2011
# Licence:     <>
#————-
#!/usr/bin/env python
#————-

## Import Statements

import random
import time
##————-

## Global Variable Initializatins and Function definitions

def displayIntro():
    print (“You are on a planet full of dragons.  In front of you,”)
    print (“you see two caves.  In one cave the dragon is friendly”)
    print (“and will share his treasure with you.  The other dragon”)
    print (“is greedy and hungry, and will eat you on sight.\n”)

def chooseCave():
    cave = “”
    while cave != “1″ and cave != “2″:
        print (“Which cave will you go into (1 or 2)”)
        cave = input()

    return cave

def checkCave(chosenCave):
    print (“You approach the cave…”)
    time.sleep(2)
    print (“It is dark and spooky…”)
    time.sleep(2)
    print(“A large dragon jumps out in front of you!  He opens his jaws and…”)
    print()
    time.sleep(2)
    friendlyCave = random.randint(1,2)
    if chosenCave == str(friendlyCave):
        print(“He gives you his treasure.”)
    else:
        print(“He gobbles you up!”)
#————-

## Main Program Logic
def main():
    playAgain = “yes”
    while playAgain == “yes” or playAgain == “y”:
        displayIntro()
        caveNumber = chooseCave()
        checkCave(caveNumber)
        prompt = “Do you want to play again: yes/no?”
        playAgain = input(prompt)

if __name__ == ‘__main__’:
    main()
##End
#————-

And finally, my own work:

#——————————————————————————-
# Name:        Math Tutor pre-K
# Purpose:      help children learn addition and subtraction
#
# Author:      Liam P. Boyle
#
# Created:     06/05/2011
# Copyright:   (c) Liam P. Boyle 2011
# Licence:     <freeware w/ author attribution>
#——————————————————————————-
#!/usr/bin/env python

##Import Statements
import random
#——————————————————————————-

def greeting():
    print (“What is your name?\n”)
    plyrName = input()
    print (“Hello, ” + plyrName + “, would you like to add and subtract?\n”)
    print (“Enter y for yes or n for no\n”)
    playAns = input()
    return playAns

def selectMode():
    ModeNum = random.randint(0,1)
    return ModeNum

def additionPractice():
    tries = 1
    num1 = random.randint(0,5)
    num2 = random.randint(0,5)
    answer = num1 + num2
    while tries <= 3:
        print (“What does “, num1, ” plus”, num2, “equal?\n”)
        plyrAnswer = int(input())
        if plyrAnswer == answer:
            break
        else:
            print(“That isn’t correct.  Please try again\n”)
        tries = tries +1
    if plyrAnswer == answer:
        print(“Great Job!!!”)
    else:
        print(“The correct answer is:  “, answer)

def subtractionPractice():
    tries = 1
    num1 = random.randint(0,5)
    num2 = random.randint(0,5)
    if num1 < num2:
        num1, num2 = num2, num1
    answer = num1 – num2
    while tries <= 3:
        print (“What does “, num1, ” minus”, num2, “equal?\n”)
        plyrAnswer = int(input())
        if plyrAnswer == answer:
            break
        else:
            print(“That isn’t correct.  Please try again\n”)
        tries = tries +1
    if plyrAnswer == answer:
        print(“Great Job!!!”)
    else:
        print(“The correct answer is:  “, answer)

def main():
    playAns = greeting()
    while playAns == “y”:
        switch = selectMode()
        if switch == 0:
            additionPractice()
        else:
            subtractionPractice()
        print (“Do you want to play some more?\n”)
        print (“Enter y for yes or n for no”)
        playAns = input()

if __name__ == ‘__main__’:
    main()
## End

I would like to think that I’m getting better at this :)

Liam B

Semi-random thoughts 5/1/2011

May 1, 2011 at 11:57 am in post by Liam Boyle

For weeks I’ve been thinking of writing a continuation to my Hamilton’s rule blog post and how to write an indexing variable to compute emotive relatedness.  However, that is still very much a work in progress and I should try and turn the original post into a formal proof with some of the additional work I have done expanding upon it.

Yet, it really is time to lower my aim for a bit.  I just finished my programming logic course and I’m hoping that financial aid will kick in in time for me to take C++ programming over the summer.  Anyway, I got to looking at some of the material in my course text book, and there’s a section at the end of each chapter called “Game Zone” with small projects for logical game design.  The first of these was to design a simple MadLib type program that prompts the user to enter some words and then puts them into a short story or rhyme.  So I fired up my copy of portable PyScripter (it runs off a usb flash drive) and here’s what I came up with:

## Attempt at Mad Lib Program
## Liam Boyle

## Mainline Program
quit = “n”
##Inputting the words
while quit != “y”:
    prompt = “Please enter the name of a color:\n”
    wordA = input(prompt)
    prompt = “Please enter a noun:\n”
    wordB = input(prompt)
    prompt = “Please enter a number:\n”
    wordC = input(prompt)
    prompt = “Please enter another noun:\n”
    wordD = input(prompt)
    wordE = input(prompt)
    prompt = “Please enter an adjective:\n”
    wordF = input(prompt)
    prompt = “Please enter a place:\n”
    wordG = input(prompt)
    print (“\n”, “\n”, “\n”, “Baa Baa “, wordA, ” sheep,\n”,
        “Have you any “, wordB, “?\n”, “Yes sir, yes sir,\n”,
        wordC, ” bags full;\n”, “One for the “, wordD, “\n”,
        “And one the the “, wordE, “\n”, “And one for the “, wordF,
        ” boy\n”, “Who lives down the “, wordG, “.\n”)
    ## mainline finished, continue question
    prompt = “Do you wish to quit y/n?\n”
    quit = input(prompt)

## End program

The data formatting could be better, and I still haven’t gotten to how to develop a GUI but it works and we have a MadLib style version of “Baa, Baa, Black Sheep.”  It then occurred to me, that this could be a great learning tool for young children to develop language skills.  Provided I can come up with the right graphic interface and a “bank” of rhymes to draw from, this could be a really good educational game.  The same basic I/O format could also be used form simple math problems and puzzles.  Therefore, it might be beneficial form to to work on developing some simple educational games over the summer for the Pre-K, kindergarten, to 1st grade range.  (Which coincidentally would be precisely my son’s educational level.)  Unfortunately I missed the deadlines for this year’s Google Summer of Code, but there’s always the next.

End of thoughts for today.

Liam B

Random Thoughts, programming in Python 3.x, and where the heck to go from here

Apr 12, 2011 at 10:47 am in post by Liam Boyle

I mentioned before in my blog that I do not yet have any formal collegiate training in any programming language.  This semester at the community college I took my first programming class which is simply a course in programming logic that works mainly in pseudocode.  Apparently flowcharts are so out of date that I’m a relic for using them, as if I wasn’t enough of a relic for remembering my father trying to program his dang Times Sinclair computer when I was a child. 

However, since pseudocode by it’s very nature cannot be made to pass the “does it work” test I’ve tried to self-teach two languages to myself during the course of this class:  first, JustBASIC and now Python 3.x.  I was doing some research on computer languages early in the term to see what it might be useful for me to take in future semesters, and found out Python was made language of the year by the TIOBE index, twice (2007 & 2010).  Also, as I have mentioned in another post the Panda 3D game engine works with a combination of Python and C++

Well, to get a grasp of programming in Python I went to MIT opencourseware and downloaded the .pdf of the text book they are using, “How to Think Like a Computer Scientist.”  (Ah, open course ware – knowledge free for the sake of knowledge.)  I also translated my homework assignments that had been completed in JustBASIC into Python.  I was using Python 3.13 and then I downloaded “Portable Python” which is supposed to be able to run off a memory stick or USB flash drive and came with the PyScripter IDE, so that is what I am currently using.  (Can somebody come out with a newer version for Python 3.2 please?)

Anyway, doing this gave me the following programs:

in JustBASIC -
REM Program To Display Student Data
REM LIAM BOYLE
REM 15 FEB 2011

REM Variable Declarations
REM IDNumber    num
REM FirstName$  string
REM LastName$   string
REM Major$      string
REM GPA         num

print “Enter ID, FirstName, LastName, Major and GPA…”
Input IDNumber
Input FirstName$
Input LastName$
Input Major$
Input GPA
If GPA <= 2.0 then
    print IDNumber
    Print FirstName$
    Print LastName$
    Print Major$
    Print GPA
else
    REM don’t print
end if


In Python 3.x –
#Program To Display Student Data
#Assignment 4 part a #in Python 3.x#
#Liam Boyle
#03 Apr 2011

#Variable Declarations
#IDNumber   integer
#FirstName  string
#LastName   string
#Major$     string
#GPA        float

prompt = “Enter ID number”
IDNumber = input(prompt)
prompt = “Enter first name”
FirstName = input(prompt)
prompt = “Enter last name”
LastName = input(prompt)
prompt = “Enter major course of study”
Major = input(prompt)
prompt = “Enter Grade Point Average”
GPA = input(prompt)
GPA = float(GPA)

if GPA <= 2.0:
    print (IDNumber)
    print (FirstName)
    print (LastName)
    print (Major)
    print (GPA)

In JustBASIC –
REM Program To Display Student Data
REM LIAM BOYLE
REM 15 FEB 2011

REM Variable Declarations
REM IDNumber    num
REM FirstName$  string
REM LastName$   string
REM Major$      string
REM GPA         num
REM ContinueAns$   string

Let ContinueAns$ = “Y”

While ContinueAns$ = “Y”
    Print “Enter ID, FirstName, LastName, Major and GPA…”
    Input IDNumber
    Input FirstName$
    Input LastName$
    Input Major$
    Input GPA

    If GPA < 2.0 then
        print IDNumber
        Print FirstName$
        Print LastName$
        Print Major$
        Print GPA
    End If

    Print “Do you want to Continue Y/N”
    Input ContinueAns$
Wend

In Python 3.x –
#Program To Display Student Data
#Assignment 4 part b #in Python 3.x#
#Liam Boyle
#03 Apr 2011

#Variable Declarations
#IDNumber   integer
#FirstName  string
#LastName   string
#Major$     string
#GPA        float

ContinueAns = “y”

while ContinueAns == “y”:
    prompt = “Enter ID number\n”
    IDNumber = input(prompt)
    prompt = “Enter first name\n”
    FirstName = input(prompt)
    prompt = “Enter last name\n”
    LastName = input(prompt)
    prompt = “Enter major course of study\n”
    Major = input(prompt)
    prompt = “Enter Grade Point Average\n”
    GPA = input(prompt)
    GPA = float(GPA)
    #————-
    if GPA <= 2.0:
        print (IDNumber)
        print (FirstName)
        print (LastName)
        print (Major)
        print (GPA)
    prompt = “Do you want to continue y/n \n”
    ContinueAns = input(prompt)


In JustBASIC –
REM Program To Display Student Data
REM LIAM BOYLE
REM 15 FEB 2011

REM Variable Declarations
REM IDNumber    num
REM FirstName$  string
REM LastName$   string
REM Major$      string
REM GPA         num

Print “Enter ID, FirstName, LastName, Major and GPA…”
Input IDNumber

While IDNumber > 0
    Input FirstName$
    Input LastName$
    Input Major$
    Input GPA

    If GPA < 2.000 then
        Print “Under 2.0″
        Print IDNumber
        Print FirstName$
        Print LastName$
        Print Major$
        Print GPA
    Else
        If GPA >= 3.5 and Major$ = “English” then
            Print “Literary Honors Society”
            Print IDNumber
            Print FirstName$
            Print LastName$
            Print Major$
            Print GPA
        End If
    End If

    Print “Enter ID, FirstName, LastName, Major and GPA…”
    Input IDNumber
Wend

In Python 3.x -
#Program To Display Student Data
#Assignment 4 part b #in Python 3.x
#Liam Boyle
#03 Apr 2011

#Variable Declarations
#IDNumber   integer
#FirstName  string
#LastName   string
#Major$     string
#GPA        float

ContinueAns = “y”

while ContinueAns == “y”:
    prompt = “Enter ID number\n”
    IDNumber = input(prompt)
    prompt = “Enter first name\n”
    FirstName = input(prompt)
    prompt = “Enter last name\n”
    LastName = input(prompt)
    prompt = “Enter major course of study\n”
    Major = input(prompt)
    prompt = “Enter Grade Point Average\n”
    GPA = input(prompt)
    GPA = float(GPA)
    #————-
    if GPA <= 2.0:
        print (IDNumber)
        print (FirstName)
        print (LastName)
        print (Major)
        print (GPA)
    else:
        if GPA >= 3.5 and Major == “English”:
            print (“Literary Honors Society”)
            print (IDNumber)
            print (FirstName)
            print (LastName)
            print (Major)
            print (GPA)
    prompt = “Do you want to continue y/n \n”
    ContinueAns = input(prompt)

In JustBASIC -
REM Program for outputting even numbers from 2 to 30
REM Liam Boyle
REM CIS 120

REM Declaration
REM VariableNumber Integer

For VariableNumber = 2 to 30 step 2
    Print VariableNumber
Next VariableNumber
End

In Python 3.x -
for varNum in range(2,32,2):
    print(varNum)


In JustBASIC -
‘ Assignment 8, Bubble Sort
‘ Liam Boyle
‘ CIS 120
‘ 4/3/11

‘ Mainline
    gosub [Housekeeping]
    gosub [SortRoutine]
    gosub [MeanCalculation]
    gosub [MedianCalculation]
    gosub [Cleanup]
end
‘——————————-

[Housekeeping]
    Print “How many values do you need to enter?”
    Input ListElements
    Dim sortvalues(ListElements)
    Let LastElement = ListElements – 1
    cls
    For x = 0 to LastElement
        print “Enter a value to sort”
        input value
        sortvalues(x) = value
    next

print “UnSorted List”
for x = 0 to LastElement
    print sortvalues(x)
next
return
‘——————————-

[SortRoutine]
    Let x = 0
    Let ValuesSwitched$ = “y”
    While ValuesSwitched$ = “y”
        Let ValuesSwitched$ = “n”
        For x = 1 to LastElement
            if sortvalues(x) < sortvalues(x-1) then
                gosub [SwitchValues]
            end if
        Next
    Wend
return
‘——————————-

[MeanCalculation]
MeanValue = 0
For count = 0 to x
    MeanValue = MeanValue + sortvalues(count)
Next count
MeanValue = MeanValue/(count+1)
return
‘——————————-

[MedianCalculation]
    Let MedianCount = Int(LastElement/2)
    If LastElement/2 = MedianCount Then
        Let MedianValue = sortvalues(LastElement/2)
    Else
        Let MedianCount = Int(LastElement/2)
        Let MedianValue = (sortvalues(MedianCount) + sortvalues(MedianCount+1))/2
    End If
Return
‘——————————-

[SwitchValues]
    let temp = sortvalues(x-1)
    let sortvalues(x-1) = sortvalues(x)
    let sortvalues(x) = temp
    let ValuesSwitched$ = “y”
Return
‘——————————-

[Cleanup]
    print “Sorted List”
    for x = 0 to LastElement
        print sortvalues(x)
    next
    print “Mean Value is:”, MeanValue
    print “Median Value is:”, MedianValue
return

In Python 3.x -
#CIS 120 Assignment 8 in Python
#Liam Boyle
# 03 Apr 2011

#populate list
prompt = “How many values do you need to enter?”
ListElements = input(prompt)
ListElements = int(ListElements)
value = []

for x in range(0,ListElements):
    prompt = “Enter a value to sort\n”
    value.append(input(prompt))
    value[x] = int(value[x])

print (“Unsorted List”)
for x in range(0,len(value)):
    print (value[x])

#List sorting
x = 0
ValuesSwitched = “y”
while ValuesSwitched == “y”:
    ValuesSwitched = “n”
    for x in range(1,len(value)):
        if value[x] < value[x-1]:
            value[x-1], value[x] = value[x], value[x-1]
            ValuesSwitched = “y”

#Mean Calculation
MeanValue = 0
for count in range(0, len(value)):
    MeanValue = MeanValue + value[count]
MeanValue = MeanValue/(count)

#Median Calculation
if len(value)%2 != 0:
    MedianValue = value[len(value)//2]
else:
    MedianCount = (len(value)//2)
    MedianValue = (value[MedianCount] + value[MedianCount+1])/2

#printing sorted list
print(“Sorted List”)
for x in range(0,len(value)):
    print(value[x])
print (“Mean value is: “, MeanValue)
print (“Median value is: “, MedianValue)

The next assignment was directly written in Python 3.x without my having written a JustBASIC version.

#CIS 120 Assignment 9 part a & b combined in Python 3.x
#Liam Boyle
#4/10/2011

#Global Variable Initializations
Num1 = 0.0
Num2 = 0.0
prodnum = 0.0
#————-

def summation(x, y):
    sumnums = x + y
    print(“the sum of “, x, “and “, y, “is: “, sumnums)
    return
#————-

def difference(x, y):
    if x > y:
        diffnums = x – y
        print(“the difference of “, x, “and “, y, “is: “, diffnums)
    else:
        diffnums = y – x
        print(“the difference of “, y, “and “, x, “is: “, diffnums)
    return
#————-

def productof(x, y):
    #global prodnum #making the answer a global variable
    prodnum = x*y
    return prodnum
#————-

#Main
#Start
prompt = “Please Enter Your first number: ”
Num1 = input(prompt)
Num1 = float(Num1)
prompt = “Please Enter Your second number: ”
Num2 = input(prompt)
Num2 = float(Num2)
summation(Num1, Num2)
difference(Num1, Num2)
#productof(Num1, Num2)
print(“The product of “, Num1, “and “, Num2, “is: “, productof(Num1, Num2))
#End

This in turn led to my standard first non-assignment project for any programming language, of which the JustBASIC version was published in an earlier blog:

#Universal Theosophic Reduction Calculator
#Liam Boyle
#04/09/11
#————-

##def DoublingIteration():  #This was part of the original JustBASIC program
##    global NumValue     #designating global list
##    prompt = “enter the total number of doubling iterations\n”
##    iterationNum = input(prompt)
##    iterationNum = int(iterationNum)
##    for Iteration in range(1,iterationNum,1):
##        NumValue.append(NumValue[Iteration - 1] * 2**Iteration)
##        #print(NumValue[Iteration]) #scaffolding for development
##    return
#————-

def IntegerTheosophicReductionCalculator():
    TempTheoReducValue = 0
    prompt = “enter integer value to be reduced \n”
    NumValue = input(prompt)
    NumValue = int(NumValue)
    if NumValue <= 9:
        TheoReducValue = NumValue
    else:
        NumValueString = str(NumValue)
        for SubChar in NumValueString:
            TempTheoReducValue = TempTheoReducValue + int(SubChar)
        while TempTheoReducValue > 9:
            TempTheoReducValueString = “”
            TempTheoReducValueString = str(TempTheoReducValue)
            TempTheoReducValue = 0
            for SubCharB in TempTheoReducValueString:
                TempTheoReducValue = TempTheoReducValue + int(SubCharB)
        TheoReducValue = TempTheoReducValue
    print(NumValue,”\t”,TheoReducValue)
    return
#————-

def StringTheosophicReductionCalculator():
    TempTheoReducValue = 0
    prompt = “Enter term to be philosophically reduced\n”
    EntryString = input(prompt)
    EntryString = EntryString.lower()
    #print(EntryString)  #scaffolding for development
    for char in EntryString:
        if char == “a” or “j” or “s”:
            TempTheoReducValue = TempTheoReducValue + 1
        elif char == “b” or “k” or “t”:
            TempTheoReducValue = TempTheoReducValue + 2
        elif char == “c” or “l” or “u”:
            TempTheoReducValue = TempTheoReducValue + 3
        elif char == “d” or “m” or “v”:
            TempTheoReducValue = TempTheoReducValue + 4
        elif char == “e” or “n” or “w”:
            TempTheoReducValue = TempTheoReducValue + 5
        elif char == “f” or “o” or “x”:
            TempTheoReducValue = TempTheoReducValue + 6
        elif char == “g” or “p” or “y”:
            TempTheoReducValue = TempTheoReducValue + 7
        elif char == “h” or “q” or “z”:
            TempTheoReducValue = TempTheoReducValue + 8
        elif char == “i” or “r”:
            TempTheoReducValue = TempTheoReducValue + 9
        elif char == “1″or”2″or”3″or”4″or”5″or”6″or”7″or”8″or”9″:
            TempTheoReducValue = TempTheoReducValue + int(char)
        else:
            TempTheoReducValue = TempTheoReducValue + 0
    while TempTheoReducValue > 9:
        TempTheoReducValueString = “”
        TempTheoReducValueString = str(TempTheoReducValue)
        TempTheoReducValue = 0
        for SubCharB in TempTheoReducValueString:
            TempTheoReducValue = TempTheoReducValue + int(SubCharB)
    TheoReducValue = TempTheoReducValue
    print(EntryString,”\t”,TheoReducValue)
    return
#————-

def opener():
    print(“Universal Theosophic Reduction Calculator for Vortex Mathematics”)
    prompt = “do you have an integer value to be reduced? y/n \n”
    questionAns = input(prompt)
    if questionAns == “y”:
        IntegerTheosophicReductionCalculator()
    prompt = “Do you have an alphanumeric term to be reduced y/n \n”
    questionAns = input(prompt)
    if questionAns == “y”:
        StringTheosophicReductionCalculator()
    return
#————-

def continueQues():
    prompt = “Do you want to run again y/n?\n”
    ContinueAns = input(prompt)
    if ContinueAns == “y”:
        opener()
    return
#————-

#Main
opener()
continueQues()
#End

So where does all this lead, and what does it have to do with gamification?  Well, to me building programming skill is the nuts and bolts of how to gamify life, and the world.  I’m not all that outgoing I’m limited in how physically active I can be, but this I can do.  I will be the first to admit that these are all beginner level command line programs but this is the beginning of the path I need to walk (well, limp along – literally, I walk with a cane folks) to achieve the end of bringing game techniques to life.  My goal is to do this by bringing the real world into the game.  By making games that can reflect reality absolutely.

Liam B

Absolute reality, poverty, PTSD, and the Gamification of life itself.

Apr 5, 2011 at 10:39 am in post by Liam Boyle

Catching up on my news feeds I ran across the following article: 
http://truthout.org/dark-side-comprehensive-soldier-fitness/1301814000  While an article about an untested psychological training program being rolled out to the military isn’t directly related to gaming the article points out limits to the concepts of positive psychology.  Jane champions positive psychology and many of us see it as both a useful tool in game design and a goal in game design.  However, there are reasons for the “darker” side of the psyche.

First, I would like to suggested an experiment that I found in a book on creative writing by Natalie Goldberg.  Sit down with a blank piece of paper or notebook, a fast pen, and a timer.  For ten minutes write freely starting with the phrase “I remember….”  After that ten minutes get up walk around briefly, have a cup of coffee or tea, but don’t speak to anyone.  For the next ten minute period write freely starting with the phrase “I don’t remember….”

The end result of this is that you begin to see both the positive and negative sides of your own psyche.  Much of the negative side of the psyche is also closely related to survival instincts.  Fear and anger activating the fight or flight response, depression slowing down metabolic processes to increase chances of surviving adverse environmental conditions, and others.  While we espouse the goals of positive psychology we can’t forget the positive uses of negative emotion. And that positive emotional states cannot change negative external circumstances, at least not very quickly.

As far as the military is concerned, whether or not it gets called PTSD, Battle
Fatigue, Shell Shock, Berserking, the Blackout Warrior phenomena,
“Seeing Red,” Warrior’s Heart, or any other of the thousand names this
condition has been referred to in history – this condition exists and
military service is only one example of this. The concern for game developers can be seen in an article from MSNBC from 2008: 
http://www.msnbc.msn.com/id/26078087/  It appears that witnessing traumatic events can lead to traumatic stress almost as readily experiencing the traumatic event first hand.  For those of us making traditional games this has to be a concern that needs to be kept in mind.

I, for one, do not want to be causing people psychological damage from games I make, but this is something I want to reference in my games.  The fact I discovered historical references to what is now called PTSD means that this condition has been around as long, and possibly longer than the concept of warfare itself.  Therefore, in order to make our game worlds work like the real world, in order to have absolute reality in gaming, the topic of this condition has to be addressed in our games.  Traumatic events are not exclusively confined to military circumstances, and for some people witnessing the traumatic event is the same as being in the traumatic event.  It is also being discovered that economic trauma can be almost as powerful as physical trauma.

This is where, what is going to be my first major piece of programming, comes into play.  My first major program is not going to be a game, but rather a budgeting program.  Most budgeting systems take a person’s gross or net income and use various percentages to determine how much of that income should be used for various expenses.  The two main systems in the United States are the federal budgeting guidelines, and the “60% solution” developed by Richard Jenkins of MSN money.  However, I have noticed that when you get to within about 200% of the US poverty line both these systems begin to fail.

When expenses are greater than income one either has to reduce expenses or increase income, and for many people the former is much easier than the latter.  Yet, there is a floor to expense reduction, a level where no further reductions can be made. Here is an example: 

Take a job that pays $9.00/hr which is a very common starting wage for “unskilled” labor and entry level “skilled” positions.  $9.00/hr times a 40/hr work week multiplied by 50 working weeks in the average work year comes to an annual wage of app $18,000.  In the US that puts a person in the 10% tax bracket, so $18k less 10% leaves $16,200 spendable income.  Federal guidelines state that housing expenses should come to no more than 25-33% of net income.  This gives a range of app $338-448 per month to spend on housing costs.  Herein lies the difficulty, in the city of Louisville, KY (where I just happen to live) the average fair market rent on an apartment large enough for the average size family (3.24 persons according to 2010 census figures) is $684 a month.  Guess what, that’s 50 2/3% of income for a job paying $9.00/hr.

In all our superstructing and evoke-ing to solve the world’s problems through gaming this is a harsh reality that needs to be faced.  No amount of positive psychology is going to change the fact that there is no percentage of zero greater than zero.  I’ve been laid-off in the past myself, and I know many, many laid-off, involuntarily unemployed people.  The situation happens that these folks know what there expenses are, and have reduced those expenses to the lowest possible levels.  However, they do not know what there wages need to be to make ends meet.

This leads me to my proposition, a “reverse budget calculator.”  By this I mean, the end-user enters their expenses – housing costs, transportation costs, childcare costs… and the program determines (according to three budgeting systems) what income is needed to make those expenses fit into a livable percentage of that income.  By including federal default values for certain expenses such as housing and food costs this can also be used as a forecasting tool to help with financial goal setting.  The follow up to this would be a game that can help teach the basic concepts of budgeting and personal finance. 

So how is this related to the opening discussion on PTSD and positive psychology and to our core concept of gamification?  Economic trauma can have the same effects as physical trauma, while the individual events may be perceived as less traumatic, economic traumas tend to operate in chains.  First, a person gets laid-off (trauma #1), then the person cannot make ends meet on a reduced income even after cutting expenses (trauma #2), this in turn leads to an eviction (trauma #3).  That’s a whole lot of stress for a person to experience, and psychologists are beginning to find out, this can lead to a host of psychological problems in addition to the harsh physical realities that caused them.  By creating this non-game tool, I’m gamifying personal finance by providing said tool to the quest of economic survival.  Isn’t that our shared goal?

Liam B