The Apple Game!

User projects written in or related to FreeBASIC.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

The Apple Game!

Postby KristopherWindsor » Feb 08, 2008 5:07

Don't look at the code before you run it; that will give away the plot line!
xD

Code: Select all

' The Apple Game! v1.0
' (C) 2008 Innova and Kristopher Windsor

' Formerly known as "The Apple Naming Scheme in a Nutshell"

Const s_max = 10

#define i & s_next() &
#define i2 & s_next(-1) &

#macro story(s, t)
  If Len(s) > 0 Then
    Print
    Print s;
  Else
    Print speaker;
  End If
 
  Print ":", t
  Sleep
  If Len(s) > 0 Then speaker = s
#endmacro

Dim Shared As Integer s_total, a, b
Dim Shared As String s(1 To s_max), s_in, speaker

Function s_next (Byval repeat As Integer = 0) As String
  Static As Integer s_current
 
  If repeat = 0 Then
    s_current += 1
    If s_current > s_total Then s_current = 1
  End If
 
  Return s(s_current)
End Function

Sub s_start ()
  Print "Enter a sentence that has at least 10 words (without punctuation)"
  Input s_in
 
  'split into array
  s_in = Trim(s_in)
  Do
    b = a
    a = Instr(a + 1, s_in, " ")
    If a = 0 Then a = Len(s_in) + 1
   
    If s_total < s_max Then
      s_total += 1
      s(s_total) = Mid(s_in, b + 1, a - b - 1)
    End If
  Loop Until a = Len(s_in) + 1
 
  'fix capitalization and add i
  For a = 1 To s_total
    s(a) = "i" & Ucase(Left(s(a), 1)) + Lcase(Right(s(a), Len(s(a)) - 1))
  Next a
End Sub

s_start

story("Narrator", "Is that the best you could come up with?")
story("", "Well, let's go shopping...")

story("Title Bot", "-  <[ The Day at the Apple Store ]>  -")
story("", "- AKA, I talked to a fruity employee -")

'iPod

story("Salesman", "Welcome to Apple!")
story("", "Would you like an " i "?")
story("", "Or maybe an " i "?")
story("", "It holds " & Int(Timer * 10) & " songs and has a built-in sarcasm detector!")

story("Me", "No thanks.")
story("", "I actually came here to find out how much the 8TB " i " is.")
story("", "I already have the 6TB version...")
story("", "But I want this one since it plays Pong.")

story("Salesman", "We just got a new shipment of those half a minute ago!")
story("", "What color would you like? Black? White?")
story("", "Black?")

story("Me", "I was actually hoping more for #8888FF.")
story("", "(That's CSS for &HFF8888FF.)")
story("", "I'd also like to get the " i " while I'm here.")

'Mac Air

story("Narrator", "I hope this guy gets paid on commission!")

story("Salesman", "The " i2 "?")
story("", "We just replaced that with the " i2 " Mini!")
story("", "For only $3999, you get the thinnest model ever made!")
story("", "And it has a lava lamp on the other side of the LCD!")

story("Me", "How much RAM does it have?")

story("Salesman", "None, but you can leech RAM through Wi-Fi...")
story("", "From another computer!")
story("", "And for $39.99 / month...")
story("", "You can subscribe to wirelessly use the Pentagon's video cards!")

story("Me", "Great! I'll take one!")
story("", "I also heard Steve made a new " i "?")

'iPhone

story("Salesman", "Yes - the display even rotates when the device does!")

story("Me", "So how can you use it while being hung by your legs?")

story("Salesman", "The next software upgrade has an option for that...")
story("", "It also lets you put a shortcut to that setting...")
story("", "Right on the home screen!")

story("Me", "Will the " i2 " make me more attractive?")

story("Salesman", "Of course!")
story("", "Especially among blind and deaf people!")
story("", "Just ask our marketing committee!")

'iRumors

story("Store TV", "_This_ just in!")
story("", "Rumors have circulated that Apple is expected...")
story("", "To release a new product named the " i ".")
story("", "Reports are not confirmed, but it will cost $499...")
story("", "And be filed as Patent No. " & Int(Rnd * 1E12) & "...")
story("", "With an expected release date of 8:17 AM sometime next month.")

story("Me", "Wow, I want one of those!")
story("", "It sounds as good as the " i ", but is $50 less!")

'iTunes

story("Telephone", "*Ring* *Ring*")

story("Salesman", "Hello? Your " i " isn't running smoothly?")
story("", "Your computer is 2 months old?")
story("", "These are modern times, sir...")
story("", "We don't support such antiques. Try upgrading.")

story("Telephone", "*Click*")

story("Salesman", "Next in line!")

story("Me", "iThink iLl iLeave iNow.")

story("Salesman", "Goodbye! Come back soon to see our " i " and " i " products!")

story("Door", "*Slam*")

'conclusion

story("Narrator", "Congratulations! You escaped!")

story("Score Bot", "You get +1000 points for surviving...")
story("", "Which gives you the high score!")
story("", "You get eternal fame, and a fee of $4399 for playing.")
story("", "In conclusion...")

story("Music Bot", "*Plays suspenseful music*")

story("", "Are you ready for Level 2?")

story("Narrator", "- The End -")

'credits

story("Credits Bot", "- Credits -")
story("", "Narrator  - Kristopher Windsor")
story("", "Telephone - Mel Blanc")
story("", "Store TV  - Anonymous Newspaper Columnist")
story("", "Salesman  - Crazy Eddie")
story("", "Me        - Uncle Sam")

story("EOF Bot", "Press any key to continue...")


Tags: kristopherwindsor_program_game
Last edited by KristopherWindsor on Mar 22, 2008 6:36, edited 1 time in total.
Pritchard
Posts: 5418
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Postby Pritchard » Feb 08, 2008 6:53

Oh my, this is lovely! Added just a small code snippet, however:

Code: Select all

' The Apple Game! v1.0
' (C) 2008 Innova and Kristopher Windsor

' Formerly known as "The Apple Naming Scheme in a Nutshell"

Const s_max = 10

#define i & s_next() &
#define i2 & s_next(-1) &

#macro story(s, t)
  If Len(s) > 0 Then
    Print
    Print s;
  Else
    Print speaker;
  End If
 
  Print ":", t
  Sleep
  If Len(s) > 0 Then speaker = s
#endmacro

Dim Shared As Integer s_total, a, b
Dim Shared As String s(1 To s_max), s_in, speaker

Function s_next (Byval repeat As Integer = 0) As String
  Static As Integer s_current
 
  If repeat = 0 Then
    s_current += 1
    If s_current > s_total Then s_current = 1
  End If
 
  Return s(s_current)
End Function

Sub s_start ()
  Print "Enter a sentence that has at least 10 words (without punctuation)"
  Input s_in
  if ( s_in = "a sentence that has at least 10 words without punctuation" ) then
     print "HAHAHAHAAHH!!!!!"
     sleep
     end
  end if
 
  'split into array
  s_in = Trim(s_in)
  Do
    b = a
    a = Instr(a + 1, s_in, " ")
    If a = 0 Then a = Len(s_in) + 1
   
    If s_total < s_max Then
      s_total += 1
      s(s_total) = Mid(s_in, b + 1, a - b - 1)
    End If
  Loop Until a = Len(s_in) + 1
 
  'fix capitalization and add i
  For a = 1 To s_total
    s(a) = "i" & Ucase(Left(s(a), 1)) + Lcase(Right(s(a), Len(s(a)) - 1))
  Next a
End Sub

s_start

story("Narrator", "Is that the best you could come up with?")
story("", "Well, let's go shopping...")

story("Title Bot", "-  <[ The Day at the Apple Store ]>  -")
story("", "- AKA, I talked to a fruity employee -")

'iPod

story("Salesman", "Welcome to Apple!")
story("", "Would you like an " i "?")
story("", "Or maybe an " i "?")
story("", "It holds " & Int(Timer * 10) & " songs and has a built-in sarcasm detector!")

story("Me", "No thanks.")
story("", "I actually came here to find out how much the 8TB " i " is.")
story("", "I already have the 6TB version...")
story("", "But I want this one since it plays Pong.")

story("Salesman", "We just got a new shipment of those half a minute ago!")
story("", "What color would you like? Black? White?")
story("", "Black?")

story("Me", "I was actually hoping more for #8888FF.")
story("", "(That's CSS for &HFF8888FF.)")
story("", "I'd also like to get the " i " while I'm here.")

'Mac Air

story("Narrator", "I hope this guy gets paid on commission!")

story("Salesman", "The " i2 "?")
story("", "We just replaced that with the " i2 " Mini!")
story("", "For only $3999, you get the thinnest model ever made!")
story("", "And it has a lava lamp on the other side of the LCD!")

story("Me", "How much RAM does it have?")

story("Salesman", "None, but you can leech RAM through Wi-Fi...")
story("", "From another computer!")
story("", "And for $39.99 / month...")
story("", "You can subscribe to wirelessly use the Pentagon's video cards!")

story("Me", "Great! I'll take one!")
story("", "I also heard Steve made a new " i "?")

'iPhone

story("Salesman", "Yes - the display even rotates when the device does!")

story("Me", "So how can you use it while being hung by your legs?")

story("Salesman", "The next software upgrade has an option for that...")
story("", "It also lets you put a shortcut to that setting...")
story("", "Right on the home screen!")

story("Me", "Will the " i2 " make me more attractive?")

story("Salesman", "Of course!")
story("", "Especially among blind and deaf people!")
story("", "Just ask our marketing committee!")

'iRumors

story("Store TV", "_This_ just in!")
story("", "Rumors have circulated that Apple is expected...")
story("", "To release a new product named the " i ".")
story("", "Reports are not confirmed, but it will cost $499...")
story("", "And be filed as Patent No. " & Int(Rnd * 1E12) & "...")
story("", "With an expected release date of 8:17 AM sometime next month.")

story("Me", "Wow, I want one of those!")
story("", "It sounds as good as the " i ", but is $50 less!")

'iTunes

story("Telephone", "*Ring* *Ring*")

story("Salesman", "Hello? Your " i " isn't running smoothly?")
story("", "Your computer is 2 months old?")
story("", "These are modern times, sir...")
story("", "We don't support such antiques. Try upgrading.")

story("Telephone", "*Click*")

story("Salesman", "Next in line!")

story("Me", "iThink iLl iLeave iNow.")

story("Salesman", "Goodbye! Come back soon to see our " i " and " i " products!")

story("Door", "*Slam*")

'conclusion

story("Narrator", "Congratulations! You escaped!")

story("Score Bot", "You get +1000 points for surviving...")
story("", "Which gives you the high score!")
story("", "You get eternal fame, and a fee of $4399 for playing.")
story("", "In conclusion...")

story("Music Bot", "*Plays suspenseful music*")

story("", "Are you ready for Level 2?")

story("Narrator", "- The End -")

'credits

story("Credits Bot", "- Credits -")
story("", "Narrator  - Kristopher Windsor")
story("", "Telephone - Mel Blanc")
story("", "Store TV  - Anonymous Newspaper Columnist")
story("", "Salesman  - Crazy Eddie")
story("", "Me        - Uncle Sam")

story("EOF Bot", "Press any key to continue...")
 
Lachie Dazdarian
Posts: 2204
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Postby Lachie Dazdarian » Feb 10, 2008 19:31

Funny. But why did you call it a game?
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Feb 11, 2008 1:32

So I can beat sir_mud's last ASCII game (his entry in the competition)?
Ryan
Posts: 693
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Postby Ryan » Feb 11, 2008 4:14

Mel Blanc made the show.
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Feb 11, 2008 5:05

Pritchard wrote:Oh my, this is lovely! Added just a small code snippet, however:


What did you add?
Pritchard
Posts: 5418
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Postby Pritchard » Feb 11, 2008 5:34

notthecheatr wrote:
Pritchard wrote:Oh my, this is lovely! Added just a small code snippet, however:
What did you add?
It's a secret... And not hard to find?
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Feb 11, 2008 5:48

Oh, OK, found it.

You're a literalist, just like my younger siblings. If I tell them to say something, they'll just repeat my exact words like that :P

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 3 guests