Thursday, April 18, 2013

I have been told to blog. This I can do. I've been writing a lot of code in the past weekend, just trying to get a grip on how Neal would need to think in order to construct this AI. I've made what is essentially a choose your own adventure game that basically just acts as a logic machine.

Here's the code, the syntax is gonna be wrong since I'm bringing python in through HTML, but if any of you wanna put it into an interpreter and play it, feel free:

-------


def tester(
    print "A man with a revolver and a silver dollar approaches you out of the darkness. He draws a bead on your head and tells you to pick:"
    print "Alright, tough guy. Heads or tails?"
    answer = raw_input("Type 'Heads', 'Tails', 'Run' or 'Fight', and hit 'Enter'.")
    if answer == "Heads" or answer == "heads" or answer == "H" or answer == "h"
        print "Unlucky this time, mate *BANG*"
            print "The End"
    elif answer == "Tails" or answer == "tails" or answer == "T" or answer == "t"
        print "Alright, you go lucky this time. *The man disappears back into the darkness*"
            print "You won!"
    elif answer == "Run" or "run"
        print "The man shouts something at you in Russian as you dart around the corner, but you hear gunshots hit the wall behind you. You decide not to look back, but after about ten more paces you hear a sharp crack and everything below you neck goes icy cold"
        def death(
            print "You think this is what death feels like"
            print "Would you like to die?"
            answer2 = raw_input("Type 'Yes' or 'No'")
                if answer2 == "Yes" or answer2 == "yes" or answer2 == "y" or answer2 == "Y"
                    print "Everything feels...okay. Life is peaceful here"
                    print "The End"
                elif answer2 == "No" or answer2 == "no" or answer2 == "n" or answer2 == "N"
                    print "You struggle for a few minutes against the tendrils of darkness creeping in at the corners of your vision, but soon your sight leaves you, followed shortly by the sound of the man's heavy footfalls growing ever quieter in the distance"
                    print "The End"
                else:
                    print "Not an option, sorry"
                    death)
    elif answer == "Fight" or answer == "fight"
        print "You deliver a crushing karate chop to the man's gun hand and he drops the revolver."
        print "He shouts something at you in russian and raises his fists"
        answer3 == raw_input("Type 'Gun' to go for the gun, 'sweep' to try and sweep his legs, or 'face' to try punching the man in the face")
            if answer3 == "Gun" or answer3 == "gun"
                print "You both make a dive for the gun, but you're a little bit quicker. You level it on his chast and he backs away a few steps. You motion with the barrel for him to run away, and as he turns his back, you pull the trigger"
                print "You win...You monster"
            elif answer3 == "Sweep" or answer3 == "sweep"
                print "You crouch low and try to sweep his legs out from under him. Unfortunately that move only works in 80's movies starring asians or Chuch Norris, so your devastating blow ends up stopping you short at the man's feet, off balance. He lifts one of his heavy leather boots and brings it down on you skull."
                print "Again"
                print "And again.."
                def death
                    print "You think this is what death feels like"
                    print "Would you like to die?"
                answer2 = raw_input("Type 'Yes' or 'No'")
                        if answer2 == "Yes" or answer2 == "yes" or answer2 == "y" or answer2 == "Y"
                            print "Everything feels...okay. Life is peaceful here"
                            print "The End"
                        elif answer2 == "No" or answer2 == "no" or answer2 == "n" or answer2 == "N"
                            print "You struggle for a few minutes against the tendrils of darkness creeping in at the corners of your vision, but soon your sight leaves you, followed shortly by the sound of the man's heavy footfalls growing ever quieter in the distance"
                            print "The End"
                        else:
                            print "Not an option, sorry"
                            death()
            elif answer3 == "Face" or answer3 == "face"
                print "You wind up and hurl a right hook at the man's face, which makes devastating contact"
                print "The man doesn't flinch. He wipes a few drops of blood and spittle off on the back of his hand, and spits on the ground"
                print "The man winds up just like you did, a mocking grin on his face"
                print "Everything goes black"
                print "The End"
    else "Not an option, sorry"
tester)


---------

I've made a good amount of progress in the actual writing process. You guys will get to see some of that someday, if I'm feeling generous.

2 comments:

  1. Good job Jimmy! Glad to see that you are moving along with your writing. I hope that you start feeling generous soon because I am looking forward to seeing this in book form. Do you think you'll still be able to write 300 pages? Is Neal the main character in your book? Hopefully you'll be able to find your groove. Try to set about 3 or 4 hours for yourself to do writing when you can. You seem to be the kind of guy who works better when you apply yourself for long periods of time.

    ReplyDelete
  2. Thanks you Chris, for your insightful comments. i really appreciate getting heartfelt feedback from my classmates, and will be sure to apply the suggestions which you have made to my process.

    ReplyDelete