Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Rolling coins

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-01-2008, 01:32 PM
Junior Member
 
Join Date: Jul 2008
Posts: 37
Default Rolling coins

JUst a simple program, no instructions, just hit some buttons and see what
shapes emerge.

Equations curtesy of mathworld.wolfram.com

Cheers
Nick
Attached Files
File Type: sbp rolling.sbp (3.0 KB, 142 views)
Reply With Quote
  #2 (permalink)  
Old 10-01-2008, 02:04 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,734
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Very nice!
Reply With Quote
  #3 (permalink)  
Old 10-01-2008, 06:17 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

This brougth back so many memories.....
As I was a kid, aged 6 or 7, there was this brand of chocolate powder, wich came with a scantilion, a ruler by wich we could draw on paper Exactly these shapes...
As I did back then, today a spendt hours playing with the values and seeing the shapes being drwan in my screen....
I was 7 again.... Thank you very much...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #4 (permalink)  
Old 10-01-2008, 06:37 PM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Very nice work Nick
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk
Reply With Quote
  #5 (permalink)  
Old 10-01-2008, 07:22 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,734
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

There is a subtle bug in your code.
You are using an endless loop and therefore the program will not stop until you close it with task manager (optimized compiled version).
A simple correction is to use a global variable as a flag that breaks the loop when the main form is closing:
Code:
Sub Globals
    
'Declare the global variables here.
    Dim a, b, h, t, t1
    
Dim x, y, xstart, ystart
    
Dim showsmall, showlarge, showpole
    
Dim waittime, inner
    
Dim stop ' <---
End Sub

Sub App_Start

'  Equations curtesy of mathworld.wolfram.com
    stop = False
    Form1.Color = cBlack
    xstart = 
120 : ystart = 120 
    xsmall = xstart : ysmall = ystart
    a=
40:b=10:h=10:t=0:x=0:y=0
    showsmall=
1 : showlarge=1 : showpole=1
    waittime = 
20 : inner = 1
    SetTransparentColor(cWhite)
    form1.ForeLayer = 
True
    Form1.Show
    t1=
0
    
Do Until stop
        
If showlarge = 1 Then
            form1.Circle(xstart,ystart,a,cGray)
        
Else
            form1.Circle(xstart,ystart,a,cBlack)    
        
End If
        form1.FLine(
0,0,400,400,cWhite,BF)
        t=t1*
cPI/180
        
If inner = 1 Then
            z = a-b
            x=z*
Cos(t)+h*Cos(z/b*t)
        
Else
            z = a+b
            x=z*
Cos(t)-h*Cos(z/b*t)
        
End If
        y=z*
Sin(t)-h*Sin(z/b*t)
        xsmall=z*
Cos(t)
        ysmall=z*
Sin(t)
        form1.Line(xstart+x,ystart+y,xstart+x+
1,ystart+y+1,cWhite,BF)
        
If showsmall = 1 Then
            form1.FCircle(xstart+xsmall,ystart+ysmall,b,cGray)
        
End If
        
If showpole = 1 Then
            form1.FLine(xstart+xsmall,ystart+ysmall,xstart+x,ystart+y,cRed)
        
End If
        
DoEvents
        Sleep(waittime)
        t1 = t1 + 
1
    
Loop
    

End Sub
Sub Form1_Close
    stop = 
True
End Sub
Reply With Quote
  #6 (permalink)  
Old 10-01-2008, 08:09 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Cableguy View Post
This brougth back so many memories.....
Dito!
The "game" I had was called Spirograph.

@nm7s9: Really nice program!


specci48
Reply With Quote
  #7 (permalink)  
Old 10-02-2008, 02:44 AM
Junior Member
 
Join Date: Jul 2008
Posts: 37
Default

Ok - thanks Erel.

Is there a better way to plot a point than approximate it with a 2x2 block.
A 3x3 block with its centre at the correct point is more accurate than what I've done but is too thick, A 1x1 line didn't show up on my screen at all.

BTW I,40,20,40 shows that if your hula-hoop has a nail in it and is twice as big as your waist, then the nail is going to get you, always in the same place every second time round.

Better get a bigger hula hoop, and better still, make sure it is not a intergral size bigger than your waist.

I,46,20,46 makes some really interesting patterns and ensures that the nail strikes occurr evenly around your waist.
Reply With Quote
  #8 (permalink)  
Old 10-02-2008, 03:57 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,734
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Quote:
Is there a better way to plot a point than approximate it with a 2x2 block.
You can use Bitmap.SetPixel from the ImageLib library.
However it will be a little bit more complicated.
Reply With Quote
  #9 (permalink)  
Old 10-02-2008, 06:51 AM
Basic4ppc Veteran
 
Join Date: Feb 2008
Location: Hilversum, The Netherlands
Posts: 295
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Real nice!

Will you be enhancing it?
- different sizes
- different colors (agraham's color picker maybe)
- multiple rings
- a "stop" button
- save as function (I think dzt had a nice image lib)

Quote:
Originally Posted by specci48 View Post
Dito!
The "game" I had was called Spirograph.
@nm7s9: Really nice program!
specci48
Yes!
I always wanted to have it as a kid... but never got it :'(

Last edited by Mr_Gee : 10-02-2008 at 06:54 AM.
Reply With Quote
  #10 (permalink)  
Old 10-02-2008, 09:18 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Nice application.

Reminds me also some souvenirs, having programmed something similar quite some years ago.

Specci48, my daughter, once, got a similar game (also some years ago).

I agree with Mr_Gee, you should continue in adding the features discribed by him.

Another suggestions:
- stop the drawing when it beginns to overlap (drawing the same lines)
- by default when changing the small circle, put the drawing radius at the same value.

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


All times are GMT. The time now is 12:05 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0