WINDOWS MYSTIFY CLONE....ALMOST WORKING
Forum rules
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)
Feel free to post works in progress, test builds, prototypes, and tech demos.
Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)
Feel free to post works in progress, test builds, prototypes, and tech demos.
Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
This is driving me to drink.....lol....
I want the code to be able to handle any number of boxes. any number of corners 2 or greater. I have
a certain subset working but it has yet to turn out General Purpose.... !!!!!
Anything over 3 boxes and 4 to 6 corners is going to be sluggish for this system but I still want the code
logic to be correct...
I want the code to be able to handle any number of boxes. any number of corners 2 or greater. I have
a certain subset working but it has yet to turn out General Purpose.... !!!!!
Anything over 3 boxes and 4 to 6 corners is going to be sluggish for this system but I still want the code
logic to be correct...
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
Don't worry too much about optimizing the code; even if you go out of your way to do all of the usual CBM BASIC optimizations, you'll only get a small boost at the cost of making the code unreadable:
(I was having a bit of fun with the code after I posted my initial fixes, and this was one of the things I tried )
...so I don't think it's worthwhile.
(I was having a bit of fun with the code after I posted my initial fixes, and this was one of the things I tried )
Code: Select all
10 SCREEN 128
20 RECT 0,0,319,239,16
30 NB = 2: REM NUMBER OF SHAPES ON SCREEN
35 NC = 4: REM NUMBER OF CORNERS FOR THE SHAPES
40 BD = 8: REM DEPTH TO DRAW BEFORE STARTING ERASURE
45 YL = 238
50 XL = 318
110 P1 = 1 : REM CURRENT BOX
120 P2 = 1 : REM PREVIOUS BUFFER POSITION
130 P3 = 2 : REM CURRENT BUFFER POSITION
140 P4 = 0 : REM CURRENT COLOR
150 X1 = 0: X2 = 0: X3 = 0
160 Y1 = 0: Y2 = 0: Y3 = 0
170 DIM BX(NB,BD, NC) : REM CORNER X COORDINATES
180 DIM BY(NB,BD, NC) : REM CORNER Y COORDINATES
190 DIM XI(NB, NC) : REM X INCREMENT
200 DIM YI(NB, NC) : REM Y INCREMENT
210 DIM BC(NB) : REM COLOR OF THE BOX
300 GOSUB 6000
400 FOR P1=1 TO NB
410 X2=BX(P1,P3,NC):Y2=BY(P1,P3,NC)
420 FOR C=1 TO NC
430 X1=X2:X2=BX(P1,P3,C):Y1=Y2:Y2=BY(P1,P3,C)
440 LINE X1,Y1,X2,Y2,16
450 X3=BX(P1,P2,C)+XI(P1,C):Y3=BY(P1,P2,C)+YI(P1,C)
460 IF X3>XL THEN XI(P1,C)=-INT((RND(1)*5)+1):X3=XL
470 IF X3<0 THEN XI(P1,C)=INT(RND(1)*5)+1:X3=0
480 IF Y3>YL THEN YI(P1,C)=-INT((RND(1)*5)+1):Y3=YL
490 IF Y3<0 THEN YI(P1,C)=INT(RND(1)*5)+1:Y3=0
500 BX(P1,P3,C)=X3:BY(P1,P3,C)=Y3
510 NEXT
520 X2=X3:Y2=Y3:P4=BC(P1)
530 FOR C=1 TO NC
540 X1=X2:X2=BX(P1,P3,C):Y1=Y2:Y2=BY(P1,P3,C)
550 LINE X1,Y1,X2,Y2,P4
560 NEXT:NEXT
570 P2=P3:P3=P3+1:IF P3>BD THEN P3=1
580 GOTO 400
5999 REM SETUP VARIABLES
6000 X = INT(RND(-TI))
6005 FOR B = 1 TO NB
6010 BC(B) = INT(RND(1)*255)+1
6020 IF BC(B)=0 OR BC(B)=16 THEN GOTO 6010
6040 FOR C = 1 TO NC
6050 XI(B,C) = INT(RND(1)*5)+1
6060 IF (INT(RND(1)*20)+1) > 10 THEN XI(B,C)= -XI(B,C)
6070 YI(B,C) = INT(RND(1)*5)+1
6080 IF (INT(RND(1)*20)+1) > 10 THEN YI(B,C)= -XI(B,C)
6090 BX(B,1,C) = INT(RND(1)*319) + 1
6100 BY(B,1,C) = INT(RND(1)*239) + 1
6110 NEXT C
6120 NEXT B
6130 RETURN
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
Works well.... It actually runs faster than I thought it might....
One of the reasons this is driving me crazy is I did exactly this algorithm in the 90's only in Borland Pascal.
One of the reasons this is driving me crazy is I did exactly this algorithm in the 90's only in Borland Pascal.
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
I think it might run quite smoothly in C or Prog8
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
I guess there was I reason I left QuickBasic for Pascal.....lol.
I think the entire development community went askew when they Chose C & C++ ............lol
I think the entire development community went askew when they Chose C & C++ ............lol
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
If Borland ever did a Turbo Pascal for C64 and I got hold of the source code.... I would take lead on porting to CX16... I don't think I could devote my twilight years to writing it from Scratch....... lol
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
TO DRAGWX.
Drop me your name in a PM.... I appreciate your interest in the Code.
If I use this code anywhere else I want to at least give you a name drop..
I have no plans for anything commercial.... lol
Drop me your name in a PM.... I appreciate your interest in the Code.
If I use this code anywhere else I want to at least give you a name drop..
I have no plans for anything commercial.... lol
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
No need, and don't worry about it; use the code however you'd like.
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
Huh. I can't stand Pascal. I did my one semester of Pascal in college, then deleted the compiler and never looked back.ahenry3068 wrote: ↑Tue May 09, 2023 7:04 pm I guess there was I reason I left QuickBasic for Pascal.....lol.
I think the entire development community went askew when they Chose C & C++ ............lol
Looked at objectively, C and its derived languages (C++, C#, Java) are the only high level programming languages we really need. Everything done in other languages can be done in C++, with the right libraries, of course.
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: WINDOWS MYSTIFY CLONE....ALMOST WORKING
I'm quite aware that I'm the weirdo here... Pascal
always struck me as the correct compromise
between the low level capabilities of C and the readability
of BASIC or COBOL The Borland Dialects of the language
have every bit of the capabilities of C or C++
My last major project I used the Free Pascal Compiler
and implemented almost a complete backend for
Web Server Programs (Common Gateway Interface)
The last parts of that project are still on the web though
kind of defunct. PSP and PowUtils (Pascal Server Pages)
always struck me as the correct compromise
between the low level capabilities of C and the readability
of BASIC or COBOL The Borland Dialects of the language
have every bit of the capabilities of C or C++
My last major project I used the Free Pascal Compiler
and implemented almost a complete backend for
Web Server Programs (Common Gateway Interface)
The last parts of that project are still on the web though
kind of defunct. PSP and PowUtils (Pascal Server Pages)