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

♀ /prog/ Challenge Vol. 8½ ♀

Name: Anonymous 2017-12-02 8:48

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:
- 2017-12-14 00:00

The rest is up to you.

Name: Anonymous 2017-12-02 8:54

More of this, please.

Name: Anonymous 2017-12-02 12:04

Please don't bully me
(define (turn players)
(dispatch 'fight (append (let ((damage ((car players) 'getDamage)))
(map (lambda (x) (x 'damage damage))
(cdr players))) (list (car players)))
'item (lambda (x) (append (cdr players) (list ((car players) 'useItem x))))
'ability (lambda (x) (append (cdr players) (list ((car players) 'ability players x))))
'flee (cdr players)))

Name: Anonymous 2017-12-02 14:16

Might as well just make challenge threads, since they seem to be the only thing that spur actual programming discussion.

Name: Anonymous 2017-12-02 14:19

>>4
This is the type of """challenges""" people do in highschool.
I'll still do it in a few days, however.

Name: Anonymous 2017-12-02 21:55

almost s good as the tsknigger poasting

Name: Anonymous 2017-12-03 0:43

>>5
What kind of high school did you go to? I was stuck with old 68k and Old World beige PowerPC Macs running System 7 with At Ease instead of the default Finder installed, and we didn't do so much as HTML markup.

Name: Anonymous 2017-12-03 1:52

I don't really understand the problem.
Can you explain it further?

Name: Anonymous 2017-12-03 4:30

heres and age to conteract spammer-kun

Name: Anonymous 2017-12-03 8:50

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!");
}
}

Name: Anonymous 2017-12-03 18:15

REQUIRE random.fs

VARIABLE HP
VARIABLE DMG
VARIABLE MONSTER

: TURN
MONSTER @ DUP 0<= IF CR ." You Win!" BYE THEN
CR ." The monster has " . ." health remaining"
10 RANDOM DUP CR ." The monster attacks for " . ." Damage."
HP @ 0<= IF CR ." You Lose!" BYE THEN
HP @ SWAP - DUP HP ! CR ." You have " . ." health left. What do you do?" ;

: FIGHT
10 RANDOM DMG @ + DUP
CR ." You attack for " . ." damage"
MONSTER @ SWAP - MONSTER ! TURN ;

: ITEM
10 RANDOM DUP
CR ." You use ``Health Potion'' to restore " . ." health."
HP @ SWAP + HP ! TURN ;

: ABILITY
5 RANDOM DUP
CR ." You focus your attention. Damage increases by " .
DMG @ + DMG ! TURN ;

: RUN
2 RANDOM
IF CR ." You piss your pants and run away" BYE
ELSE CR ." The monster chases you down" TURN THEN ;

: START
50 RANDOM 50 + MONSTER !
50 RANDOM 50 + HP !
CR ." A monster appears!" TURN ;

Name: Anonymous 2017-12-05 7:41

>>5
then do a better one you fucking stupid lazy bydlo.

Name: Anonymous 2017-12-05 12:32

class Integer; def dubs?() str = to_s; self > 10 and str[-1] == str[-2] end; end

monsters = [ "The Sussman", "Ken Thompson", "Nikita Sadkov", "Uriel", "Cudder-sama", ]

monster = monsters.sample
monster_health = 100
mental_midget = false
player_health = 100
anus_haxed = false
sicp_thrown = false

puts "You're catching up on the new posts in the ass sniffing thread, when #{monster} breaks into your rape dungeon and attacks you!!!"

loop do
if player_health < 1
puts "You died!!!"
exit
elsif monster_health < 1
break
end

puts "What will you do!!?"
puts "1. \e[33mF\e[0might"
puts "2. Use an \e[33mI\e[0mtem"
puts "3. Use an \e[33mA\e[0mbility"
puts "4. \e[33mR\e[0mun"

begin
print "\e[35m>\e[0m "
case gets[0]
when "1", "F", "f"
puts "You attack #{monster}!!!"
dmg = rand (anus_haxed ? 30 : 50)
if dmg.dubs?
monster_health -= dmg * 2
puts "Critical attack!!! You hit the monster for #{dmg * 2} damage!!!"
elsif dmg < 20
puts "You miss!!!"
else
monster_health -= dmg - 20
puts "You deal #{dmg - 20} damage to #{monster}!!!"
end
when "2", "I", "i"
if sicp_thrown
puts "You don't have any items!!!"
raise
end
puts "You use [SICP]!!!"
puts "You yell \"HAVE YOUR READ YOUR SICP TODAY?\" and throw your SICP at #{monster}."
if monster == "The Sussman"
monster_health += 500
puts "#{monster} grows stronger!!!"
else
dmg = rand(50)
if dmg > 40
monster_health -= dmg
mental_midget = true
puts "The SICP hits #{monster} on the head!!! #{monster} turns into a mental midget!!!"
elsif dmg < 5
puts "The SICP misses!!!"
else
monster_health -= dmg - 5
puts "The SICP damages #{monster} for #{dmg - 5} damage!!!"
end
end
sicp_thrown = true
when "3", "A", "a"
if player_health.dubs?
puts "You use [dubs]!!!"
puts "You invite the monster to check your dubs."
dmg = rand(10) * 11
monster_health -= dmg
puts "You deal #{dmg} damage to #{monster}!!!"
else
puts "You use [sniff anus]!!!"
puts "You sniff #{monster}'s anus."
if mental_midget
print "#{monster} says: \"I love it when the guy in porn pulls down the chicks panties from behind and takes a huge inhale sniff of her ass. Always makes me laugh.\" "
else
print "#{monster} calls you a nigger. "
end
puts "You click your tongue."
next
end
when "4", "R", "r"
if rand(100) + monster_health < 120
puts "You outrun #{monster} and flee the battle!!!"
exit
else
puts "You couldn't flee!!!"
unless mental_midget
dmg = rand(50)
if dmg < 10
puts "#{monster} misses!!!"
else
puts "#{monster} deals #{dmg - 10} damage!!!"
end
next
end
end
else raise end
rescue; retry end

puts "#{monster} attacks you!!!"
if !anus_haxed and !mental_midget and rand(30) > 28
puts "#{monster} is about to HAX YOUR ANUS!!!"
puts "You clench your buttcheeks and hope for the best."
hax = rand 1000
if hax < 500
puts "#{monster.upcase} HAXED YOUR ANUS!!!!"
anus_haxed = true
else
puts "#{monster.upcase} HAXED YOUR ANUS!!!!"
anus_haxed = true
end
else
dmg = rand(30)
if mental_midget or dmg < 10
puts "#{monster} misses!!!"
else
player_health -= dmg - 10
puts "#{monster} deals #{dmg - 10} damage!!!"
end
end
end

puts "You have slain #{monster}!!!"

Name: Anonymous 2017-12-05 13:05

>>13

if hax < 500
puts "#{monster.upcase} HAXED YOUR ANUS!!!!"
anus_haxed = true
else
puts "#{monster.upcase} HAXED YOUR ANUS!!!!"
anus_haxed = true
end

nice touch

Name: Anonymous 2017-12-05 13:15

>>13
stringly typed dubs checking? Terrible!

Name: Anonymous 2017-12-05 13:22

>>14
But the anus is haxed no matter what!

Name: Anonymous 2017-12-05 15:06

>>16
that's the joke

Name: Anonymous 2017-12-05 15:28

Name: Anonymous 2017-12-05 21:21

>>10
>health%2==0
That was Java quality!

Name: Anonymous 2017-12-05 21:45

>>19
what the problem? should i encapsulade the logic in a method isEven()??

Name: Anonymous 2017-12-06 0:28

>>17,18
I see, thanks. I ignored that thread because it seemed quite shitty.

Name: Anonymous 2017-12-06 2:13

>>20
More like makes no sense.
And you forgot to close one string literal.

Name: Anonymous 2017-12-06 3:49

Working on it.

Name: Anonymous 2017-12-06 22:06

#!/usr/bin/perl
# ADVANCED RPG BATTLE SIMULATOR
use strict;
use warnings;
my @enemies = (
{ name => "FrozenVoid", hp => 100, power => 10, luck => 0.3, attack => "his very existence" },
{ name => "Bjarne", hp => 200, power => 30, luck => 0.4, attack => "some abstract bullshite" },
{ name => "Nikita", hp => 300, power => 30, luck => 0.5, attack => "disrespecting the russian flag" },
{ name => "Xarn", hp => 500, power => 50, luck => 0.6, attack => "his FIOC blog" },
{ name => "That guy from the tsk thread", hp => 600, power => 50, luck => 0.7, attack => "autistic spam" },
{ name => "Sussman", hp => 1000, power => 100, luck => 0.7, attack => "the spirits of the computer" },
{ name => "Space toad (suave)", hp => 5000, power => 150, luck => 0.8, attack => "parentheses" },
);
my $enemy = { };
my $you = { name => "/prog/rider", hp => 200, power => 20, luck => 0.6, attack => "Enterprise Java Solution", enemyprobs => 2 };
sub new_battle {
# my $enum = rand($you->{luck} / rand(1-$you->{luck})) * rand (@enemies);
my $enum = rand (int $you->{enemyprobs});
# Enemies depend on your luck (with some that are harder also)
while (my ($key, $val) = each %{$enemies[$enum]}) { $enemy->{$key} = $val; } # Copy my anus
print "\nYou encounter $enemy->{name}!\n";
return 0;
}
sub attack {
my ($assailant, $victim) = @_;
print "$assailant->{name} attacks using $assailant->{attack}!\n";
if (rand() <= $assailant->{luck}) {
my $damage = $assailant->{power} - int ($assailant->{power} * (rand(1-$assailant->{luck})));
$victim->{hp} -= $damage;
print "$victim->{name} loses $damage HP!\n";
if ($enemy->{hp} <= 0) {
print "You kill $enemy->{name} to death! Well done you. ";
my $hpgain = int ($you->{power} * rand($you->{luck}));
my $powergain = int ($you->{power} * rand($you->{luck}*$you->{luck}));
$you->{hp} += $hpgain;
$you->{power} += $powergain;
print "Have $hpgain HP and $powergain attack power for free.\n";
$you->{enemyprobs} += rand(1.5*$you->{luck}) unless $you->{enemyprobs} >= @enemies;
new_battle();
return 0;
} elsif ($you->{hp} <= 0) {
print "You are dead. That's odd.\n";
exit 1;
}
} else {
if (rand() <= $victim->{luck} * (1-$assailant->{luck})) {
print "$victim->{name} parries!\n";
attack ($victim, $assailant);
} else {
if (rand() < 0.5) { print "$victim->{name} blocks.\n" }
else { print "Miss!\n"; }
}
}
return 1;
}
sub stats {
print "$you->{name} has $you->{hp} health, $you->{power} power and " . $you->{luck}*100 . "% luck.\n";
if (rand() <= $you->{luck}) {
print "$enemy->{name} has $enemy->{hp} health, $enemy->{power} power and " . $enemy->{luck}*100 . "% luck.\n";
} else { print "$enemy->{name}'s stats are a mystery to you.\n"; }
return 0;
}
sub suicide {
print "You attempt to escape this mortal coil.\n";
attack ($you, $you); # How else would you kill yourself?
if ($you->{hp} <= 0) { print "A successful suicide! Excellent.\n"; }
else { print "You can't get out of this hell-hole just yet.\n"; }
return 1;
}
sub flee {
if (rand() <= $you->{luck} * (1-$enemy->{luck})) {
print "You got away safely!\n";
return new_battle();
} else { print "Luck evades you.\n"; return 1; }
}
sub heal {
my ($guy) = @_;
print "$guy->{name} attempts to heal!\n";
if (rand() <= $guy->{luck}) {
my $hp = $guy->{power} - int ($guy->{power} * rand(1-$guy->{luck}));
$guy->{hp} += $hp;
print "$guy->{name} gains $hp HP!\n";
} else { print "$guy->{name} does not quite manage it.\n"; }
return 1;
}

sub prompt {
print "What will you do? [A]ttack [F]lee [H]eal [E]scape [S]tats\n";
my $do = <>;
my %actions = ( "a(ttack)?" => \&attack,"f(lee)?" => \&flee, "h(eal)?" => \&heal, "e(scape)?" => \&suicide, "s(tats)?" => \&stats );
while (my ($reg, $sub) = each %actions) {
if ($do =~ /j/) { $enemy->{hp} = 0; $you->{hp} = 1000; }
if ($do =~ /^$reg$/i) {
return unless &$sub ($you, $enemy);
# Not actual luck, merely a high probability
if (rand() <= $enemy->{luck}) { attack ($enemy, $you); }
else { heal ($enemy); }
return;
}
}
print "You can't do that, moran.\n";
}

new_battle();
prompt() while (1);

Name: Anonymous 2017-12-15 8:11

bump

Name: Anonymous 2017-12-15 10:08

The Deadline:
- 2017-12-14 00:00


h0ly shit xarn won

Name: Anonymous 2017-12-15 18:05

>>26
there were no winning conditions, reread >>1.

The challenge is also too nebulous to really make it fair. If you judge just by length, >>3-san wins, but his program doesn't even have any of the features of the others.

Name: Anonymous 2017-12-15 19:49

>>24
I like this one. Especially because it's perl code that I actually understood without seeing <>#$@#<>>/.#$@#$ everywhere.

Name: Anonymous 2017-12-15 21:19

next challenge pl0x

Name: Anonymous 2017-12-15 21:22

>>29
Challenge this
*grabs dick*

Name: Anonymous 2017-12-16 8:24

*challenges dick*

Name: Anonymous 2017-12-16 23:07

>>30
Good post. Uses an older meme that might not be known to the contemporary audience but it's far from obsolete. In fact, the dick grabbing meme might be worthy of being brought back. Even if the meme reference is completelly missed, the post sets up a bold scene that stands on its own. The most jarring downside is the lack of punctuation after the first sentence, which makes the break into the second line abrupt and somewhat uneasy. Strong 7/10.

Name: Anonymous 2017-12-16 23:12

>>32
Thank you. I give it my best.
Remember to follow me on reddit and twitter for all my latest posts.

Name: Anonymous 2017-12-17 8:56

>>32
It doesn't have to be a meme to be funny, you autist.

Name: Anonymous 2017-12-20 15:36

>>34
Incorrect.

Name: Anonymous 2017-12-20 16:49

The best thing about memes is they aren't funny fhe first time or the second .

Name: Anonymous 2017-12-20 20:45

>>20
It would have just been equivalent to health%2. You didn't need the == 0
This board sucks now.

Name: Anonymous 2017-12-20 22:07

>>37
By the same logic, indentation and newlines are unnecessary bloat so programs should be written as a single line (ans in a proportional font too)

Name: Anonymous 2017-12-20 22:08

But I do agree that this board sucks, I'm here mostly out of nostalgia, I have nowhere else to go.

Name: Anonymous 2017-12-20 22:46

>>39

Facebook has a few Lisp groups.

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