2 Replies - 2711 Views - Last Post: 04 June 2007 - 07:56 PM Rate Topic: -----

#1 3e33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 16-May 07

So my friend was making Blackjack...

Posted 04 June 2007 - 12:51 PM

He got bored and then this happened...

# --------------------------
# Filename: blackjack.rb
# By: Nathaniel Cagle and Tyler Wells
# For: Programming 1, Period 5
# Purpose: Play a wonderful game of blackjack with the computer, because it's fun!
# --------------------------

#----- Title -----
print "Blackjack!\n\n"

#----- Chips -----

currency = 1000
print "You currently have 1000 chips!\n\n"
print "Good Luck!\n\n"
print "------------------------------\n\n"

#----- Game start -----

print "An enemy appears! What would you like to do? (1 Attack, 2 Run, 3 Use an item): "
enem = gets.to_i

if enem == 1
print "You have chosen to attack! You win!\n\n"
end
if enem == 2
print "You have chosen to run! Where would you like to run to: "
sdf = gets.chomp
print "\nYou have escaped to #{sdf}! You win!\n\n"
end
if enem == 3
print "You have chosen to use an item! Which item would you like to use: "
asd = gets.chomp
print "You used #{asd}! You win!\n\n"
end

popularity = 1 + rand(15)

print "Congradulations! You have defeated Blackjack!\n\n"

print "You have gained #{popularity} POPULARITY points! (Enter to continue.)\n\n"
con = gets
print "You have gained 7 SATANITY points! (Enter to continue.)\n\n"
con = gets
print "Jesus is no longer allied with you. Sorry. (Enter to continue.)\n\n"
con = gets
print "You have recieved: Limited Health! (Enter to continue.)\n\n"
con = gets
print "You have recieved: Limited Damage! (Enter to continue.)\n\n"
con = gets

#----- Real Game Start -----

print "------------------------------\n\n"
print "Oh no, all is not as it seemed! You weren\'t \n actually starting a game of Blackjack at all!\n It seems that you are now stuck in some sort of \n cheap RPG game! I hope you can survive.\n\n"
print "------------------------------\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "You have recieved a letter written in pretty print:\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "******************************\n\n"
print "Dear Mario, please come to the castle. I have baked you a cake.\n"
print "Love, Michael J. Fox.\n\n"
print "******************************\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "This is adlibs. Please enter an adjective for\n how you felt after reading that message: "
feeling1 = gets.chomp.to_s
print "\nAfter our hero read the message sent by Michael J. Fox, he felt #{feeling1}.\n\n"

print "What do you plan on doing next?\n\n"
print "(1 to go to the castle, or 2 to hunt down and kill Bob Hoskins.): "
choice1 = gets.to_i

castle = true

if choice1 == 2
castle = false
end

if castle == false
print "\n\nI hear Michael J. Fox has free candy.\n"
print "\nAre you sure (1 yes, 2 no): "
choice1 = gets.to_i
end

print "\nThe castle suddenly appears in front of you!\n\n"
print "(Enter to continue.)\n"
con = gets
print "You found some Bread!\n\n"
print "You found some Water!\n\n"
print "You found a stick! Of butter!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "An enemy appears!\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "*********** Your stats *************\n\n"
print "Level: 1\n"
print "Health: 10\n\n"
print "************************************\n\n"

#----- Cheapness begins -----

health1 = 10.to_i
attack1 = 1 + rand(3)

toastattack = 1 + rand(2)
toasthealth = 6

bread = 1
water = 1
butter = 1

level = 1

health = health1

game = true

#----- Life Loop -----

win_game = 1

while game == true

if health <= 1
game = false
win_game = 0
end

print "Bob Hoskins uses: Toaster!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Bob Hoskins has escaped.\n\n"
print "(Enter to continue.)\n\n"
con = gets
hit = toastattack
print "The Toaster burned you! You lost #{hit} Health.\n\n"
print "(Enter to continue.)\n\n"
con = gets
health = health - hit
print "You have #{health} Health remaining.\n\n"
print "Now is your chance! What would you like to do?\n"

action = 0

#-----Force them to use an Item-----

while action != 3
print "(1 Attack, 2 Run, 3 Use an item): "
action = gets.to_i
if action == 1
print "\n\nYour attack has failed! Try something else!"
end
if action == 2
print "\n\nYou cannot escape! This is a good toaster!"
end
end

#-----Only Water works-----

print "\n\nWhich item would you like to use?"
itemuse = 0
while itemuse != 2
print "\n\n(1 bread, 2 water, 3 Stick of butter): "
itemuse = gets.to_i
if itemuse == 1
print "\n\nThe toaster is not effected!"
end
if itemuse == 3
print "\n\nThe toaster is not effected!"
end
end
print "\n\nYou splashed the toaster with water.\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "The toaster is defeated!\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "LEVEL UP! \n\n"
print "(Enter to continue.)\n\n"
con = gets

print "You now have 20 Health!\n\n"
print "(Enter to continue.)\n\n"
con = gets
health = 20
attack1 = 1 + rand(5)

