Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to draw a grid using co-ordinate increments.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nikoudov




PostPosted: Tue Jan 16, 2007 7:21 pm   Post subject: How to draw a grid using co-ordinate increments.

How to draw a grid using simple co-ordinate increments.

This might sound like foolish help, but most of the people I know are unaware of the simplicity. Note: You do NOT have to make any "arrays" or how ever.

Here is the turing code, the comments in the code will explain how everything works.


Turing:

% Nik Udovitskiy
% 01.15.07
% Grid.t
% Demonstrates the simple way to draw a grid using co-ordinate increments.

% Sets Screen.
setscreen ("graphics:520;550")

% Co-ordinate variables.
var a, a2, b, b2 : int := 0

% The variables used for the centre of the execution window in the "x" & "y" co-ordinates.
const centerx := maxx div 2
const centery := maxy div 2

% Procedure statement that draws the grid.
procedure DrawGrid
    % Draws rectangles vertically.
    a := centerx - 256
    a2 := centerx - 226
    b := centery - 210
    b2 := centery - 180
    for i : 1 .. 14
        a := a + 30
        a2 := a2 + 30
        drawbox (a, centery - 210, a2, centery + 210, black)
    end for
    % Draws rectangles horizontally.
    a := centerx - 224
    a2 := centerx - 194
    b := centery - 240
    b2 := centery - 210
    for i : 1 .. 14
        b := b + 30
        b2 := b2 + 30
        drawbox (centerx - 226, b, centerx + 226, b2, black)
    end for
end DrawGrid

DrawGrid





Now, after experimenting wiht this, you'll see the simplicity.

Cervantes added syntax tags



Grid.t
 Description:

Download
 Filename:  Grid.t
 Filesize:  981 Bytes
 Downloaded:  121 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: