Prog "STOCK"
//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"
//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"
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"
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