TweetFollow Us on Twitter

Art
Volume Number:3
Issue Number:2
Column Tag:Fun With A Mac

Random MacArt in Basic

By Amy Barger, Waunakee, WI

Random MacArt is an MS Basic program which creates catchy modern art designs. Each design is unique and exciting with a general movement expressed. These designs can be created almost instantaneously and have many potential uses for decorating, entertainment, and experimentation. Figure 1 shows a design created by Random MacArt.

Fig. 1 Our random art program in Basic

Using Random MacArt

Random MacArt is an easy program to use. To create a design, press COMMAND R and watch the random designs appear; the computer screen will seem alive! Each design will finish on its own. After you have admired or printed the design, click the mouse button once and a fresh new design will appear. When you have created all the designs you want, you can save or print them. To save a design, type COMMAND SHIFT 3. This saves the screen. In order to print a design, make sure the printer is on, then type COMMAND SHIFT 4. This will print the active window. Stopping or listing the program follows the normal MS Basic conventions.

How Random MacArt Works

The program is simple to understand. We will begin with the first line and go through the program. RANDOMIZE TIMER bases random numbers according to the time on the Macintosh's internal clock. If you were to use this program again at exactly the same time that you had used it on a previous day, so that the clock reading was the same, the same design would be created. You will most likely never get the same design twice.

DIM shows the highest number of elements in the array specified in the statement. In this program it is set to 10 for both x and y. The DIM statement is really not necessary here because a maximum value of 10 is always assumed for an otherwise unspecified subscript, but it is good practice to routinely use DIM statements.

In order for designs to be created one after another without having to rerun the program each time, a loop is used. When the computer gets to the last line of the program, the statement GOTO loop instructs it to return to the line with the statement "loop".

The WINDOW statement opens a window on the screen within which the design will be drawn. The window-ID, one in this case, specifies the window's identification number. The commas show that there is no title for this window. (If there had been, it would have been in quotes between the two commas.) The numbers in parentheses specify the window size. The x values for this window are 10 and 502, and the y values are 26 and 332. Following the comma, the number three indicates that the type of window desired is an one-line border window.

Following the WINDOW statement is a FOR/NEXT loop that is used in determining ten random values of x and y, labeled as x(n) and y(n). The statements in the loop are executed with n increasing by one each cycle. RND(1) returns a random number in the range of 0 to 1. For x, the random number is multiplied by 440, and for y, by 254. INT converts the numbers into integers, and then two is added to each. These latter steps insure that the design is drawn within the window's border. NEXT n forms the loop. After ten iterations the loop is exited.

Next, nested FOR/NEXT loops are used to create the design based on the array of random x(n), y(n) values generated previously.

The LINE statement draws a straignt line between the coordinates pairs (x(n-1)+s*4), (y(n-1)+s*4) and (x(n)+s*4), (y(n)+s*4). For example, with n=0 and s=0 the statement becomes LINE (x(1),y(1))-(x(2),y(2)). NEXT n forms a loop so that the successive points will be connected. The LINE statement following NEXT n connects the last point with n=10 back to the first point with n=1.

Without the FOR/NEXT loop on s, the design would look flat and simple. On every pass through the s-loop an identical design is created with (x,y) points displaced four pixels away from the previous design. By the time the loop is completed the result consists of 13 superimposed designs.

The WHILE/WEND loop allows the user to view the design until the mouse button is depressed. MOUSE(0) is the state of the mouse button, with MOUSE(0)=0 indicating that the button has not been clicked and MOUSE(0)=-1 indicating that it has been. When the user clicks the mouse the WHILE statement will end with the WEND. (WEND means WHILE end). The colon allows two separate statements to be entered on one line. The CLS line clears the screen and the last line returns to "loop" to start a new design.

Possible Modifications To Improve Random MacArt

When you have tried the program and printed out some intricate designs, the next step is to experiment. If you would like your designs to have more sides to make them appear even more complex, or smaller to make them appear simpler, the number of random numbers to be chosen can be changed. Remember that if you increase the number of random numbers to be used, the DIM statement must also be increased. If you would prefer a larger or smaller screen, the window size numbers in the parentheses can be altered. Three other types of windows can be obtained by changing the number three after the parentheses to one, two, or four. Try altering the numbers which are multiplied and added to the random numbers. This will position your designs in different parts of the screen and make your designs larger or smaller. The distance between each line of your designs can be altered by changing the value the variable s is multiplied by. To create more or less lines, change the value of the variable s. As you can see the possiblities of this program are endless! Have a good time and experiment freely to make the most interesting designs possible. Try running this under the new compiler and see if you can notice any speed improvements.


RANDOMIZE TIMER
DIM x(10),y(10)

loop:
WINDOW 1,,(10,26)-(502,332),3
FOR n=1 TO 10
    x(n)=INT(RND(1)*440)+2
    y(n)=INT(RND(1)*254)+2
NEXT n

FOR s=0 TO 12
    FOR n=2 TO 10
        LINE (x(n-1)+s*4,y(n-1)+s*4)-(x(n)+s*4,y(n)+s*4)
    NEXT n
    LINE (x(10)+s*4,y(10)+s*4)-(x(1)+s*4,y(1)+s*4)
NEXT s

WHILE MOUSE(0)=0:WEND
CLS
GOTO loop
 
AAPL
$96.45
Apple Inc.
+1.23
MSFT
$42.26
Microsoft Corpora
+0.17
GOOG
$578.66
Google Inc.
-0.52

MacTech Search:
Community Search:

Software Updates via MacUpdate

XBMC 13.2-beta1 - Powerful media center...
XBMC is an award winning media center for OS X. The ultimate High Definition hub for all your media, XBMC is easy to use, looks slick, and has a large helpful community. Note: To install XBMC on OS... Read more
Bookends 12.2.1 - Reference management a...
Bookends is a full-featured bibliography/reference and information-management system for students and professionals. Access the power of Bookends directly from Mellel, Nisus Writer Pro, or MS Word (... Read more
NeoOffice 2014 - Mac-tailored, OpenOffic...
To download NeoOffice from the Apple Mac App Store, a $29.99 purchase is required. NeoOffice is a fully-featured set of office applications (including word processing, spreadsheet, presentation,... Read more
PhotoDesk 2.3.8 - Instagram client for p...
PhotoDesk (formerly InstaDesk) is an Instagram client for the Mac. PhotoDesk lets you not only browse your or your friends Instagram pictures, but easily explore the social graph and find new people... Read more
Garmin Express 3.2.13.0 - Manage your Ga...
Garmin Express is your essential tool for managing your Garmin devices. Update maps, golf courses and device software. You can even register your device. Update maps Update software Register your... Read more
Apple iTunes 11.3 - Manage your music, m...
Apple iTunes lets you organize and play digital music and video on your computer. It can automatically download new music, app, and book purchases across all your devices and computers. And it's a... Read more
Iridient Developer 2.4.3 - Powerful imag...
Iridient Developer (was RAW Developer) is a powerful image conversion application designed specifically for OS X. Iridient Developer gives advanced photographers total control over every aspect of... Read more
CrossOver 13.2 - Run Windows apps on you...
CrossOver can get your Windows productivity applications and PC games up and running on your Mac quickly and easily. CrossOver runs the Windows software that you need on Mac at home, in the office,... Read more
Tweetbot 1.6 - Popular Twitter client. (...
Tweetbot is a full-featured OS X Twitter client with a lot of personality. Whether it's the meticulously-crafted interface, sounds and animation, or features like multiple timelines and column views... Read more
Capo 3.1 - Slow down and learn to play y...
Capo lets you slow down your favorite songs so you can hear the notes and learn how they are played. With Capo, you can quickly tab out your songs atop a highly-detailed OpenCL-powered spectrogram... Read more

Latest Forum Discussions

See All

Cally’s Caves 2 Review
Cally’s Caves 2 Review By Nadia Oxford on July 14th, 2014 Our Rating: :: NOT A BAD CAVE STORYUniversal App - Designed for iPhone and iPad Cally’s Caves 2 is a very decent mobile action game, though the lack of recovery time after... | Read more »
Bungle! Review
Bungle! Review By Nadia Oxford on July 14th, 2014 Our Rating: :: A BUNGLING GOOD TIMEUniversal App - Designed for iPhone and iPad Bungle! is a simple, silly reflex game that’s lots more fun than working a cruddy summer job.   | Read more »
Minimalistic Puzzler Bicolor Adds New Le...
Minimalistic Puzzler Bicolor Adds New Levels in Latest Update Posted by Ellis Spice on July 11th, 2014 [ permalink ] | Read more »
Civilization Revolution 2 Review
Civilization Revolution 2 Review By Blake Grundman on July 11th, 2014 Our Rating: :: MORE REDUX THAN REVOLUTIONUniversal App - Designed for iPhone and iPad Is a new 3D coat of paint worth spending $14.99? In this case, probably not... | Read more »
Simian Flu Infects Plague Inc.’s Latest...
Simian Flu Infects Plague Inc.’s Latest Update Posted by Jennifer Allen on July 11th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
The Rhythm of Fighters Review
The Rhythm of Fighters Review By Lee Hamlet on July 11th, 2014 Our Rating: :: OFF-BEATiPhone App - Designed for the iPhone, compatible with the iPad The Rhythm of Fighters can’t capture the excitement of its beat-em-up equivalent,... | Read more »
Real Racing 3′s Gold Payout Substantiall...
Real Racing 3′s Gold Payout Substantially Increased in Latest Update Posted by Jennifer Allen on July 11th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Lomotif Review
Lomotif Review By Lee Hamlet on July 11th, 2014 Our Rating: :: INSTANT MUSIC VIDEOSiPad Only App - Designed for the iPad Adding music to short video clips has never been easier than it is with Lomotif.   | Read more »
Roll a Critical Sucess for Getting in Sh...
Roll a Critical Sucess for Getting in Shape With FitRPG: Gamifying Fitbit Posted by Jessica Fisher on July 11th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Alphabeats Review
Alphabeats Review By Jennifer Allen on July 11th, 2014 Our Rating: :: WORDY MUSICAL MASH-UPUniversal App - Designed for iPhone and iPad Tricky due to an awkward control system, Alphabeats is still an interesting combination of... | Read more »

Price Scanner via MacPrices.net

Cellular iPads on sale for $100 off MSRP
Best Buy has Cellular iPad Airs and iPad minis on sale for $100 off MSRP on their online store. Choose free shipping or free local store pickup. Prices valid for online orders only, in-store prices... Read more
Startup Co-Founded By Former Apple CEO Announ...
An estimated 70 million people in the US suffer from chronic sleep problems, which are associated with health problems including diabetes, obesity, depression, heart attack, and stroke. California-... Read more
TCleaner Pro Tool For Eliminating OS X Text F...
TCleaner Pro is a practical utility program to process text. It converts copied text into plain text, and instantly removes undesirable formatting when pasting text from a webpage, email, document or... Read more
Google’s Next Release of Android Uses Bluetoo...
At this year’s Google I/O, Google demonstrated tap-to-pay, step-by-step recipes, phone-to-watch functionality, and a new notification bridge. What did all of these scenarios have in common? Bluetooth... Read more
Get the lowest prices on MacBook Pros with Ap...
The Apple Store has Apple Certified Refurbished 13″ and 15″ MacBook Pros available for up to $400 off the cost of new models. Apple’s one-year warranty is standard, and shipping is free. Their prices... Read more
Apple 2014 Back to School promotion: $100 gif...
 Apple’s 2014 Back to School promotion includes a free $100 App Store Gift Card with the purchase of any new Mac (Mac mini excluded), or a $50 Gift Card with the purchase of an iPad or iPhone,... Read more
Apple has 11-inch 1.7GHz MacBook Airs, refurb...
The Apple Store has a limited number of 2012 11″ 1.7GHz i5 4GB/128GB MacBook Airs available for $599 including free shipping. Act now if you’re interested, as we expect these model to sell out... Read more
Save up to $100 on MacBook Airs
Adorama has the new 2014 MacBook Airs on sale for up to $100 off MSRP for a limited time. Shipping is free, and Adorama charges NY & NJ sales tax only: - 11″ 128GB MacBook Air: $854.99 MSRP $899... Read more
Tablet PC Quarterly Shipments Fall for the Fi...
NPD DisplaySearch’s Quarterly Mobile PC Shipment and Forecast Report provides more evidence that sub-8-inch tablet computers such as Apple’s iPad mini, Google’s Nexus 7 and Amazon’s Kindle Fire 7 are... Read more
MCE Ships Portable USB 3.0 2 TB + Blu-ray Rec...
MCE Technologies (MCE) has announced the company is shipping the MCE Complement: the world’s first portable, all-in-one, USB 3.0 device consisting of a 2 TB Hard Drive, a Blu-ray, DVD, CD Reader/... Read more

Jobs Board

Lead Software Engineer, *Apple* Online Stor...
**Job Summary** Imagine what you could do here. At Apple , great ideas have a way of becoming great products, services, and customer experiences very quickly. Bring Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
*Apple* University Producer %u2013 Leadershi...
**Job Summary** A producer in Apple University works with faculty, creative, engineering, and operations teams to drive the development of curriculum and help roll it Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.