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

0 Members and 1 Guest are viewing this topic.

#### 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
##### 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.

Code: [Select]
[url=http://ourl.ca/13209][img]http://userbars.removedfromgame.com/ub/flyingfisch312.png[/img][/url]

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
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 hereMenu "Stock Craze","Play",1,"Help",2,"Credits",3Lbl 1Prog "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 CWhile A = 1For 1 -> J to 20RandInt(1,10) -> SRand# -> RMat A[2,J] < Mat A[3,J] => P-1 -> PMat A[2,J] > Mat A[3,J] => P+1 -> PR > P*0.05+0.50 => 1 -> DR < P*0.05+0.50 => -1 -> DR = P*0.05+0.50 => 0 -> DRand# -> r  //the r used here is the one that stand for radians, or whatever.S=1 => r*10 -> thetaS<3 => r*5 -> thetaS<6 => r*2 -> thetaS<10 => r -> theta//assigns the new priceD=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 20Mat A[1,H]+P -> P//end of "for" loopMat B[1,1] -> Mat B[2,1]P/20 -> Mat B[1,1]//end of "for" loopNextProg "Disp"For 1 -> I to 20//If exitE=1 => Break//else move each row down oneMat A[2,I] -> Mat A[3,I]Mat A[1,I] -> Mat A[2,I]//end "for" loopNext//End while loopWhileEnd//scoring system goes here//Thanks for playing message goes hereProg "DISP"
Code: [Select]
Lbl 01 -> B//Displays the UI//Begin pseudo-codeDisplay "Stock craze" in upper left corner of screenDisplay Mat C[2,1] on the upper right side of the screenDisplay "Day" to left of Mat C[2,1]Display "Average" just below "stock craze"Display Mat B[1,1] at leftDisplay a \$ sign and amount of money (Mat C[1,1]) at bottom//end pseudo-code1->J1->K //#'s for K and J will be determined at a later date, I do not know what they will be right now :S0 -> LB*20 -> CFor C -> I to C+40 step 4StrMid(Str1,I,I+4) -> Str2 //extracts the name of stock from str1Text K,I,Str2//diplay names of first 10 stocksJ+15 -> JIf L=0then If J>58then 126/2 -> KIfEndIfEnd//end "for" loopNext//Displays prices of first 10 stocksB*10 -> C0 -> L1 -> J6 -> KFor C -> I to C+10Text K,J,Mat A[1,I]J+15 -> JIf L=0then If J>58then (126/2)+6 -> KIfEndIfEnd//end "for" loopNext//"for" loop is used as a timer hereFor 1 -> I to 1000Getkey -> GIf B=2 //if on page 2 (B is the page number)then If G=79 //79 = F1 keythen 1 -> B //Brings us to page 1Goto 0 //go back to top and display the next pageIfEndIfEndIf B=1then If G=29 //29 = F6 Keythen 2 -> BGoto 0IfEndIfEndIf G=78 //78=Shift Keythen 1 -> A //A is used to determine Bye or sell in prog "trade" (1 is buy, 2 is sell)Prog "TRADE"IfEndIf G=77 //77=Alpha Keythen 2 -> AProg "TRADE"IfEndNextprog "TRADE"
Code: [Select]
menu "STOCKS","STK1",... //list all stocksLbl 11 -> ZGoto XLbl 22 -> ZGoto X...Lbl XA=2 => Goto ZIf A=1then ClrTextLbl Y"How much do you want to buy"? -> AA*Mat A[1,Z] > Mat C[1,1] => Goto YMat C[1,1]-(A*Mat A[1,Z]) -> Mat C[1,1] //subtracts cost from cash on handA+Mat A[4,Z] -> Mat A[4,Z] //records how much stock you have, nowGoto 0IfEndLbl ZIf A=2then ClrTextLocate 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 EXELbl WClrtext"how much do you want to sell"? -> AA > Mat A[4,Z] => Goto WMat C[1,1]+(A*Mat A[1,Z]) -> Mat C[1,1] //adds the amount sold to your total cashMat A[4,Z]-A -> Mat A[4,Z]IfEndLbl 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
AAPL: Apple
DELL: Dell
MSFT: Microsoft

NYSE:
TXN: TI
IBM: IBM
GM: GM

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

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

#### mrmprog

• LV7 Elite (Next: 700)
• Posts: 559
• Rating: +35/-1
##### 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?

#### 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
##### Re: Stock Craze: a casio game
« Reply #2 on: September 25, 2011, 09:45:19 pm »
Real time?

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

#### mrmprog

• LV7 Elite (Next: 700)
• Posts: 559
• Rating: +35/-1
##### 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 »

#### 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
##### Re: Stock Craze: a casio game
« Reply #4 on: September 26, 2011, 04:52:17 pm »
Yes

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

#### mrmprog

• LV7 Elite (Next: 700)
• Posts: 559
• Rating: +35/-1
##### 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?

#### 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
##### 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. There will also be some real life scenarios (bankruptcy,swindling, etc.), so stay tuned.

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

#### BalancedFury

• Posts: 722
• Rating: +29/-2
##### 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.

#### 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
##### 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?

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

#### boot2490

• LV7 Elite (Next: 700)
• Posts: 607
• Rating: +54/-36
##### 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.

#### 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
##### Re: Stock Craze: a casio game
« Reply #10 on: September 27, 2011, 11:16:27 am »

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

#### boot2490

• LV7 Elite (Next: 700)
• Posts: 607
• Rating: +54/-36
##### 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.

#### 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
##### 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!

"welcome to the world of computers, where everything seems to be based on random number generators"

The Game V. 2.0

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

#### BalancedFury

• Posts: 722
• Rating: +29/-2
##### Re: Stock Craze: a casio game
« Reply #14 on: September 27, 2011, 07:30:12 pm »