Fill your PC with sand

Share your advanced PureBasic knowledge/code with the community.
User avatar
TI-994A
Addict
Addict
Posts: 2702
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Fill your PC with sand

Post by TI-994A »

walbus wrote:On the TI there was a nice demo, "Falling Text",
I might do that again, it was very nice to see
I'm not familiar with that one, but please do share if you do; it should be fun.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Fill your PC with sand

Post by walbus »

Yep, i think, i look the next days
It was made on the TI with sprites (shapes)
But very easy, because you could automatically convert letters to sprites on the TI
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Fill your PC with sand

Post by davido »

@walbus,
Thank you for showing your Falling Snow program. I enjoyed the first time round, too. :D

Your idea of falling letters would be great if you get the time.
Reminds me of an old game, to improve typing, where one had to stop the letters hitting the deck by hitting the appropriate keys!
DE AA EB
User avatar
TI-994A
Addict
Addict
Posts: 2702
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Fill your PC with sand

Post by TI-994A »

walbus wrote:...you could automatically convert letters to sprites on the TI
Yes! Good old TI-Basic, with the Char, VChar, HChar functions.

I used to sit for hours plotting them out on graph paper. :lol:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Fill your PC with sand

Post by walbus »

Yes, the TI was way ahead of its time.
But you should have the extended basic module
The quality of the device was excellent
Then came the c64, I had six pieces, mostly the Ram was defective
Most of the people I've known had six of them.
User avatar
TI-994A
Addict
Addict
Posts: 2702
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Fill your PC with sand

Post by TI-994A »

walbus wrote:Yes, the TI was way ahead of its time...
It truly was. And, as my signature would suggest, mine was bundled with the speech synthesizer, which really set it apart from the others.

Code: Select all

CALL SAY "HELLO, WORLD!"
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Fill your PC with sand

Post by walbus »

Yes, unfortunately the module could only be used in English
For German you had to change the words so that it sounded German
But that was very tedious and sounded cruel.
Back then it was thought that it would never be possible to perfectly imitate the human voice.
Today you have to listen carefully to realize that it's not a human voice

It is a pity that there was no further development based on this device
User avatar
TI-994A
Addict
Addict
Posts: 2702
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Fill your PC with sand

Post by TI-994A »

walbus wrote:Yes, unfortunately the module could only be used in English ... you have to listen carefully to realize that it's not a human voice

It is a pity that there was no further development based on this device
The Speech Editor cartridge had a limited English vocabulary spoken in a human voice, but with the Terminal Emulator, words could be created phonetically to be synthesized by the speech module. That was fun doing.

And you're right; it's truly sad that the line was abandoned. Apparently, it was built so well that it became unviable against the lesser offerings of the competition.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Fill your PC with sand

Post by walbus »

@davido
Sorry, i have oversight your post
Yep, many thanks, i make a look for the falling text
@TI-994A
It was about money, if you do some research on the internet, you'll find the whole sad story.
With speech synthesis there were examples in German.
But it sounded creepy, you could hardly understand it.
It sounded like an English-speaking robot "into which the lightning struck and who then tries to speak German :wink:
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Fill your PC with sand

Post by applePi »

Thank you Michael very much for the hourglass idea
i have tested the hourglass with Gap equal 1 or 2 and it will block the sand if numar=400
with Gap = 4 it seems can't block the sand after several minutes, but this is not for sure
Thanks for MadMax who have posted this demo long time ago in 2004
a great demo really should be added to the official examples

Image

Code: Select all

If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
  MessageRequester("Error", "Can't open DirectX 7 Or later", 0)
  End
EndIf


numar=400

Structure part
x.f
y.f
sopas.b
EndStructure

Dim sand.part(numar)

For n=0 To numar
sand(n)\x=5+Random(460, 320);Random(789)
sand(n)\y=Random(200)
Next


If OpenScreen(800,600,32,"Dabidu")
Else
  MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
EndIf

fondo=CreateSprite(#PB_Any,800,100,0)

subfond=CreateSprite(#PB_Any,800,600,0)

StartDrawing(SpriteOutput(subfond))
folor=RGB(0,155,20)
Ellipse(400,180,100,140)
   Ellipse(400,450,100,140)
   Ellipse(400,180,90,130,#Black)
   Ellipse(400,450,90,130,#Black)
   Box(260,40,280,100,#Black)
   Box(260,500,280,140,#Black)
   Box(399,300,4,22,#Black);      Gap=4 does not block the sand..
   Box(300,500,200,12)  ; glass base

StopDrawing()

 Repeat
   
;=========================================================================================
DisplaySprite(subfond,0,0)
DisplayTransparentSprite(fondo,0,499)
;=========================================================================================

StartDrawing(ScreenOutput())
  FrontColor(RGB(255,255,0))
    For n=0 To numar
   
       Plot(sand(n)\x,sand(n)\y)
       
    If Point(sand(n)\x,sand(n)\y+1)=0
      sand(n)\y=sand(n)\y+1
    Else
      samba=0
     
        If Point(sand(n)\x-1,sand(n)\y+1)<>0
          samba=samba+2
        EndIf
       
        If Point(sand(n)\x+1,sand(n)\y+1)<>0
           samba=samba+4
        EndIf
       
        If Point(sand(n)\x-2,sand(n)\y+1)<>0
            samba=samba+8
        EndIf
       
        If Point(sand(n)\x+2,sand(n)\y+1)<>0
          samba=samba+16
        EndIf
 
          Select samba
         
            Case 0
              If Random(1)
                sand(n)\x=sand(n)\x+1
              Else
                sand(n)\x=sand(n)\x-1
              EndIf
             
 
            Case 2
              sand(n)\x=sand(n)\x+1


            Case 4
              sand(n)\x=sand(n)\x-1


            Case 6
              If Random(1)
                sand(n)\x=sand(n)\x+1
              Else
                sand(n)\x=sand(n)\x-1
              EndIf
             
 
            Case 8
              sand(n)\x=sand(n)\x+1
             

            Case 10
              sand(n)\x=sand(n)\x+1


            Case 14
              sand(n)\x=sand(n)\x+1


            Case 16
              sand(n)\x=sand(n)\x-1


            Case 20
              sand(n)\x=sand(n)\x-1


            Case 22
              sand(n)\x=sand(n)\x-1


            Case 26
              sand(n)\x=sand(n)\x+1
 
 
            Case 28
              sand(n)\x=sand(n)\x-1
 
 
            Case 30
              sand(n)\sopas=1
 
          EndSelect
 
    EndIf
   
  Next
   
StopDrawing()
;====================================
;====================================

StartDrawing(SpriteOutput(subfond))
  For n=0 To numar
    If sand(n)\sopas
      pichi=Random(55)+200
      FrontColor(RGB(pichi,pichi,0))
      Plot(sand(n)\x,sand(n)\y)

      sand(n)\x=5+Random(460, 320);Random(789)
      sand(n)\y=0
      sand(n)\sopas=0

    EndIf
  Next
StopDrawing()
;====================================
;====================================
 FlipBuffers()   
     
    ExamineKeyboard()
 
 Until KeyboardPushed(#PB_Key_Escape)
 
      End
Last edited by applePi on Mon Apr 16, 2018 11:49 am, edited 1 time in total.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Fill your PC with sand

Post by Dude »

Two questions:

(1) Why is there a big gap of sand between the first lot that drops, and the rest?

(2) How can this be sped up to fill the hourglass faster?

Thanks!
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Fill your PC with sand

Post by applePi »

@Dude
from experiment: if we change to:
Line 19 : sand(n)\y=Random(270)
Line 158: sand(n)\y=30
the gap will disappear
if fact the Gap exist in the original demo, but in the hourglass the points exist in a narrow area so the gap is more clear

Line 59: sand(n)\y=sand(n)\y+3 the falling speed is much more, but it will not accumulate, since we need to change other things

i suspect that this sand example is related to "cellular automata" computer subject in which the state of every square (item) affected by the state of nearby squares. the behavior can be very complex and can't be predicted by the human. look at this (very similar to sand example here):
https://www.youtube.com/watch?v=7YYVmQ8hQyw

and now i feel much better when i have realized that this sand demo is related to cellular automata subject. so we can make the simulation with a few big squares black and white 1 or 0 or more states and then we apply the rules and see what happened (better in slow motion)
the first article presented the cellular automata can be found here:
Conway's Game of Life: Scientific American, October 1970 :
http://www.ibiblio.org/lifepatterns/october1970.html
https://web.stanford.edu/class/sts145/Library/life.pdf
http://web.stanford.edu/~cdebs/GameOfLife/
Post Reply