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)
>>1
Really, the deadline needs to be extended. I would consider doing this if the deadline was in say; one week. Quite frankly I have more important things I need to do and can't just drop all my plans to complete a challenge posed by an Anonymous user on an internet bulletin board.
>>7
What is the point of having two different modes? All it does is differentiate between people who have made plans for the next two days and people who have not. Don't you think the difficulty of the challenge should be determined by something more related to the subject?
out: while(true){
println("You've encountered a monster!!");
int health=randInt(10)+5;
println("It has "+health+" health!!!");
while(true){
println("WHAT THE FUCK WILL YOU DO NOW??");
println("1. --Fight");
println("2. --Item");
println("3. --Ability");
println("4. --Run");
int choice=getNextInt();
int dmg=0;
switch(choice){
case 1:
println("You swing your feeble nerd arms at monster!");
dmg=randInt(4);
if(dmg==0) println("LOLOL YOU MISSED!");
else println("You did "+dmg+" damage!!!!!!");
break;
case 2:
println("You use an item!!!");
println("Your item is a SICP snake!!!");
dmg=randInt(2)+1;
println("Snake does "+dmg+" damage!!!!!!);
break;
case 3:
println("You use ability!!!!");
println("Your ability is... HAX ANUS");
dmg= health%2==0?3:0;
if(dmg==0) println("Monster's anus could not be haxed!");
else println("Monster's anus is haxed for 3 damage!!");
break;
case 4:
println("You try to run!! *cough*pussy*cough");
if(randInt(1)==0){
println("You get away!!");
continue out;
}else{
println("There's no way out!!");
}
break;
}
health-=dmg;
if(health<=0){
println("You defeated the monster!!");
break;
}
println("Monster has "+health+" life remaining!!!");
println("Monster attacks you!!!");
println("The power of SICP protects you!");
}
}
for (i = 0; i < 10; ++i)
printf("\t\t\t%s\n", faces[hps[0] > 0 ? 1 : 0][3][i]);
printf(hps[0] > 0 ? "\n\t\t\tYou have defeated your opponent!\n\n"
: "\n\t\t\tYou have been defeated.\n\n");
return 0;
}
Name:
Anonymous2010-06-29 17:29
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>『Final Quest Saga XXI: Wahrheit und Lüge im außermoralischen Sinn』</title>
</head>
<body>
<noscript>This HTML program requires Javascript<i>!</i></noscript>
<h1>Encountered an enemy<i>!</i></h1>
<h2>Name: Sussman | Class: Wizard | Level: 255</h2>
<ul>
<li>
<a href="javascript:document.body.innerHTML = '
<h1>You attack Sussman with your Sword<i>!</i><br>
Sussman receives 0 point(s) of damage<i>!</i><br>
Sussman summons a computational process<i>!</i><br>
The computational process attacks you<i>!</i><br>
You receive 9999 point(s) of damage<i>!</i><br>
You die<i>!</i><br>
Game over.</h1>';">
Fight<i>!</i></a>
</li>
<li>
<a href="javascript:document.body.innerHTML = '
<h1>You start reading ``How to Design Programs\'\'<i>!</i><br>
It\'s not very effective...<br>
Sussman receives 0 point(s) of damage<i>!</i><br>
Sussman summons a computational process<i>!</i><br>
The computational process attacks you<i>!</i><br>
You receive 9999 point(s) of damage<i>!</i><br>
You die<i>!</i><br>
Game over.</h1>';">
Item<i>!</i></a>
</li>
<li>
<a href="javascript:document.body.innerHTML = '
<h1>You summon a snake<i>!</i><br>
A snake attacks Sussman<i>!</i><br>
Sussman receives 0 point(s) of damage<i>!</i><br>
Sussman summons a computational process<i>!</i><br>
The computational process attacks you<i>!</i><br>
You receive 9999 point(s) of damage<i>!</i><br>
You die<i>!</i><br>
Game over.</h1>';">
Ability<i>!</i></a>
</li>
<li>
<a href="javascript:document.body.innerHTML = '
<h1>You attempt to run away<i>!</i><br>
Your escape attempt is unsuccessful<i>!</i><br>
Sussman summons a computational process<i>!</i><br>
The computational process attacks you<i>!</i><br>
You receive 9999 point(s) of damage<i>!</i><br>
You die<i>!</i><br>
Game over.</h1>';">
Run<i>!</i></a>
</li>
</body>
</html>
Name:
Anonymous2010-06-29 18:10
>>14
very nice.
it crashes if you have too much hp though.
>>19 void print_menu(WINDOW *win, char **menu, int current, int number); void print_submenu(char **choices, int nchoices); void print_progsnake(); void read_sicp();
Why do you declare functions right before you define them? I think you missed a point somewhere along the line.
>>24 Why do you declare functions right before you define them? I think you missed a point somewhere along the line.
I think you haven't programmed in C, ever.
>>26
It's a bit ENTERPRISE, really, and it smells of cargo cult programming.
I declare all of my functions before I define them, but I also define all of them after main, for readability.
In the end I won't go with SDL because it's shit and obsolete and for some reason link.exe can't find an entry point and all the FAQs and tutorials are written for the IDEs.
>>31
I'll agree with you that it's shit, and especially lacking in comparison to Allegro, but it's not obsolete. It surely works on modern systems quite nicely and isn't too terribly difficult to use. If you need a FAQ or tutorial you're probably doing it wrong - just read the headers and documentation, and you'll be fine.
>>35 SDL_main.h defines a main macro, so that your program isn't the real main but SDL's main runs first and initializes stuff.
The real main should be in SDLmain.lib. I am linking my main.obj with SDL.lib and SDLmain.lib; I even tried different orders (since AFAIR order matters), but it doesn't work anyway.
>>39
For one, you don't have a main, you have WinMain. That's the whole point of SDL's main fuckery, it's so your app can consistently have a main() function with the same prototype, even on Windows.
Are you sure you're trying to link it as a GUI application? You need a switch for that, I don't remember what it is though.
>>41
For one, you don't have a WinMain, you have a _tWinMain. That's the whole point of WIN32's main fuckery, it's so your app can consistently have a main() function with the same prototype, even when using Unicode.
>>23
>expert programmers
please don't tell me i qualify as an expert programmer from learning programming from google since i was 13, im almost 16 now.
programming a basic pokemans battle system is just 1 step above hello world.
>>41
By default, if you use main the code compiles as a console application, and if you use WinMain the code compiles as a GUI application.
And I'm talking about compiling without no fancy-pants IDEs.
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")
>>55 print "Oooh.. Your attack power of ",dmg," was not strong enough."
This will output more spaces around dmg than you want it to. Remove the last space in the first string and the first space in the last, or replace the commas with +s.
(And put spaces after your commas, for fuck's sake. You're writing Python, not PHP.)
>>74
In Python 3, and 2.x with the future feature imported, print is a function. Get used to it.
The other paren is stylistic, I find it's way too easy to write something like print("blah %d blah blah" % x)
and then later adapt the line to add y, forgetting to make the RHS value a tuple: print("blah %d blah %d blah" % x, y)
Which of course doesn't work. This is especially bad if your first value is a tuple and you're using %r or %s to print a tuple, because then you won't even get an error message, it'll just work -- incorrectly. Better off putting that extra set of parentheses around your values every time you %-substitute.
>>82
Why is there always one person who can't seem to figure out his C compiler, or his Python interpreter, or his SQLite client? This isn't rocket science.
>>14 just compiles with gcc filename.c. How much easier do you want it to be?
>>62 is good until you start getting better. The $you->{power} += $powergain line shouldn't be there. Also it doesn't meet the requirements, but you've acknowledged that. I await an updated version.
Name:
Anonymous2010-07-02 18:49
This thread has been closed and replaced with the following thread:
Subject: Compiling C code with a PHP compiler Name: Email:
>>92 - homosexual opening brace usage,
With the exception of the switch, >>90 is pretty much K&R style. Nothing homosexual about it.
Name:
Anonymous2010-07-04 14:55
>>93
oh 92-kun here. i agree. but he didn't use it for main, and as that was the first instance, i assumed all following occurances would be the same. how wrong i was.
Ah, a bit hasty wasn't I, forgetting code tags and all. Anyways, I don't generally use the
if (expression)
{
...
}
style, that's just the default in DevC++, and I was too lazy to change it. I also know about cin.get();, but in utter contempt for portability, I decided to use system("Pause"); which is an old habit. A bad one, albeit, but I like it.
Well, I don't like that that is the only Python entry.
Have this one.
from random import randint
from time import sleep
SPELLBOOK = [{"DICH SNAKE RETRACTION":18, "MASTER BLASTER":16},
{"DIGITAL IMAGE POST ATTEMPT":20, "POWERFUL BBCODE":19},
{"BEAUTIFUL COOING":14, "GENTLE RUBBING INTO THAT GOODNIGHT":21, "RECITATION OF HIGHSCHOOL SPIRIT SONG":12}]
ITEMLIST = [{"Handful of Dust":6, "Pawful of Dirt":9},
{"Mudden Idol":6, "Quigsor Pindleweign":9},
{"Open Courseware PDF notes":10, "Topical caffeine mixture, 10%":8, "A bloody mary cocktail sticker":7}]
YOUR_NAME = raw_input("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nWhat is your name?\n>> ")
PLAY = 1
class Person:
def __init__(self, NAME, HP, MP, SPELLBOOK, ITEMLIST):
self.name = NAME
self.hp = HP
self.mp = MP
self.spells = SPELLBOOK
self.items = ITEMLIST
def Fight(self):
#How uncivilized.
hit = randint(5,14)
print "\n"*2+ "%s whacks a bit, blooming into a petit mort d'%d droplets" % (self.name, hit)
return hit
def Magic(self, choice):
damage = self.spells[choice]
self.mp -= 10
print "\n"*2+ "%s uses %s for %d damage!" % (self.name, choice, damage)
return damage
def Item(self):
Item = self.items.keys()[randint(0,len(self.items)-1)]
cure = self.items[Item]
self.hp = self.hp + cure
print "\n"*2+ "%s takes in the curious %s, yet looks %d radians brighter!" % (self.name, Item, cure)
return 0
def Run(self):
print "\n"*2+ "The cowardice of %s emboldens his opponent!" % (self.name)
return -17
def Upkeep(self, dmg):
self.hp = self.hp - dmg
if self.hp <= 0:
print "OH DEAR! %s HAS FAILED!" % (self.name)
def Menu():
print "[F][I][R][M]. DECIDE."
choice = raw_input(">>")
if choice.lower() == "r":
return PLAYER.Run()
elif choice.lower() == "f":
return PLAYER.Fight()
elif choice.lower() == "m":
i = 1
for spell in PLAYER.spells:
print " %d) %s" % (i, spell)
i = i + 1
choice = int(raw_input("Which number spell do you choose? \n>>"))
if (choice == 1) or (choice == 2):
choice -= 1
return PLAYER.Magic(PLAYER.spells.keys()[choice])
elif choice.lower() == "i":
return PLAYER.Item()
else:
print "I believe you've gone a bit hax'd!\nYour dalliance only strengthens your opponent!"
return 0
def Computer():
choices = ["r", "f", "m", "i"]
choice = choices[randint(0,3)]
if choice.lower() == "r":
return OPPONENT.Run()
elif choice.lower() == "f":
return OPPONENT.Fight()
elif choice.lower() == "m":
return OPPONENT.Magic(OPPONENT.spells.keys()[randint(0,len(OPPONENT.spells)-1)])
elif choice.lower() == "i":
return OPPONENT.Item()
print "\n"*5
print " ", "-"*35
print " PROGRPG"
print " ", "-"*35
OPPONENT = Person(NAMES[randint(0,6)],randint(75,95),randint(75,95),SPELLBOOK[randint(0,len(SPELLBOOK)-1)],ITEMLIST[randint(0,len(SPELLBOOK)-1)])
PLAYER = Person(YOUR_NAME, 75, 75, SPELLBOOK[randint(0,len(SPELLBOOK)-1)], ITEMLIST[randint(0, len(SPELLBOOK)-1)])
print "\n"*5
print """%s has come upon you, as you lie in repose! Arise, my Rubenesque champion!
Let this not be that hour during which you falter, nor fall, nor find your soul weak!
Justice flows through you, and many meditations complete you- now find the strength inside yourself to complete this!""" % (OPPONENT.name)
print "Your spell book has many pages- FEAST!"
print "\n" + "---------------------------------------"
for spell in PLAYER.spells.keys():
print " | " + spell
print "---------------------------------------"
print "\n"*2 + "---------------------------------------"
print "Your bag bursts with things- OBSERVE!"
print "---------------------------------------"
for item in PLAYER.items.keys():
print " || " + item
print "---------------------------------------"
sleep(2)
while PLAY == 1:
print "You're health is %d, and you've got %d anii. You're opponent looks to have %d health." % (PLAYER.hp, PLAYER.mp, OPPONENT.hp-8)
OPPONENT.Upkeep(Menu())
if OPPONENT.hp <= 0:
break
PLAYER.Upkeep(Computer())
if PLAYER.hp <= 0:
break
print "\n"*4
>>121
I don't like being represented as some chunk of badly pixelated art. Please improve your image display routines/quality to an acceptable, VN-quality level with large res sprites and detailed background.
>>136
More like: the author of these posts latched on to what he perceived as a meme and proceeded to turn it into mindless spam → he is from the imageboards.
>>142
Not in this particular thread, but I'm a programmer that partakes in many of these challenges (even though I stand no chance against Xarn) and I sometimes make shitposts if they are even slightly funny/clever/related to the thread.
>>155
No it doesn't. It is merely that the Normalmode deadline is after the Hardmode deadline. Clearly >>15 was superior to all the Normalmode entrants, thus it beat them.