Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
19 June, 2013, 12:53:11 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2 3 ... 9   Go Down
  Print  
Author Topic: Stock Craze: a casio game -  (Read 6340 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
flyingfisch
I'm 1337 now!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« on: 26 September, 2011, 03:40:47 »
+1

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://www.omnimaga.org/index.php?topic=10612.msg193575#msg193575

1
[url=http://www.omnimaga.org/index.php?topic=10612.0][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"

1
2
3
4
5
6
7
8
9
//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"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//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"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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. Wink

(if you don't know why this has been deleted, see this post: http://www.omnimaga.org/index.php?topic=10612.msg193575#msg193575
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: 03 April, 2012, 03:00:29 by flyingfisch » Logged




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
mrmprog
LV7 Elite (Next: 700)
*******
Offline Offline

Last Login: 28 September, 2012, 05:58:25
Date Registered: 15 February, 2011, 01:35:36
Location: Somewhere
Posts: 559


Total Post Ratings: +34

View Profile
« Reply #1 on: 26 September, 2011, 03:43:52 »
0

I like the userbar, it looks good. Will this be real time?
Logged

flyingfisch
I'm 1337 now!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« Reply #2 on: 26 September, 2011, 03:45:19 »
0

Real time?
Logged




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
mrmprog
LV7 Elite (Next: 700)
*******
Offline Offline

Last Login: 28 September, 2012, 05:58:25
Date Registered: 15 February, 2011, 01:35:36
Location: Somewhere
Posts: 559


Total Post Ratings: +34

View Profile
« Reply #3 on: 26 September, 2011, 04:31:40 »
0

As in, the values of the stocks will change every so many minutes, instead of having a "next day" button.
« Last Edit: 26 September, 2011, 04:31:48 by mrmprog » Logged

flyingfisch
I'm 1337 now!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« Reply #4 on: 26 September, 2011, 22:52:17 »
0

Yes
Logged




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
mrmprog
LV7 Elite (Next: 700)
*******
Offline Offline

Last Login: 28 September, 2012, 05:58:25
Date Registered: 15 February, 2011, 01:35:36
Location: Somewhere
Posts: 559


Total Post Ratings: +34

View Profile
« Reply #5 on: 26 September, 2011, 22:57:07 »
0

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

flyingfisch
I'm 1337 now!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« Reply #6 on: 26 September, 2011, 23:02:41 »
0

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




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
BalancedFury
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 08 July, 2012, 18:33:02
Date Registered: 08 September, 2011, 02:29:48
Location: At home :D
Posts: 722


Total Post Ratings: +27

View Profile
« Reply #7 on: 27 September, 2011, 00:33:04 »
0

Our school is just starting to play the stock market game... lol
*High Pitched voice* Coincidence~~
« Last Edit: 27 September, 2011, 00:33:27 by DualBLDR » Logged

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!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« Reply #8 on: 27 September, 2011, 16:55:19 »
0

Alright, guys. What are some big stocks that you would like to see in this game?
Logged




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
boot2490
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 05:54:45
Date Registered: 27 February, 2011, 07:39:51
Location: Pittsburgh, PA
Posts: 605


Total Post Ratings: +18

View Profile WWW
« Reply #9 on: 27 September, 2011, 16:59:52 »
0

GOOG
NASDAQ
DOW JONES
Logged

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!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« Reply #10 on: 27 September, 2011, 17:16:27 »
0

Added
Logged




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
boot2490
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 05:54:45
Date Registered: 27 February, 2011, 07:39:51
Location: Pittsburgh, PA
Posts: 605


Total Post Ratings: +18

View Profile WWW
« Reply #11 on: 27 September, 2011, 23:18:32 »
0

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

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!
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 21:54:36
Date Registered: 26 August, 2011, 21:18:14
Location: OH, USA
Posts: 1497


Topic starter
Total Post Ratings: +74

View Profile WWW
« Reply #12 on: 28 September, 2011, 00:40:47 »
0

Arcade and casual is a good idea. and yes, by all means program it for the TI calcs!
Logged




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
« Reply #13 on: 28 September, 2011, 01:27:36 »
0

GOOG
NASDAQ
DOW JONES

S&P500
ASBAD
Logged
BalancedFury
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 08 July, 2012, 18:33:02
Date Registered: 08 September, 2011, 02:29:48
Location: At home :D
Posts: 722


Total Post Ratings: +27

View Profile
« Reply #14 on: 28 September, 2011, 01:30:12 »
0

Add NYSE
Logged

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.
Pages: [1] 2 3 ... 9   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.508 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.