RetroBASIC

Offtopic => Offtopic => Topic started by: B+ on October 20, 2018, 02:28:52 PM

Title: All BASIC (reaching out)
Post by: B+ on October 20, 2018, 02:28:52 PM
Hey John, I agree the Rosetta Word Search challenge should be in 2 parts:
1A. get warmed up by building code to do a general newspaper type puzzle where a list of words to find is provided and it can be assumed they appear only once in the puzzle.
1B. step up the functionality of 1A  by finding and counting all instances of a word found in a puzzle
1C. further power functionality, find all words in the puzzle, without a given word list.

2. Code for building Word Search Puzzles, because that is certainly a more advanced level of challenge, IMHOOC (In My Humble ;-)) Opinion, Of Course) specially when it is expected to insert secret message or "ROSETTA" in the non used letters of the puzzle.

Speaking of Word Search, I'd like to announce I have my rotating arrays method working for a couple of test Letter grids for newspaper style puzzles.



On a different topic we share an interest with more folks (than just John and I) I think:

Should O2 be considered a BASIC since both Aurel and John seem to advocate it ;-))
https://en.wikipedia.org/wiki/List_of_BASIC_dialects#X
BTW On this list, the blue means Wiki has stuff on the Dialect and the black means NOT in Wiki? (I think so.)
Title: Re: All BASIC (reaching out)
Post by: Tomaaz on October 23, 2018, 06:08:59 PM
When I was registered there, it was dead. Now, AIR's posting examples in Bash, Python, Ruby, Nim... And this place here is... dead. Guys, why can't we have one forum for everything?  ;D
Title: Re: All BASIC (reaching out)
Post by: B+ on October 23, 2018, 07:25:23 PM
Hi Tomaaz,

It was pretty dead here until you showed up and things erupted with John which brought Mike (no L needed) in to defend John's honor. ;D

AIR is nice to have at any forum but I doubt he will last long, he is retired after all, like Mike.
https://www.youtube.com/watch?v=MN3x-kAbgFU

I have Word Search code, the alternate method worked out but I think I am the only one interested...

Also doing variations on Pig Game but it's just having fun with code nothing serious...

Quote
Guys, why can't we have one forum for everything?
https://www.youtube.com/watch?v=iNalya_4VkQ
Title: Re: All BASIC (reaching out)
Post by: Tomaaz on October 23, 2018, 08:16:36 PM
Well, I think it's time to play this song, then:

https://m.youtube.com/watch?v=JSUIQgEVDM4
Title: Re: All BASIC (reaching out)
Post by: B+ on October 23, 2018, 08:36:25 PM
 ;D https://www.youtube.com/watch?v=VhX3b1h7GQw

Title: Re: All BASIC (reaching out)
Post by: Aurel on October 23, 2018, 10:08:08 PM
forum for everything
because then must be named as Everything Basic with JRS as Admin  :D
 /in your case probably  {}
Anything just not Basic Forum  ;D
Title: Re: All BASIC (reaching out)
Post by: Tomaaz on October 24, 2018, 10:31:00 AM
Abother great joke. Yeah...
Title: Re: All BASIC (reaching out)
Post by: Mike Lobanovsky on October 24, 2018, 02:01:54 PM
Mark,

You've posted a few pieces of real nice British music that I like, so I guess we shouldn't be so different ideologically. But I must confess that your peculiar sense of, er, English humoUr is what keeps eluding me:

... Mike (no L needed) ...  to defend John's honor. ;D

What am I supposed to laugh at — Mike, or L, or John? ;D

Or are you inviting us for another round of measuring whose one is longer? Why can't you guys just run this challenge among yourselves? ;)
Title: Re: All BASIC (reaching out)
Post by: B+ on October 24, 2018, 04:23:39 PM
Mark,

You've posted a few pieces of real nice British music that I like, so I guess we shouldn't be so different ideologically. But I must confess that your peculiar sense of, er, English humoUr is what keeps eluding me:

... Mike (no L needed) ...  to defend John's honor. ;D

What am I supposed to laugh at — Mike, or L, or John? ;D

Or are you inviting us for another round of measuring whose one is longer? Why can't you guys just run this challenge among yourselves? ;)

Just keeping in practice of invoking the gods of Basic, it's nice to know they are looking over my shoulder. The sense of humor is more from Ohio (full of wackos, just look at who they vote for) than from England.

So how can we get AIR back? I am wondering, because he mentioned trying to sign up here. Shame for him to be just a lurker.  ;) maybe if AIR tries again and Cybermonkey looks...
\_?_/
   |
  /\
  | \
Title: Re: All BASIC (reaching out)
Post by: B+ on October 28, 2018, 06:11:46 PM
Hey John, here is how to draw a circle (too bad you can't see it rotate):

Oh wait, you probably can't see it at all!  :P
Title: Re: All BASIC (reaching out)
Post by: B+ on October 28, 2018, 08:22:37 PM
OK John for your circle drawing challenge, try this link reply #65
https://www.qb64.org/forum/index.php?topic=250.msg1761#msg1761

You will see where the stars hangout. ;-))
Title: Re: All BASIC (reaching out)
Post by: ZXDunny on October 30, 2018, 01:57:21 PM
This one got me thinking - what's the smallest possible, but visually believable sphere mapping I could do? It took a couple of days to figure it out, as it turns out - I tried various things to get it running as fast as possible including using bitmap scaling on individual lines, but in the end you just have to work on each and every pixel to get a decent effect.

Here's a link to a Youtube video of it in action:

https://www.youtube.com/watch?v=0EGDJybA_HE

And here's the code:

Code: [Select]
10 REM Fake sphere mapping
20 GRAPHIC NEW t LOAD "demos:3d/lava_strip.png":gw=gfxw t,gh=gfxh t:
   palette copy t,0,256 to 0:
   paper rgbn(0):
   screen lock
30 r=scrh/2.1,xc=SCRw/2,yc=SCRh/2,xo=0:
   do:
      for y=-r+1 to r-1:
         x1=sqr(r*r-y*y),
         tv=(asn(y/r)+1.5)/3:
         for x=-x1 to x1:
            tu=(asn(x/x1)+1.5)/6:
            plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc:
         next x:
      next y:
      xo+=1,xo%=gw:
      wait screen:
      cls:
   loop

I thought it turned out quite well :)
Title: Re: All BASIC (reaching out)
Post by: B+ on October 30, 2018, 03:48:06 PM
Wow, great output with small amount of code used!
Title: Re: All BASIC (reaching out)
Post by: ZXDunny on October 31, 2018, 02:59:58 PM
Inverted the mapping and recreated the classic BBC logo!

https://www.youtube.com/watch?v=jKoL9d6S6WQ

Title: Re: All BASIC (reaching out)
Post by: B+ on October 31, 2018, 07:38:45 PM
Hi D,

I translated your code to QB64 and it works so much better than what I had done! It fixes the polar craters, now to scale with others, now if I could just fix my spelling...
Title: Re: All BASIC (reaching out)
Post by: ZXDunny on October 31, 2018, 11:20:32 PM
Oh, wow! That turned out excellent :) How is the performance on an image that size? Can you rotate it in real time? I can in SpecBAS at 800x480, but I can only get about 25fps at best so I'm really hitting the limits of the interpreter.

I cannot believe how simple the algorithm turned out to be though. It's literally just ArcSin functions on the x and y coordinates, and voila! (after some massaging to get from the -1.5 to 1.5 coordinates that ArcSin returns to map to the image)

Someone suggested I tweet the BBC logo video, and it's gone viral - as much as anything I do goes viral, that is. Today, I am a very minor celebrity.
Title: Re: All BASIC (reaching out)
Post by: B+ on October 31, 2018, 11:58:01 PM
Code: [Select]
_TITLE "Fake sphere mapping by Paul Dunn, trans from SpecBas to QB64 2018-10-31 B+"
'10  Fake sphere mapping
'20 GRAPHIC NEW t LOAD "demos:3d/lava_strip.png":gw=gfxw t,gh=gfxh t:
'   palette copy t,0,256 to 0:
'   paper rgbn(0):
'   screen lock
'30 r=scrh/2.1,xc=SCRw/2,yc=SCRh/2,xo=0:
'   do:
'      for y=-r+1 to r-1:
'         x1=sqr(r*r-y*y),
'         tv=(asn(y/r)+1.5)/3:
'         for x=-x1 to x1:
'            tu=(asn(x/x1)+1.5)/6:
'            plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc:
'         next x:
'      next y:
'      xo+=1,xo%=gw:
'      wait screen:
'      cls:
'   loop

SCREEN _NEWIMAGE(800, 600, 32)
surface& = _LOADIMAGE("martian.png")
'surface& = _LOADIMAGE("mars.png") 'this image has a color change where ends meet
'surface& = _LOADIMAGE("mars0.jpeg") 'better

gw = _WIDTH(surface&)
gh = _HEIGHT(surface&)
map& = _NEWIMAGE(gw, gh, 32)
_DEST map&
_PUTIMAGE , surface&, map&
_DEST 0

stars& = _LOADIMAGE("stars.png")
_SOURCE stars&
_DEST 0
_PUTIMAGE

r = _HEIGHT / 3
xc = _WIDTH / 2
yc = _HEIGHT / 2
xo = 0
DO
    start = TIMER
    FOR y = -r TO r
        x1 = SQR(r * r - y * y)
        tv = (_ASIN(y / r) + 1.5) / 3
        FOR x = -x1 + 1 TO x1
            tu = (_ASIN(x / x1) + 1.5) / 6
            _SOURCE map&
            pc~& = POINT((xo + tu * gw) MOD gw, tv * gh)
            _DEST 0
            PSET (x + xc, y + yc), pc~&
            'plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc
        NEXT x
    NEXT y
    xo = xo + 1
    xo = xo MOD gw
    tyme = TIMER - start
    Total = Total + tyme
    Count = Count + 1
    Ave = Total / Count
    LOCATE 1, 1: PRINT INT(Ave * 10000) / 10000
    _DISPLAY

    ' wait screen
    'CLS
LOOP


This is taking about .0214 secs per loop or 46-47 loops per sec. I did change the radius to smaller and printing times slows things down a bit. (Compiled exe)

:-)) congrats to celebrity status, you have impressed me many a time.

EDIT: sorry dyslexic with digits today.