This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. 68k Calculator Basic => TI-BASIC
Author Message
SilverCalcKnight
|_


Active Member


Joined: 15 Nov 2005
Posts: 577

Posted: 20 Jun 2006 12:43:53 pm    Post subject:

D'oh, never mind... accursed pxltest returns a "true" "false" answer...
/me shakes fist @ TI-OS designers...


Last edited by Guest on 20 Jun 2006 01:06:20 pm; edited 1 time in total
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 20 Jun 2006 01:12:07 pm    Post subject:

What exactly is the problem? Since you edited that first post, I have no idea what this is about. Is this about that CS thing, or what?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Jun 2006 01:13:44 pm    Post subject:

Presumably he tried to use a pxl-Test assuming it would return 0 or 1, but it returned true or false instead. Sigh. Cursed 83-series users. Wink

Last edited by Guest on 20 Jun 2006 01:16:15 pm; edited 1 time in total
Back to top
SilverCalcKnight
|_


Active Member


Joined: 15 Nov 2005
Posts: 577

Posted: 20 Jun 2006 01:20:20 pm    Post subject:

But now how am I going to port Super Speler's Strange Game Idea to the 89? If statements to change the "true" "false" answers to 0 or 1 might be too slow.

@IAAC: No, this isn't about CS. That I'll work on once I've got this finished.

-=SilverCalcKnight=-
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 20 Jun 2006 01:24:51 pm    Post subject:

You could use [font="courier new"]when( instead. e.g. [font="courier new"]when(condition,iftrue,iffalse,ifundefined[font="courier new"])
Back to top
SilverCalcKnight
|_


Active Member


Joined: 15 Nov 2005
Posts: 577

Posted: 20 Jun 2006 01:27:02 pm    Post subject:

Oh, spiffy. Is it slow? I don't want a speed decrease... And is the ifundefined part optional?

So it's like if, so I can have it set the varis to to either 1 or 0? Thanks IAAC, you are a true hero. Many, many thanks. CS will be my next project, I just wanted to port this first.

<ot> do you know where all of the tiles for CS are? </ot>


Last edited by Guest on 20 Jun 2006 01:35:33 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Jun 2006 01:36:18 pm    Post subject:

It's not slow, and that part is optional. And with the right use of If statements and when( statements you don't need hacks like A+(B=1->A like you do on the TI-83 series calculators.

Last edited by Guest on 20 Jun 2006 01:36:46 pm; edited 1 time in total
Back to top
SilverCalcKnight
|_


Active Member


Joined: 15 Nov 2005
Posts: 577

Posted: 20 Jun 2006 01:46:03 pm    Post subject:

Cool, thanks.

-=SilverCalcKnight=-
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Jun 2006 01:54:46 pm    Post subject:

By the way, the condition in an If statement can also be a list of boolean values (true/false). A list will be considered true iff every element is true, false otherwise.This also works for when()-type conditions.

If you want to make the condition fail only if all the elements are false, negate the list and reverse the conditions.


Last edited by Guest on 20 Jun 2006 01:56:03 pm; edited 1 time in total
Back to top
SilverCalcKnight
|_


Active Member


Joined: 15 Nov 2005
Posts: 577

Posted: 20 Jun 2006 04:12:06 pm    Post subject:

ok, error time:

when(pxltest(ipart(a),ipart(d))="true",1->g,0->g)

It says: Missing )

:confused:
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Jun 2006 04:21:14 pm    Post subject:

There are two errors:

1. true shouldn't be in quotes. Boolean values are a separate data type of their own, not a string.

2. The arguments of when() are expressions, not commands. For this reason, you should do [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]when(pxltest(ipart(a),ipart(d))=true,1,0)->g
instead.

Also, you may not even need to convert g to an integer (0 or 1) value at this point, but keep it boolean instead. Statement such as [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]If J or L and not(G would take boolean arguments anyway, on the TI-89, and optimizations such as [font="courier new;font-size:9pt;line-height:100%;color:darkblue"]D-G+1-H+Inot(G->D should probably be rewritten instead of trying to imitate them on the TI-89.

Really, these kind of optimizations are a bad style of coding, suffered on the TI-83+ because they provide badly-needed speed. You should try to avoid them whenever possible, both in C where they work but contribute to making the code unreadable, and in 68k Basic where they don't work at all except with awkward when() statements.

Additionally, because the game deals with decimal values, you might want to remove iPart and fPart wherever it occurs in the code, and replace any pixel commands with point commands. This is possible because 68k Basic has a ptTest() command similar to pxlTest(), but for points.

Finally, you might want to give the variables longer names, it makes the code more manageable and easier to understand.

Last edited by Guest on 21 Jun 2006 04:00:02 pm; edited 1 time in total
Back to top
SilverCalcKnight
|_


Active Member


Joined: 15 Nov 2005
Posts: 577

Posted: 20 Jun 2006 04:38:16 pm    Post subject:


Code:

0->B
30->D
30->A
0->E
0->H
Horizontal Ymin
Horizontal Ymax
Vertical Xmin
Vertical Xmax
Pt-On(iPart(A),-iPart(D
0->Xmin
-76->Ymin
158->Xmax
0->Ymax
While 1<2
getkey->K
Pxl-Test(iPart(D)+1,iPart(A->G
Pxl-Test(iPart(D)-1,iPart(A->I
Pxl-Test(iPart(D),1+iPart(A->J
Pxl-Test(iPart(D),iPart(A)-1->L
Pxl-Test(iPart(D),iPart(A->M
If J+L and not(G
Then
-B->B
If K
2->H
If B<1 and B>0
1->B
If B>-1 and B<0
-1->B
End
.95(Hnot(K=34)not(G->H
If Gnot(I)(K=25
2->H
A->C
D->F
max(-1,min(1,B+(.5+not(m))((K=26 and not(J))-(K=24 and not(L->B
B+A->A
D-G+1-H+Inot(G->D
.95B-.25BG->B
Pt-Change(iPart(A),-iPart(D
Pt-Change(iPart('C),-iPart(F // "'" added to prevent ©
End
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Jun 2006 04:46:49 pm    Post subject:

Um, if you haven't noticed, you've just reposted the (TI-83+) code over from the other topic. Thought I'd bring it to your attention if you didn't realize it. Yeah.

It seems to be an older version as well.


Last edited by Guest on 20 Jun 2006 04:47:17 pm; edited 1 time in total
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 20 Jun 2006 08:11:37 pm    Post subject:

Nope DarkerLine, that's perfectly up-to-date except for the level display code which I have not yet revealed to anyone (mostly since it's not close to being finished).
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 20 Jun 2006 08:18:01 pm    Post subject:

Oh. Well, it's different from the code posted in that topic (why'd you need to repost it anyway?)

On another note, it would perhaps make sense to wait until a project is finished before porting it?
Back to top
Super Speler
Super Awesome Dude


Calc Guru


Joined: 28 Nov 2005
Posts: 1391

Posted: 20 Jun 2006 08:21:55 pm    Post subject:

Quote:
On another note, it would perhaps make sense to wait until a project is finished before porting it?

He has pretty much been working on the project along side me for the past week or so. It's not like he picked a random project to port, we've had a string of PM's in which we go through sections of the game, figure out what is possible and what is not. He decided to port the game as I write my version and had some questoins about using 89 basic so he decided to ask them.


Last edited by Guest on 20 Jun 2006 08:28:51 pm; edited 1 time in total
Back to top
Ray Kremer


Member


Joined: 16 Feb 2004
Posts: 237

Posted: 21 Jun 2006 02:20:46 pm    Post subject:

DarkerLine wrote:
when(pxltest(ipart(a),ipart(d))="true",1,0)->g
[post="82756"]<{POST_SNAPBACK}>[/post]

Just
when(pxltest(ipart(a),ipart(d)),1,0)->g
right? Since the first argument is looking for a true/false result anyway.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 21 Jun 2006 03:59:38 pm    Post subject:

Right. You really don't even need to convert it to a 0 or 1 value, though, just do:
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]pxltest(ipart(a),ipart(d))→g


Later, it would be used somewhat like
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]If (j or l) and not(g) or
[font="courier new;font-size:9pt;line-height:100%;color:darkblue"]when(k=34 or g,.95h,0)→h

Last edited by Guest on 21 Jun 2006 04:00:28 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement