Author Topic: Stock Craze: a casio game  (Read 53479 times)

0 Members and 1 Guest are viewing this topic.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Stock Craze: a casio game
« on: September 25, 2011, 09:40:47 pm »
I am making a stock market game in BASIC for casio calculators.


Put this in your sig if you want your username included. Read this post: http://ourl.ca/13209/247699
Code: [Select]
[url=http://ourl.ca/13209][img]http://userbars.removedfromgame.com/ub/flyingfisch312.png[/img][/url]
Post suggestions below, please.

EDIT 9/29/2011 22:30 EST:

Usernames to be included (0 more spots):

FFSH: flyingfisch
YJNC: YeongJiN_Cool
JUJU: Juju
BOOT: Boot2490
FNLE: FinaleTI
TQWH: TuriqWalrus Holdings
DBDR: DualBuilder
ZLDA: ZeldaKing
MACH: m1ac4 Holdings
PMAN: pianoman
BLFC: Deep Thought
ANOR: Annoying Orange
TGME: The Game >:-)
TTYY: Totoyo
EYRN: Eiyeron
PSPD: Parser Padwan
SPYR: Spyro543
OMNI: Omnimaga, duh!
CASC: CasioCalc.org
PLCS: Planete-Casio.com or planet-casio.fr


EDIT 9/29/2011: I am currently taking a course at Khan Academy for finance to make this THE best on-calc stock market game ever!

EDIT 9/29/2011 18:45 EST: Main engine coded. will post code soon!

EDIT 9/30/2011

I am releasing the code. It is still being optimized and debugged and some is pseudo-code.


Spoiler For matrix setup:
Mat A = stocks
Top row=Current price
2 and 3 rows=last two prices
row 4=how much you own

Mat B = avg of all stocks (market)
row 1=avg
row 2=prev avg

Mat C =Personal data (Highscores, cash on hand)
row 1=Cash on hand
rows 2-4=High Scores
Spoiler For Code:
Prog "STOCK"
Code: [Select]
//Splash screen goes here
Menu "Stock Craze","Play",1,"Help",2,"Credits",3
Lbl 1
Prog "ENG"
Lbl 2
"help goes here"
Lbl 3
"Credits"
prog "ENG"
Code: [Select]
//Setup
"FFSHBOOTDBLD..." -> Str 1 //puts all the names of the stocks in a string. must have 20 names, no more, no less.

[[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100][100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,]] -> Mat A

[[0][0]] -> Mat B

[[1000][0][0][0]] -> Mat C

While A = 1
For 1 -> J to 20
RandInt(1,10) -> S
Rand# -> R

Mat A[2,J] < Mat A[3,J] => P-1 -> P
Mat A[2,J] > Mat A[3,J] => P+1 -> P

R > P*0.05+0.50 => 1 -> D
R < P*0.05+0.50 => -1 -> D
R = P*0.05+0.50 => 0 -> D

Rand# -> r  //the r used here is the one that stand for radians, or whatever.

S=1 => r*10 -> theta
S<3 => r*5 -> theta
S<6 => r*2 -> theta
S<10 => r -> theta

//assigns the new price
D=1 => Mat A[2,J]+theta -> Mat A[1,J]
D=1 => Mat A[2,J]-theta -> Mat A[1,J]
D=1 => Mat A[2,J] -> Mat A[1,J]

For 1 -> H to 20
Mat A[1,H]+P -> P
//end of "for" loop
Mat B[1,1] -> Mat B[2,1]
P/20 -> Mat B[1,1]


//end of "for" loop
Next

Prog "Disp"

For 1 -> I to 20
//If exit
E=1 => Break
//else move each row down one
Mat A[2,I] -> Mat A[3,I]
Mat A[1,I] -> Mat A[2,I]
//end "for" loop
Next
//End while loop
WhileEnd

//scoring system goes here
//Thanks for playing message goes here
Prog "DISP"
Code: [Select]
Lbl 0
1 -> B
//Displays the UI
//Begin pseudo-code
Display "Stock craze" in upper left corner of screen
Display Mat C[2,1] on the upper right side of the screen
Display "Day" to left of Mat C[2,1]
Display "Average" just below "stock craze"
Display Mat B[1,1] at left
Display a $ sign and amount of money (Mat C[1,1]) at bottom


//end pseudo-code

1->J
1->K //#'s for K and J will be determined at a later date, I do not know what they will be right now :S
0 -> L
B*20 -> C

For C -> I to C+40 step 4
StrMid(Str1,I,I+4) -> Str2 //extracts the name of stock from str1
Text K,I,Str2

//diplay names of first 10 stocks
J+15 -> J
If L=0
then If J>58
then 126/2 -> K
IfEnd
IfEnd
//end "for" loop
Next

//Displays prices of first 10 stocks
B*10 -> C
0 -> L
1 -> J
6 -> K

For C -> I to C+10
Text K,J,Mat A[1,I]
J+15 -> J
If L=0
then If J>58
then (126/2)+6 -> K
IfEnd
IfEnd
//end "for" loop
Next

//"for" loop is used as a timer here
For 1 -> I to 1000
Getkey -> G

If B=2 //if on page 2 (B is the page number)
then If G=79 //79 = F1 key
then 1 -> B //Brings us to page 1
Goto 0 //go back to top and display the next page
IfEnd
IfEnd

If B=1
then If G=29 //29 = F6 Key
then 2 -> B
Goto 0
IfEnd
IfEnd

If G=78 //78=Shift Key
then 1 -> A //A is used to determine Bye or sell in prog "trade" (1 is buy, 2 is sell)
Prog "TRADE"
IfEnd

If G=77 //77=Alpha Key
then 2 -> A
Prog "TRADE"
IfEnd

Next
prog "TRADE"
Code: [Select]
menu "STOCKS","STK1",... //list all stocks

Lbl 1
1 -> Z
Goto X

Lbl 2
2 -> Z
Goto X

...

Lbl X
A=2 => Goto Z
If A=1
then ClrText
Lbl Y
"How much do you want to buy"? -> A

A*Mat A[1,Z] > Mat C[1,1] => Goto Y
Mat C[1,1]-(A*Mat A[1,Z]) -> Mat C[1,1] //subtracts cost from cash on hand
A+Mat A[4,Z] -> Mat A[4,Z] //records how much stock you have, now
Goto 0

IfEnd

Lbl Z
If A=2
then ClrText
Locate 1,1,"You have this amount of stock:"
Locate 2,1,Mat A[4,Z]
//little black triangle goes here to pause until user presses EXE

Lbl W
Clrtext
"how much do you want to sell"? -> A
A > Mat A[4,Z] => Goto W
Mat C[1,1]+(A*Mat A[1,Z]) -> Mat C[1,1] //adds the amount sold to your total cash
Mat A[4,Z]-A -> Mat A[4,Z]

IfEnd

Lbl 0

If you don't uderstand something in the code up there, post and I will try to enlighten you. ;)

(if you don't know why this has been deleted, see this post: http://ourl.ca/13209/247699
Spoiler For deleted:
EDIT 9/27/2011:

Markets to be included:

NASDAQ
NYSE

Indexes to be included:

DOW JONES
S&P500

Companies to be included (post if you want more!):

NASDAQ:
YHOO: Yahoo
GOOG: Google
AAPL: Apple
DELL: Dell
MSFT: Microsoft

NYSE:
TXN: TI
IBM: IBM
GM: GM


« Last Edit: April 02, 2012, 09:00:29 pm by flyingfisch »



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Stock Craze: a casio game
« Reply #1 on: September 25, 2011, 09:43:52 pm »
I like the userbar, it looks good. Will this be real time?

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Stock Craze: a casio game
« Reply #2 on: September 25, 2011, 09:45:19 pm »
Real time?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Stock Craze: a casio game
« Reply #3 on: September 25, 2011, 10:31:40 pm »
As in, the values of the stocks will change every so many minutes, instead of having a "next day" button.
« Last Edit: September 25, 2011, 10:31:48 pm by mrmprog »

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Stock Craze: a casio game
« Reply #4 on: September 26, 2011, 04:52:17 pm »
Yes



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Stock Craze: a casio game
« Reply #5 on: September 26, 2011, 04:57:07 pm »
Good. The first game I ever made was a stock game in basic. It was horrible. I hope you game turns out well. These types of games have always interested me. How closely will the stocks be connected? Like if you buy a huge amount of one, will prices change on others?

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Stock Craze: a casio game
« Reply #6 on: September 26, 2011, 05:02:41 pm »
I have always  liked stock games, too. Yes, buying a large amount of stock will affect the others. Also, I will try to get all the big stocks up there, as well as bonds. I will have to do a bt of research because I'm not extremely well versed in stocks. :P There will also be some real life scenarios (bankruptcy,swindling, etc.), so stay tuned. ;)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline BalancedFury

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 722
  • Rating: +29/-2
    • View Profile
Re: Stock Craze: a casio game
« Reply #7 on: September 26, 2011, 06:33:04 pm »
Our school is just starting to play the stock market game... lol
*High Pitched voice* Coincidence~~
« Last Edit: September 26, 2011, 06:33:27 pm by DualBLDR »
Antonio Nam = DualBLDR = Tony Arthur... U choose!





JOIN THE PETITION TO ADD THIS EMOTICON!!
[|:{P ------->


Yo dawg I herd u lost the game game so I coded the game game in your calc so you can lose the game game while you code your code about losing the game game.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Stock Craze: a casio game
« Reply #8 on: September 27, 2011, 10:55:19 am »
Alright, guys. What are some big stocks that you would like to see in this game?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline boot2490

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 607
  • Rating: +54/-36
    • View Profile
    • Boot2490's Stuff
Re: Stock Craze: a casio game
« Reply #9 on: September 27, 2011, 10:59:52 am »
GOOG
NASDAQ
DOW JONES
I'm not worried about SOPA creating censorship, that will not stand for long. I'm worried that they'll succeed in stopping piracy!

Spoiler For Signature, updated march 23, 11:28 PM EST:















An useful tool!

PM me if you need some help. I am glad to be of assistance and part of the TI Communnity.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Stock Craze: a casio game
« Reply #10 on: September 27, 2011, 11:16:27 am »
Added



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline boot2490

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 607
  • Rating: +54/-36
    • View Profile
    • Boot2490's Stuff
Re: Stock Craze: a casio game
« Reply #11 on: September 27, 2011, 05:18:32 pm »
Can I make a TI BASIC version of this? I like the idea.
Oh, and you should have two modes:
Arcade mode, where stocks update real time and you have to stay in the black for as long as possible, and
Casual mode, with a "Next day" button, and it is less intense and you don't lose, just attend to it.
Two different games, but one game. Like the idea?
I'm not worried about SOPA creating censorship, that will not stand for long. I'm worried that they'll succeed in stopping piracy!

Spoiler For Signature, updated march 23, 11:28 PM EST:















An useful tool!

PM me if you need some help. I am glad to be of assistance and part of the TI Communnity.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Stock Craze: a casio game
« Reply #12 on: September 27, 2011, 06:40:47 pm »
Arcade and casual is a good idea. and yes, by all means program it for the TI calcs!



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Ashbad

  • Guest
Re: Stock Craze: a casio game
« Reply #13 on: September 27, 2011, 07:27:36 pm »

Offline BalancedFury

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 722
  • Rating: +29/-2
    • View Profile
Re: Stock Craze: a casio game
« Reply #14 on: September 27, 2011, 07:30:12 pm »
Add NYSE
Antonio Nam = DualBLDR = Tony Arthur... U choose!





JOIN THE PETITION TO ADD THIS EMOTICON!!
[|:{P ------->


Yo dawg I herd u lost the game game so I coded the game game in your calc so you can lose the game game while you code your code about losing the game game.