# Optical illusions

XB

64 replies to this topic

### #51 sometimes99erOFFLINE

sometimes99er

River Patroller

• Topic Starter
• 4,225 posts
• Location:Denmark

Posted Tue Oct 31, 2017 1:42 AM

Two rectangular prongs at the top transform into three cylindrical prongs.

`8)`

Edited by sometimes99er, Tue Apr 3, 2018 9:56 PM.

### #52 digdugnateONLINE

digdugnate

River Patroller

• 2,355 posts

Posted Tue Oct 31, 2017 2:56 AM

Two rectangular prongs at the top transform into three cylindrical prongs.

```100 call clear::call char(48,"01020408102040808040201008040201808080808080808080C0A09088848281")
110 call char(52,"814224181020408003020408F",54,"E01008040402020201020408081010101008080403")
120 for l=5 to 19::read c,s\$::display at(l,c):s\$; ::next l::for l=0 to 9^9::next l
130 data 17,01,16,0  1,15,0 03 1,14,0 0 21 1,13,0 0 010 02,12,0 0 0 0 0 2,11,0 0 0 0 0 0,10
140 data 0 0 0 0 0 0,9,0 0 0 0 0 0,8,760 0 0 0 0,8,85 0 0 0 0,10,760 0 0,10,85 0 0,12,760,12,85
run

```

A classic, and very cool   I loaded up in js99er to see what it'd look like.

i need to print some of these out to type in on my TI!

### #53 TheBFOFFLINE

TheBF

Dragonstomper

• 996 posts
• Location:The Great White North

Posted Wed Nov 1, 2017 9:02 AM

Two rectangular prongs at the top transform into three cylindrical prongs.

```100 call clear::call char(48,"01020408102040808040201008040201808080808080808080C0A09088848281")
110 call char(52,"814224181020408003020408F",54,"E01008040402020201020408081010101008080403")
120 for l=5 to 19::read c,s\$::display at(l,c):s\$; ::next l::for l=0 to 9^9::next l
130 data 17,01,16,0  1,15,0 03 1,14,0 0 21 1,13,0 0 010 02,12,0 0 0 0 0 2,11,0 0 0 0 0 0,10
140 data 0 0 0 0 0 0,9,0 0 0 0 0 0,8,760 0 0 0 0,8,85 0 0 0 0,10,760 0 0,10,85 0 0,12,760,12,85
run

```

That is really cool. Now I have to figure out how you did it!

### #54 TheBFOFFLINE

TheBF

Dragonstomper

• 996 posts
• Location:The Great White North

Posted Wed Nov 1, 2017 10:33 AM

Here is how I rendered it in Camel99 Forth

```\ classic pipe & bar illusion by sometimes99er on Atariage
GRAPHICS
HEX
CREATE SHAPES
0102 , 0408 , 1020 , 4080 ,
8040 , 2010 , 0804 , 0201 ,
8080 , 8080 , 8080 , 8080 ,
80C0 , A090 , 8884 , 8281 ,
8142 , 2418 , 1020 , 4080 ,
0302 , 0408 , F000 , 0000 ,
E010 , 0804 , 0402 , 0202 ,
0102 , 0408 , 0810 , 1010 ,
1008 , 0804 , 0300 , 0000 ,

\ write character definitions to VDP RAM all at once
: CHARACTERS ( 'pattern ascii# char-cnt   -- ) 8* SWAP ]PDT SWAP VWRITE ;

DECIMAL
SHAPES  CHAR 0   9 CHARACTERS

: RUN  PAGE
CR ."                01"
CR ."               0  1"
CR ."              0 03 1"
CR ."             0 0 21 1"
CR ."            0 0 010 02"
CR ."           0 0 0 0 0 2"
CR ."          0 0 0 0 0 0"
CR ."         0 0 0 0 0 0"
CR ."        0 0 0 0 0 0"
CR ."       760 0 0 0 0 "
CR ."       85 0 0 0 0"
CR ."         760 0 0"
CR ."         85 0 0"
CR ."           760"
CR ."           85"
BEGIN KEY? UNTIL ;
```

### #55 Lee StewartOFFLINE

Lee Stewart

River Patroller

• 3,968 posts
• Location:Silver Run, Maryland

Posted Wed Nov 1, 2017 11:49 AM

...and here it is in fbForth 2.0 with slightly modified logistics:

```\ fbForth 2.0 port of Camel99 Forth version
\ of classic pipe & bar illusion by sometimes99er on Atariage
BASE @  \ current radix to stack
HEX
: SHAPES  ( --- addr cell-cnt )
DATA[
0102 0408 1020 4080
8040 2010 0804 0201
8080 8080 8080 8080
80C0 A090 8884 8281
8142 2418 1020 4080
0302 0408 F000 0000
E010 0804 0402 0202
0102 0408 0810 1010
1008 0804 0300 0000
]DATA  ;

: RUN  ( --- )
VDPMDE @       \ save current graphics mode to stack
GRAPHICS
SHAPES ASCII 0 DCHAR    \ redefine characters '0'..'8'
PAGE
CR ."                01"
CR ."               0  1"
CR ."              0 03 1"
CR ."             0 0 21 1"
CR ."            0 0 010 02"
CR ."           0 0 0 0 0 2"
CR ."          0 0 0 0 0 0"
CR ."         0 0 0 0 0 0"
CR ."        0 0 0 0 0 0"
CR ."       760 0 0 0 0 "
CR ."       85 0 0 0 0"
CR ."         760 0 0"
CR ."         85 0 0"
CR ."           760"
CR ."           85"
BEGIN ?KEY UNTIL
VMODE  ;       \ restore graphics mode ```

...lee

### #56 TheBFOFFLINE

TheBF

Dragonstomper

• 996 posts
• Location:The Great White North

Posted Wed Nov 1, 2017 3:07 PM

Hey Lee,

When you post Forth code, what language do you select to make the colors look like that?

### #57 Lee StewartOFFLINE

Lee Stewart

River Patroller

• 3,968 posts
• Location:Silver Run, Maryland

Posted Wed Nov 1, 2017 3:14 PM

Hey Lee,

When you post Forth code, what language do you select to make the colors look like that?

That is done by the code (<>) button in the editor.

I often indent a block of text in the “Courier New” font and bold/color it how I like.  That procedure is more trouble and has greater line-spacing than the code button.  I put long stretches of code formatted that way into spoilers.

...lee

### #58 PeteEOFFLINE

PeteE

Chopper Commander

• 223 posts
• Location:Beaverton, OR

Posted Sun Dec 10, 2017 8:34 PM

Curvature Blindness - all the curves are exactly the same shape. Source

```100 call clear::call screen(3)::call color(1,1,1,2,1,1,3,1,1,4,1,1,5,1,1,6,1,1,7,1,1,8,1,1)::call magnify(3)
110 c\$="00000000C038070000000000031CE000000738C000000000"::d\$="000738C00000000000E01C030000000000000000C0380700"
120 call char(32,"00000000000000000103070F1F3F7FFFFFFFFFFFFFFFFFFF",48,c\$,56,c\$,64,c\$,72,d\$,80,d\$,88,d\$)
130 call char(40,"0000000000000000FFFEFCF8F0E0C080")::e\$=rpt\$(" ",max(0,11))&"!"&rpt\$("""",22)&")"&rpt\$("(",14)
140 a\$=rpt\$("2IJ1",7)&rpt\$("HI01",7)::b\$=rpt\$(":QR9",7)&rpt\$("PQ89",7)::c\$=rpt\$("BYZA",7)&rpt\$("XY@A",7)
150 for i=0 to 7::read x,y,z::j=1+28*(i and 1)::d\$=seg\$(a\$,j,x)&seg\$(b\$,x+j,y)&seg\$(c\$,x+y+j,z)
160 display at(i*3+1,1):d\$;::display at(i*3+2,1):d\$;::display at(i*3+3,1):seg\$(e\$,i*3+1,28);::next i
170 for i=0 to 7::read c\$::call char(i*4+96,c\$)::next i
180 for i=0 to 4::call sprite(#i+1,96+(i and 3)*4,3,i*24+1,113-i*24)
190 call sprite(#i+6,112+(i and 3)*4,3,i*24+73,225-i*24)::next i
200 call color(1,3,16,2,3,2,3,4,16,4,4,3,5,4,2,6,13,16,7,13,3,8,13,2)::call screen(16)::for i=0 to 9^9::next i
210 data 14,14,0, 11,17,0, 8,20,0, 5,21,2, 2,21,5, 0,20,8, 0,17,11, 0,14,14
220 data "00000000000000000100070F1F3F7FFF0103030C1F3F7FFFFF1FE3FCFFFFFFFF"
230 data "00000000000000000103030C1F3F7FFF0103070F1F0778FFFFFFFFFF3FC7F8FF"
240 data "00000000000000000103070F1F0778FF0103070F1C231FFFFFFFFFFFFCE31FFF"
250 data "00000000000000000103070F1C231FFF0100070F1F3F7FFFFFF8C73FFFFFFFFF"
260 data "FFFFFFFF3FC7F8FFFFFEFCF830C0C080FFFEFCF8F0E000800000000000000000"
270 data "FFFFFFFFFCE31FFFFFFEFCF8F0E00080FFF8C438F0E0C0800000000000000000"
280 data "FFF8C73FFFFFFFFFFFF8C438F0E0C080FF1EE0F8F0E0C0800000000000000000"
290 data "FF1FE3FCFFFFFFFFFF1EE0F8F0E0C080FFFEFCF830C0C0800000000000000000"
run
```

### #59 RetrospectOFFLINE

Retrospect

Stargunner

• 1,140 posts
• Location:Wakefield, England

Posted Mon Dec 11, 2017 1:16 PM

Two rectangular prongs at the top transform into three cylindrical prongs.

```100 call clear::call char(48,"01020408102040808040201008040201808080808080808080C0A09088848281")
110 call char(52,"814224181020408003020408F",54,"E01008040402020201020408081010101008080403")
120 for l=5 to 19::read c,s\$::display at(l,c):s\$; ::next l::for l=0 to 9^9::next l
130 data 17,01,16,0  1,15,0 03 1,14,0 0 21 1,13,0 0 010 02,12,0 0 0 0 0 2,11,0 0 0 0 0 0,10
140 data 0 0 0 0 0 0,9,0 0 0 0 0 0,8,760 0 0 0 0,8,85 0 0 0 0,10,760 0 0,10,85 0 0,12,760,12,85
run

```

MY EYES!!!!

### #60 sometimes99erOFFLINE

sometimes99er

River Patroller

• Topic Starter
• 4,225 posts
• Location:Denmark

Posted Wed Dec 20, 2017 12:57 AM

The boxes seem to tilt.

```8)
```

Edited by sometimes99er, Tue Apr 3, 2018 9:56 PM.

### #61 TheBFOFFLINE

TheBF

Dragonstomper

• 996 posts
• Location:The Great White North

Posted Sat Mar 3, 2018 9:18 AM

The boxes seem to tilt.

```100 call clear::call screen(6)::call char(33,"30C0030C30C0030C0C03C0300C03C03")
110 call box(4,9,29,11,33)::call box(10,13,23,18,34)::for i=0 to 9^9::next i
120 sub box(x1,y1,x2,y2,c)::for y=y1 to y2::call hchar(y,x1,c,x2-x1+1)::next y::subend
run

```

This is an amazing illusion. I can't believe my eyes lie to me like that.

I did this one in Forth because it was easier for me but I am sure you could crank this off in BASIC pretty easily.

It's called the Ternus Illusion. I found it on Wikipedia.

```HEX
CREATE SPOTDATA
071F , 3F7F , 7FFF , FFFF , \ upper left
E0F8 , FCFE , FEFF , FFFF , \ upper right
FFFF , FF7F , 7F3F , 1F07 , \ lower left
FFFF , FFFE , FEFC , F8E0 , \ lower right

DECIMAL
: AS_SPOT ( char -- ) SPOTDATA  SWAP ]PDT  32 VWRITE ;

: DRAW_SPOT ( 1stchar col row -- )
AT-XY                   \ Position cursor
DUP EMIT  1+ DUP EMIT   \ draw top 2 chars
1 VROW +!  -2 VCOL +!   \ goto next row, back 2 cols.
1+ DUP EMIT 1+ EMIT ;   \ draw bottom 2 chars

: FRAME1    16 1 1 COLOR   17 18 2 1 COLORS  ;
: FRAME2    16 18 1 1 COLORS  ;      \ blank frame
: FRAME3    16 17 2 1 COLORS   18 1 1 COLOR  ;

: TERNUS
GRAPHICS
PAGE
16 SCREEN
8 0 AT-XY ." Ternus Illusion"

128 AS_SPOT   16 2 1 COLOR
136 AS_SPOT   17 2 1 COLOR
144 AS_SPOT   18 1 1 COLOR

128  5 10 DRAW_SPOT
136 15 10 DRAW_SPOT
144 25 10 DRAW_SPOT

BEGIN
BEEP
0  23 BL 32 HCHAR
1 23 AT-XY ." Element Motion (press key)"
BEGIN
FRAME1 500 MS
FRAME2  15 MS
FRAME3 500 MS
FRAME2  15 MS
KEY?
UNTIL

BEEP
0  23 BL 32 HCHAR
10 23 AT-XY ." GROUP Motion"
BEGIN
FRAME1 500 MS
FRAME2 250 MS
FRAME3 500 MS
FRAME2 250 MS
KEY?
UNTIL
?BREAK
AGAIN ;
```

### #62 Lee StewartOFFLINE

Lee Stewart

River Patroller

• 3,968 posts
• Location:Silver Run, Maryland

Posted Sat Mar 3, 2018 12:25 PM

This is an amazing illusion. I can't believe my eyes lie to me like that.

I did this one in Forth because it was easier for me but I am sure you could crank this off in BASIC pretty easily.

It's called the Ternus Illusion. I found it on Wikipedia.

<snip>

This code does not work correctly in Camel99 Forth v1.98 (latest?).  I traced it to the definition of COLORS , which should have the address difference incremented by 1 to give VFILL the proper copy count.

```( *NEW*  change contiguous character sets at once)
: COLORS  ( set1 set2 fg bg  -- )
1 ?MODE
>COLR >R
SWAP ]CTAB SWAP ]CTAB OVER -
R> VFILL ;
```

should be

```( *NEW*  change contiguous character sets at once)
: COLORS  ( set1 set2 fg bg  -- )
1 ?MODE
>COLR >R
SWAP ]CTAB SWAP ]CTAB OVER -
1+      \ increment color-table-address difference to get proper count for VFILL
R> VFILL ;
```

...lee

### #63 TheBFOFFLINE

TheBF

Dragonstomper

• 996 posts
• Location:The Great White North

Posted Sat Mar 3, 2018 2:42 PM

This code does not work correctly in Camel99 Forth v1.98 (latest?).  I traced it to the definition of COLORS , which should have the address difference incremented by 1 to give VFILL the proper copy count.

```( *NEW*  change contiguous character sets at once)
: COLORS  ( set1 set2 fg bg  -- )
1 ?MODE
>COLR >R
SWAP ]CTAB SWAP ]CTAB OVER -
R> VFILL ;
```

should be

```( *NEW*  change contiguous character sets at once)
: COLORS  ( set1 set2 fg bg  -- )
1 ?MODE
>COLR >R
SWAP ]CTAB SWAP ]CTAB OVER -
1+      \ increment color-table-address difference to get proper count for VFILL
R> VFILL ;
```

...lee

You caught me Lee.  In doing all this playing around I am finding bugs and or ways the words work that I like or dis-like.

I changed the COLORS word to increment the second colour set so you can state a range (from...too) of colour sets.

I am working on V1.99 as we speak so I will put it up there by end of day. So your change is correct.

Amazing. You must be the only user. :-)

B

### #64 TheBFOFFLINE

TheBF

Dragonstomper

• 996 posts
• Location:The Great White North

Posted Sat Mar 3, 2018 7:25 PM

I put Version 1.99 up for you Lee.

Can't promise that it is bug-for-bug compatible, but I found a lot of little things that saved space.

Now I realize that the CAMEL Forth header takes 1 extra byte versus Fig-Forth so that is eating 300+ bytes alone.

More work on the cross-compiler will get me V2.0 with smaller headers and hopefully multiple binary file output for >8K programs.

See CAMEL Forth thread for a log of changes.

### #65 Lee StewartOFFLINE

Lee Stewart

River Patroller

• 3,968 posts
• Location:Silver Run, Maryland

Posted Sat Mar 3, 2018 7:43 PM

...

Amazing. You must be the only user. :-)

B

Actually, I did not realize anything was wrong until I played your MP4 video.  When I downloaded and ran the code, I had a “meh” moment because nothing looked different.  That is when I played the video for comparison, showing the third spot, which was missing from the running code.

...lee

### Also tagged with one or more of these keywords: XB

#### 0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users