Posts: 35
Threads: 5
Joined: Apr 2022
Reputation:
5
02-14-2024, 02:17 PM
(This post was last modified: 02-14-2024, 02:51 PM by gaslouk.)
SCREEN 13
COLOR 6 * 2 + 3, 0 - 5 + 8 * 2 - 11
CLS
FOR I = 0 TO 70 STEP 0.1
PSET (I * COS(I) + 140, 20 - I * (SIN(I) * 0.2 - 2))
NEXT
LINE (136, 20)-(140, 12)
LINE -(144, 20): LINE -(134, 16)
LINE -(146, 16): LINE -(136, 20)
A$ = INPUT$(1)
Is this really possible?
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
Not this?
Code: (Select All) Screen 13
Color 2
PSet (140 + Cos(0), 20)
For I = 0 To 70 Step 0.1
Line -(I * Cos(I) + 140, 20 - I * (Sin(I) * 0.2 - 2))
Next
Color 14
Line (136, 20)-(140, 12)
Line -(144, 20): Line -(134, 16)
Line -(146, 16): Line -(136, 20)
A$ = Input$(1)
b = b + ...
Posts: 35
Threads: 5
Joined: Apr 2022
Reputation:
5
(02-14-2024, 02:17 PM)gaslouk Wrote: SCREEN 13
COLOR 6 * 2 + 3, 0 - 5 + 8 * 2 - 11
CLS
FOR I = 0 TO 70 STEP 0.1
PSET (I * COS(I) + 140, 20 - I * (SIN(I) * 0.2 - 2))
NEXT
LINE (136, 20)-(140, 12)
LINE -(144, 20): LINE -(134, 16)
LINE -(146, 16): LINE -(136, 20)
A$ = INPUT$(1)
Is this really possible?
(02-14-2024, 02:36 PM)bplus Wrote: Not this?
Code: (Select All) Screen 13
Color 2
PSet (140 + Cos(0), 20)
For I = 0 To 70 Step 0.1
Line -(I * Cos(I) + 140, 20 - I * (Sin(I) * 0.2 - 2))
Next
Color 14
Line (136, 20)-(140, 12)
Line -(144, 20): Line -(134, 16)
Line -(146, 16): Line -(136, 20)
A$ = Input$(1)
I mean this
COLOR 6 * 2 + 3, 0 - 5 + 8 * 2 - 11
How this is really possible.
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
Is same as Color 15, 0
Where did you get that code from anyway?
b = b + ...
Posts: 732
Threads: 30
Joined: Apr 2022
Reputation:
43
Gaslouk, they're just obscuring the data passed to COLOR to make it look like they're doing something neat. See what QB64 gives you if you do "PRINT 6 * 2 + 3, 0 - 5 + 8 * 2 - 11 "
Tread on those who tread on you
Posts: 35
Threads: 5
Joined: Apr 2022
Reputation:
5
02-14-2024, 06:52 PM
(This post was last modified: 02-14-2024, 06:59 PM by gaslouk.)
(02-14-2024, 04:16 PM)SpriggsySpriggs Wrote: Gaslouk, they're just obscuring the data passed to COLOR to make it look like they're doing something neat. See what QB64 gives you if you do "PRINT 6 * 2 + 3, 0 - 5 + 8 * 2 - 11 " Ηι
In how many basic can you do this? I didn't see it in anyone's program, I just stumbled upon this little MSXbasic program trying to run it on QB64. After modification of course. And the same thing happens the "screen". SCREEN 16-4"
That's why I asked.
Posts: 1,277
Threads: 120
Joined: Apr 2022
Reputation:
100
(02-14-2024, 06:52 PM)gaslouk Wrote: (02-14-2024, 04:16 PM)SpriggsySpriggs Wrote: Gaslouk, they're just obscuring the data passed to COLOR to make it look like they're doing something neat. See what QB64 gives you if you do "PRINT 6 * 2 + 3, 0 - 5 + 8 * 2 - 11 " Ηι
In how many basic can you do this? I didn't see it in anyone's program, I just stumbled upon this little MSXbasic program trying to run it on QB64. After modification of course. And the same thing happens the "screen". SCREEN 16-4"
That's why I asked. There's nothing mysterious going on here. Instead of hard coding numeric values like so:
COLOR 15, 0
Or using variables:
Fcolor = 15
Bcolor = 0
COLOR Fcolor, Bcolor
The code you came across forced BASIC to do a little math first:
COLOR 6 * 2 + 3, 0 - 5 + 8 * 2 - 11
Six times two = 12 plus three = 15
Eight times two = 16 plus zero = 16 minus five = 11 minus eleven = 0
So there's your two numbers 15, 0
You can place math statements like this in all versions of BASIC, although using this style of coding without including a variable or two is strange. My guess is the programmer that wrote this code wanted to make the code look more exotic or make him/herself look like some sort of guru programmer (but failed miserably).
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Posts: 2,163
Threads: 222
Joined: Apr 2022
Reputation:
103
Thanks for the inspiration. I now discovered the unified field theory. Sorry Bill, beat you to it again, as usual...
SCREEN 5 + 3 - 4 * 2
The only screen anyone needs!
Pete
Shoot first and shoot people who ask questions, later.
Posts: 301
Threads: 16
Joined: Apr 2022
Reputation:
51
Posts: 1,001
Threads: 50
Joined: May 2022
Reputation:
27
(02-15-2024, 05:39 AM)Pete Wrote: Thanks for the inspiration. I now discovered the unified field theory. Sorry Bill, beat you to it again, as usual...
SCREEN 5 + 3 - 4 * 2
The only screen anyone needs!
Pete And I was afraid that he had lost his sharp mind.
Clearly: 5 + 3 - 4 * 2. That is: 3 - 4 = -1 + 5 = 4 and 4 * 2 = 8. So screen 8!
Not everyone understands that!
|