Jump to content



Photo
- - - - -

I've Made A... Uh, Thing?


  • Please log in to reply
18 replies to this topic

#1 tutti

tutti

    Casio Addict

  • Members
  • PipPipPip
  • 65 posts

  • Calculators:
    FX-9860G SD

Posted 23 April 2006 - 01:42 AM

I call it bounce... basically, you have a ball (O) that bounces back every time it hits a wall (#). This is fairly boring, but if you press EXE, the ball stops moving, and a cursor appears. You move it with the arrows. If you press EXE, you place a wall, and if you press DEL, you remove one. EXIT exits the editor and makes the ball keep going.

If the ball falls outside the edges, you get an error. I have no intention to fix this, you're not supposed to let it go past edges anyway. And don't fill the screen with walls, it won't stop the ball.

Program BOUNCE:
1->X
1->Y
[[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0][1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1][0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0][1,0,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,2,0,1][0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0][1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1][0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]]->Mat C
Lbl A
Mat C[Y,X]->T
T=1=>Locate X,Y,"#"
X+1->X
If X=22
Then 1->X
Y+1->Y
IfEnd
Y=8=>Goto B
Goto A
Lbl B
2->X
4->Y
1->A
1->B
Lbl C
Getkey=31=>Prog "EDIT"
X->C
Y->D
X+A->X
Y+B->Y
Locate X,Y,"O"
Locate C,D," "
Mat C[Y,X+1]=1=>-1->A
Mat C[Y,X-1]=1=>1->A
Mat C[Y+1,X]=1=>-1->B
Mat C[Y-1,X]=1=>1->B
Goto C

OR: http://h1.ripway.com/tutti/BOUNCE.CAT

Program EDIT:
X->M
Y->N
2->X
1->Y
Lbl A
X>1=>Locate X-1,Y,"-"
X<21=>Locate X+1,Y,"-"
Getkey->K
(K<>27)(K<>28)(K<>37)(K<>38)(K<>31)(K<>44)(K<>47)=1=>Goto A
X>1=>Locate X-1,Y," "
X<21=>Locate X+1,Y," "
If K=27
Then X+1->X
Y-1->Y
If (X>=21)(Y=<1)=0
Then X-1->X
Y+1->Y
IfEnd
IfEnd
If K=28
Then X-1->X
Y-1->Y
If (X=<1)(Y=<1)=0
Then X+1->X
Y+1->Y
IfEnd
IfEnd
If K=37
Then X+1->X
Y+1->Y
If (X>=21)(Y>=7)=0
Then X-1->X
Y-1->Y
IfEnd
IfEnd
If K=38
Then X-1->X
Y+1->Y
If (X=<1)(Y>=7)=0
Then X+1->X
Y-1->Y
IfEnd
IfEnd
If K=31
Then 1->Mat C[Y,X]
Locate X,Y,"#"
IfEnd
If K=44
Then 2->Mat C[Y,X]
Locate X,Y," "
IfEnd
K=47=>Goto Z
Goto A
Lbl Z
M->X
N->Y

OR: http://h1.ripway.com/tutti/BNCEDIT.CAT

#2 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 23 April 2006 - 05:21 AM

Wow, short and sweet - but its another game! Nice :)

#3 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 23 April 2006 - 07:18 AM

Even in such short program there are Goto's everywhere :(

#4 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 23 April 2006 - 08:37 AM

1->X~Y
'Write the folowing lines without a return char and leave this comment out
[[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]
[1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1]
[0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0]
[1,0,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,2,0,1]
[0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0]
[1,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1]
[0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0]]->Mat C
Do
Mat C[Y,X]=1=>Locate X,Y,"#"
Isz X
If X=22
Then 1->X
Isz Y
IfEnd
LpWhile Y<>8
2->X
4->Y
1->A~B
Do
Getkey=31=>Prog "EDIT"
X->C
Y->D
X+A->X
Y+B->Y
Locate X,Y,"O"
Locate C,D," "
Mat C[Y,X+1]=1=>-1->A
Mat C[Y,X-1]=1=>1->A
Mat C[Y+1,X]=1=>-1->B
Mat C[Y-1,X]=1=>1->B
LpWhile 1

I optimized it a little since the coding really seemed a pain in sense of speed ;)