print "*********** Your stats *************\n\n"
print "Level: 2\n"
print "Health: 20\n\n"
print "************************************\n\n"
print "(Enter to continue.)\n\n"
con = gets

bobattack = 1 + rand(6)
hit = bobattack

print "BOB HOSKINS STRIKES FOR MASSIVE DAMAGE!\n\n"
print "(Enter to continue.)\n\n"
con = gets

health = health - hit

print "You lost #{hit} Health!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Bob Hoskins has escaped.\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "You have recieved: Spatula!\n\n"
game = false

end

game = true

while game == true

print "You enter the Castle. Michael J. Fox appears in front of you.\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Michael: Hello hero. I have been waiting for you!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Michael: Is is time to go... BACK to the FUTURE!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Michael J. Fox has sent you to the past! What!? He lied!\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "An enemy appears!\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "??????????????????+?+?+++++++???IO??+++++?+=$+++++++++++++++++++++++++++++++\n"
print "??????????++++++++++++++++++++ID+++++++++.+7=+++++++++++++++++++++++++++++++\n"
print "?+++++++++++++++++++++++++++~D?+++++++++:+=D+++++++=++++++++++++++++++++++++\n"
print "+++++++++++++++++++++++++~+78++++++++++++?$8I+++++++++++++++++++++++++++++++\n"
print "++++++++++++++++++++++++.+NO++++++++++++?ID+++++++++++++++++++++++++++++++++\n"
print "+++++++++++++++++++++++,:IZD=++++++++?I+=$++++++++++++++++++++++++++++++++++\n"
print "+++++++++++++++++++++:?~I$.=+++++++++=$?+D+++++++++++++++===================\n"
print "+++++++++++++++++++++=:+??=+=====+==++$+ID==================================\n"
print "+++++++++++=+========+++?$I========+=??I8+==================================\n"
print "=====================????IN+=======++??ID===================================\n"
print "=====================+?+?7$7=======I?DII8===================================\n"
print "=======================ID$7I7II=====IZ$DDO??================================\n"
print "=======================DD$$?IIII=7+I$7ZDNMI~===================~============\n"
print "=========================D8$$7Z$I7M?O$DZNN77+===================~===========\n"
print "=========================~ZOZ78I~+M7I$DDMNDNDN==========~=====~===~~~~~~~~~~\n"
print "============================D8++?Z$MN8MNMNDDNNN+Z=~~~~~~~~~~~~~~~~~=~~~~~~~~\n"
print "============~~=~~~~~~~~~~~~~=ZO7$7I8+7$$DI8DNNNNND7~=~~~~~~~~~~~~~~~~~~~~~~~\n"
print "~~~~~~~~~~~~~~~~~~~~~~~~~~+DDI?~,.7Z8:8DD$ODNNDNNNN8Z=~~~~~~~~~~~~~~~~~~~~~~\n"
print "~~~~~~~~~~~~~~~~~~~~~~~~~~+?ND==$I87=I8DD$8D++DNDNDDND~~~~~~~~~~~~~~~~~~~~~~\n"
print "~~~~~~~~~~~~~~~~~~~~?I7O77II7D?=?$??=7DDDD8+??IZDNDDNND~~~~~~~~~~~~~~~~~~~~~\n"
print "~~~~~~~~~~~~~~~~~~~+?I7O,DZ77$8I7=?IDZDDDDDI???ZDNDNDDDN~~~~~~~~~~~~~~~~~~~~\n"
print "~~~~~~~~~~~~~~~~~~~?I7ZDNN8$$$IIIOZ+O7DDDDN7I?IDDNNNDDDD~~~~~~~~~~~~~~~~:~~~\n"
print "~~~~~~~~~~~~~~~~~~?+7ONDZ$7+?7$Z7I888$O8DDMI??I$NNNNNNDDN:::::::::::::::::::\n"
print "~~~~~~~~~~~~:~::~~II$D8888$N+=I?+7ZI7Z8DNMM~+??$N,NNNNNDNN::::::::::::::::::\n"
print ":::~~::::::::::::?I8DDOZD8O8Z7+7=O7IZD8D8D7=D??7NMNNDMNNDD7:::::~:::::::::::\n"
print "::~:::::::::::::+IZD8+?I????+N7??=DDDDDDD8~$N???8NN??+??+?+?~::~=I::::::::::\n"
print ":::::::::::::::+I$D?I?+I?+ZNI=+?NMIDDDD88OO8OD?7NNN+IM?+?=++++==?+:$7$$7$O?8\n"
print "7::$O:::::::+II?I$$ON7+.NN8==+=?+NM:+==MMDDO~8?INNN??NNND~:++++?+?~++?D$DMOD\n"
print "8ZZZONZ~:::=?II8?Z+,+N8O7~+7NN77~$,+NO=~?M?$77?ONNM?$NNNNNND.=+88ND,,~+MDNMD\n"
print "O8O8DONI7I?$8O,DM~,ND888D+NM:=OOZO,M,7,,:=N=O$MMNN:I7MNMNNNNM+++M$DO~.??8ODD\n"
print "OODD?I$?:DZ$ZZ$==NDDZZZO+NOONO87N=NOD=:~7=Z+:=MZNM?ZNNNNNNNMOD+++NZD~N???~=8\n"
print "NZ?7I7NOZZZZZO++~O8O8O8+MD8,::D7=NMOMN=+NI=+ZMM$N+7DNNNNNNNNM=M+?+M8~MM???+8\n"
print "							GIANT ENEMY CRAB			 \n"
print "							   500/500 HP				\n"
print "(Enter to continue.)\n\n"
con = gets

crabattack = 1 + rand(4)
crit = 1 + rand(10)
critattack = crit

crab_health = 500

if critattack >= 5
critattack1 = true
end

choice = 0

hit = crabattack

print "GIANT ENEMY CRAB attacks!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "You lost #{hit} health!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Now is your chance! What would you like to do?\n"
print "(1 Attack, 2 Run, 3 Use an item): "
choice = gets.to_i

while choice != 3 #----- Gets them to use item. Get attacked if wrong choice.

if health <= 0
game = false
win_game = 0
end

hit = crabattack

print "GIANT ENEMY CRAB attacks!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "You lost #{hit} health!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Now is your chance! What would you like to do?\n"
print "(1 Attack, 2 Run, 3 Use an item): "
choice = gets.to_i

if choice == 1 #---If they choose attack

print "\n\nYour attack was blocked!\n\n"
print "(Enter to continue.)\n\n"
con = gets

hit = crabattack

print "GIANT ENEMY CRAB attacks!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "You lost #{hit} health!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "Now is your chance! What would you like to do?\n"
print "(1 Attack, 2 Run, 3 Use an item): "
choice = gets.to_i
end #--Attack end

if choice == 2 #---If they choose run

print "\n\nYou escape for one turn. You manage to rest.!\n\n"
print "(Enter to continue.)\n\n"
con = gets

rest_heal = 3 + rand(3)
rest = rest_heal
print "You have gained #{rest} Health!\n\n"

health = health + rest_heal

print "You currently have #{health} Health.\n\n"

end #--Run end

if choice == 3 #---If they use an item
  
print "\n\nWhich item would you like to use?"
itemuse = 0
while itemuse != 3
print "\n\n(1 bread, 2 Stick of Butter, 3 Spatula): "
itemuse = gets.to_i
if itemuse == 1
print "\n\nYou place the bread on top of the Enemy Crab."
print "(Enter to continue.)\n\n"
con = gets
end
if itemuse == 2
print "\n\nYou melt butter onto the Enemy Crab."
print "(Enter to continue.)\n\n"
con = gets
end
end

print "\n\nYou flip the crab over and reveal it's weak spot.\n"
print "(Enter to continue.)\n\n"
con = gets

print "Quickly! Attack it for Massive Damage!(1 Yes, 2 No): "
a4md = gets.to_i

if a4md == 2
print "The Enemy Crab flipped back over!\n\n"
print "(Enter to continue.)\n\n"
con = gets
break
end

massivedamage = 739 + rand(2537)
massive_hit = massivedamage + 1

crab_health = crab_health - massive_hit

print "You Smash the Giant Enemy Crab for #{massive_hit} damage!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "The Enemy Crab has 0/500 HP!\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "You win! You have defeated the Giant Enemy Crab.\n\n"
print "(Enter to continue.)\n\n"
con = gets

pop_points = 83 + rand(34)
pop_gain = pop_points - 4

print "You gain #{pop_gain} POPULARITY points!\n\n"
print "(Enter to continue.)\n\n"
con = gets
print "LEVEL UP!\n\n"
print "(Enter to continue.)\n\n"
con = gets

print "You now have 50 Health!\n\n"
print "(Enter to continue.)\n\n"
con = gets
health = 20
attack1 = 1 + rand(5)

print "*********** Your stats *************\n\n"
print "Level: 3\n"
print "Health: 50\n\n"
print "************************************\n\n"
print "(Enter to continue.)\n\n"
con = gets
game = false
end #--While end
end
end

if win_game == 0
print "\nYou have died. THE GAME IS OVER AND YOU LOST.\n\n"
end

print "\nYou won! You have escaped the horrible one sided RPG!\n\n"



Yeah, it's not very good, but this is his first game.

It's also not finished, but meh.

This post has been edited by 3e33: 04 June 2007 - 12:53 PM


Is This A Good Question/Topic? 0
  • +

Replies To: So my friend was making Blackjack...

#2 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 204
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: So my friend was making Blackjack...

Posted 04 June 2007 - 01:27 PM

it's also not a question, but... no, someone close this please.
Was This Post Helpful? 0
  • +
  • -

#3 spullen  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 10
  • View blog
  • Posts: 356
  • Joined: 22-March 07

Re: So my friend was making Blackjack...

Posted 04 June 2007 - 07:56 PM

dude, you post mad blackjack.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1