Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

♀ /prog/ Challenge Vol. 8 ♀

Name: Anonymous 2010-06-29 14:04

The Challenge:
-Develop a turn based combat system that implements the following choices that occur during the player's turns:
--Fight (Straight Damage)
--Item (Use an object from a choice of your design)
--Ability (Use an ability from a choice of your design)
--Run (Flee the battle)


The Deadline:
- 2010-07-01 00:00

The rest is up to you.

Name: Anonymous 2010-07-01 1:03

Uhh.. I see an overabundance of C progams. No python anywhere.

I wrote my own python version of this.. Too bad I am horrible at python. This is really simple and not anywhere near as elaborate as some of these other scripts. It's more of a simple "press this button and see what hapens" kind of battle


# I know - This is pretty shitty.
# But I am a beginner python programmer
# And I just wanted to contribute to the challenge.
# If you must criticize, please keep it constructive :)

import random

print ">:3";
c = raw_input("You encounter a lion! What do? [F]ight / [I]tem / [R]un / [M]agic ")
dmg = random.randint(1, 10)
if c == "f":
    if dmg > 5:
        print "What a powerful blow! You win!"
        raw_input("press [enter] to continue")
    else:
        print "Oooh.. Your attack power of ",dmg," was not strong enough."
        print "The lion has torn you to shreds."
        raw_input("press [enter] to continue")
elif c == "i":
    i = raw_input("Inventory:\n1. SICP\n2. Lion Trap\nWhat do you choose? ")
    if i == "1":
        print "You read SICP to the lion.. He get's bored and walks away!"
        print "You are technically victorious."
        raw_input("press [enter] to continue")
    elif i == "2":
        print "Surprisingly, the lion trap failed.. This lion is pretty smart!"
        print "The lion has decapitated you!"
        raw_input("press [enter] to continue")
    else:
        print "While you were typing in the wrong command the lion bit your legs off."
        raw_input("press [enter] to continue")
elif c == "r":
    print "You quickly got in the car!"
    raw_input("press [enter] to continue")
elif c == "m":
    print "You summon the almighty progsnake!"
    print "the snake wraps around the lion and kills it!"
    raw_input("press [enter] to continue")
else:
        print "While you were typing in the wrong command the lion dragged you off to his herd."
        raw_input("press [enter] to continue")

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List