Also you need to supply the program "EDIT" since it is called and you gave no source code for it.

#5 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 23 April 2006 - 11:25 AM

Hey guys I am just about finished the final levels for Maryo ...

When Im done Ill add it to the file sharing and post!

#6 tutti

tutti

    Casio Addict

  • Members
  • PipPipPip
  • 65 posts

  • Calculators:
    FX-9860G SD

Posted 23 April 2006 - 03:02 PM

Ouch, I forgot the edit program, I see. I thought I'd coded it into the program... well. *uploads*

#7 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 23 April 2006 - 03:22 PM

and my optimized version:

Program EDIT:
X->M:Y->N
2->X:1->Y
Do
X>1=>Locate X-1,Y,"-"
X<21=>Locate X+1,Y,"-"
Getkey->K
LpWhile (K<>27)(K<>28)(K<>37)(K<>38)(K<>31)(K<>44)(K<>47)
X>1=>Locate X-1,Y," "
X<21=>Locate X+1,Y," "
If K=27
Then Isz X:Y-1->Y
If (X>=21) (Y=<1)=0
Then DSZ X:ISZ Y
IfEnd:IfEnd
If K=28
Then X-1->X:DSZ Y
If (X=<1)(Y=<1)=0
Then ISZ X:ISZ Y
IfEnd:IfEnd
If K=37
Then ISZ X:ISZ Y
If (X>=21)(Y>=7)=0
Then DSZ X:DSZ Y
IfEnd:IfEnd
If K=38
Then X-1->X:ISZ Y
If (X=<1)(Y>=7)=0
Then ISZ X:DSZ Y
IfEnd:IfEnd
If K=31
Then 1->Mat C[Y,X]
Locate X,Y,"#"
IfEnd
If K=44
Then 2->Mat C[Y,X]
Locate X,Y," "
IfEnd
LpWhile K<>47
M->X:N->Y

Btw. his code was a total mess ... what do the multiplications do in the conditional statements? Why are they finished with a zero?

I found the edit program to be quite strange actually ...

*edit*
fixed some critical DSZs
Thanks for the tip overlord. Still I do not really know how this program is supposed to work, but I'm too lazy to test it ...
I don't get what tutti wanted to achive with multiplying the conditions ... if he multiplys them all conditions must be fulfilled to have a result of and. So it is like "and" ing them all. However, I don't understand this in the key testing loop .... Therefor I put or in there ...

*corrected some errors ;)

#8 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 23 April 2006 - 03:47 PM

Maybe there can be a problem with Dsz #, when # = 1 before (= 0 after) because it will jump the next instruction ?

#9 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 23 April 2006 - 07:19 PM

thought this was never the case ... wait ... I'll look into it again ...

I edited my comment.

#10 tutti

tutti

    Casio Addict

  • Members
  • PipPipPip
  • 65 posts

  • Calculators:
    FX-9860G SD

Posted 23 April 2006 - 08:03 PM

The result of a=b is 1 if the sentence is true, else it's 0. I used this to my advantage. But when I c+p'd the code from FA-123, I forgot to replace the ?'s with <>. I've fixed it now. It simply checks if K does not equal any of the keys that makes the program react, if it doesn't, it returns to test that. I find it a shorter way of testing what the keys are >_>

#11 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 24 April 2006 - 06:08 AM

ah! that must be <> signs ... thast explains it ;)
misinterpreted it a little. Thanks (good idea btw.)

#12 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 24 April 2006 - 06:45 AM

Wow, there are many ways of checking for keypresses, but that really is clever ..

EDIT: Yay, I've got a website where I will host Maryo 2 (as well as on the filesharing)

http://www.freewebs.com/thinkserver

#13 tutti

tutti

    Casio Addict

  • Members
  • PipPipPip
  • 65 posts

  • Calculators:
    FX-9860G SD

Posted 24 April 2006 - 12:19 PM

"Clever"? I didn't know that you could do true/false checks with the CFX until I discovered it by chance a few weeks ago... it wasn't a long stretch to use it for programs >_>

BTW: You do know that the original name is Mario... right?

#14 Andy.Davies

Andy.Davies

    Forum Ghost

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1547 posts
  • Gender:Male
  • Location:Dorset, England
  • Interests:Age: 18
    Studying: MEng in cybernetics at Reading uni
    Interests: Progaming (VB, VB.Net, C#, Casio Basic)
    Computers UBBD (Using, Building, Breaking &amp; Destroying)
    Gaming (FPS, RTS, RPG)
    Electronics
    Rock Music (Preferably Loud)
    Riley's (Pool &amp; Snooker Bar)
    Driving (Preferably fast)
    Aikedo (Martial Art)

  • Calculators:
    Algebra FX 2.0 ROM 1.01, FX9750G

Posted 24 April 2006 - 12:58 PM

@alias4399: you should submit your site to the The Casio Programming Webring

#15 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 24 April 2006 - 01:01 PM

The result of a=b is 1 if the sentence is true, else it's 0. I used this to my advantage. (...) It simply checks if K does not equal any of the keys that makes the program react, if it doesn't, it returns to test that. I find it a shorter way of testing what the keys are >_>

In my opinion this is just a huge loss of performance. :huh:
Even if the first condition is false (let's say that the user pressed the key "27"), you still try all the other conditions and multiply it by 0. I think you should simply use the "And" keyword between conditions (ie. LpWhile (K<>27 And K<>28 And K<>37 And ... And K<>47)), then if a condition if false the next ones will not be evaluated.
That's the theory, anyway... I remember something weird about that issue on Casio Basic: it is possible that the interpreter will still try all conditions even if something is false. I think it's worth giving a try ;)
Try something like
[[0]]->Mat A
If 1=0 And Mat A[1][5]=7 
Then ...
IfEnd
Normally this program should not raise any error, altough the condition Mat1[5 ]=7 uses an incorrect index in matrix A :rolleyes:

#16 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 25 April 2006 - 03:20 AM

@alias4399: you should submit your site to the The Casio Programming Webring


Thanks for the idea! :D

BTW: You do know that the original name is Mario... right?


Oh, yeah, and as for that, well i just use Mario and Maryo interchangeably :) though i should probably just stick to one. By the way, Maryo 2 Beta 1 is out in the filesharing now :)

#17 genesis

genesis

    UCF BASIC Programming Runner Up

  • Super Member
  • PipPipPipPip
  • 281 posts
  • Location:Perth, Australia
  • Interests:Speaking German, computers, defending CFX calculators...

  • Calculators:
    CFX 9850 GB+

Posted 25 April 2006 - 01:29 PM

[[0]]->Mat A
If 1=0 And Mat A[1][5]=7 
Then ...
IfEnd
Normally this program should not raise any error, altough the condition Mat1[5 ]=7 uses an incorrect index in matrix A :rolleyes:

Yes, that does cause an error, as the calculator must test all the conditions (it is impossible not to... its just one long logical statement that returns TRUE or FALSE, the whole statement must be tested even if its unnecessary). The only way to overcome this problem is of course, to use nested If statements.

While there are often clever ways to combine commands together, always do speed comparisons to test them, as sometimes the long way is faster. Often when I have two possible codes, I put them in a test program that runs them say, 1000 times so I can time with a stopwatch which is faster (perhaps there is a less cumbersome way to measure or even calcuate the exact runtime, I don't know).

#18 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 25 April 2006 - 03:59 PM

Yes, that does cause an error, as the calculator must test all the conditions (it is impossible not to... its just one long logical statement that returns TRUE or FALSE, the whole statement must be tested even if its unnecessary). The only way to overcome this problem is of course, to use nested If statements.

Huh. <_< I don't understand why they designed it like that :(

#19 alias4399

alias4399

    Casio Freak

  • Members
  • PipPipPipPip
  • 180 posts
  • Location:Impossible to say.. Its not like this is a constant!

  • Calculators:
    CFX 9850GB Plus
    FX 9860G

Posted 26 April 2006 - 10:15 AM

Any comments/bugs/suggestions from the beta testers of Maryo 2 ?

Please feel welcome to post them here!


If you do not already have it, you can get it from the filesharing here or on this website, here.

BETA 1:
Full Game: 60%
Plot: 0%
Levels: 30%
Graphics/FX: 75%
Menu: 75%

Thanks for testing! Beta 2 coming soon :D

EDIT: There is a bug in this version. The install program, M2Instal does not properly install, by not clearing List 6 (which is required for the game). Full details on the filesharing page (link above). This will be fixed in Beta 2.




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users