Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Need Help
Author Message
CyCLoBoT

Posted: Fri Feb 14, 2003 11:38 am   Post subject: Need Help

I would like to draw random circles in this 10x10 box. Any suggestions on how I can do that?

 code: for i : 1 .. 11     drawline (60 + 30 * i, 90, 60 + 30 * i, 390, black)     drawline (90, 60 + 30 * i, 390, 60 + 30 * i, black)     drawline (60 + 30 * i, 30, 60 + 30 * i, 60, black)     drawline (60 + 30 * i, 420, 60 + 30 * i, 450, black)     drawline (30, 60 + 30 * i, 60, 60 + 30 * i, black)     drawline (420, 60 + 30 * i, 450, 60 + 30 * i, black) end for

Tony

Posted: Fri Feb 14, 2003 3:17 pm   Post subject: (No subject)

you can use randint(x,1,10) and randint(y,1,10) to randomly select a box to draw in... then you multiply each value by your box width (i assume 30) and add boarder size... thats the center of the circle you have to draw.
Tony's programming blog. DWITE - a programming contest.
CyCLoBoT

Posted: Sat Feb 15, 2003 3:16 am   Post subject: (No subject)

I tried it but was unable to draw the circles. If anyone can try to code it, I would really appreciate it.
Tony

Posted: Sat Feb 15, 2003 8:02 am   Post subject: (No subject)

Tony's programming blog. DWITE - a programming contest.
CyCLoBoT

Posted: Sat Feb 15, 2003 3:37 pm   Post subject: (No subject)

The thing is that I want to in a way that everytime the user runs the program it draws 5 circles randomly in any one of the squares of 10x10 grid.
Tony

Posted: Sat Feb 15, 2003 4:31 pm   Post subject: (No subject)

so randomly select a square and draw a circle in there... I fail to see what you need help with. Please be more specific
Tony's programming blog. DWITE - a programming contest.
CyCLoBoT

Posted: Sun Feb 16, 2003 1:55 am   Post subject: (No subject)

I have drawn the 10x10 boxes with lines. So how do I know which box to randomly select and put a circle in that particular box.
Izzy

Posted: Sun Feb 16, 2003 2:25 am   Post subject: (No subject)

Here'yar

 code: % Sets up the windos display features' setscreen ("graphics:vga") setscreen ("graphics:502;502") % sets up the lines creating the 10x10 field (This one sets up the horizontal lines) for y : 0 .. 500 by 50     drawline (0, y, 500, y, 15) end for % sets up the lines creating the 10x10 field (This one sets up the vertical lines) for x : 0 .. 500 by 50     drawline (x, 0, x, 500, 15) end for % declaration of variables var x, y : int := 25 var RandX, RandY, ColorIsCooler : int % Repeats the code x10 for SetupTable : 1 .. 10     % Genereates Random Numbers to be used     % Randomly selects a color     randint (ColorIsCooler, 1, 15)     % Randomly selects a box on the x-axis     randint (RandX, 0, 9)     % Randomly selects a box on the y-axis     randint (RandY, 0, 9)         % A little math to change a number from 0-9 to a number that fits the box setup     x := (RandX * 50) + x     y := (RandY * 50) + y         % Draws the oval     drawfilloval (x, y, 23, 23, ColorIsCooler)         % Resets the x and y values because we are going to re-use the code     x := 25     y := 25 end for

- Izzy

*Edited again... lol. wrong programmers comment meathod (used ' instead of %) gimme a break i've been using other languages *

Tony

Posted: Sun Feb 16, 2003 5:58 am   Post subject: (No subject)

mmm.... VB

if anyone sees me using // for comments, thats from C++
Tony's programming blog. DWITE - a programming contest.
CyCLoBoT

Posted: Mon Feb 17, 2003 1:43 am   Post subject: (No subject)

thank you all for your help. I really appreciate it
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 10 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: