Computer Science Canada

[tutorial] For Extreme Newbies

Author:  hez [ Wed May 21, 2003 11:29 pm ]
Post subject:  [tutorial] For Extreme Newbies

maybe this should have been in the ""turing Help" forum but i wasn't sure..

This is for Serious newbies only, i will explain and show you the most common progs (I Think) that newbies want to

know about Laughing

Using Font Tags:


var fontID:int:=Font.New("IMPACT:50:italic")

Font.Draw("TESTING!...", 250 , 200, fontID, black)

As you can see, font tags alow you to have a different font/size/color for your message rather than the default font in turing....

var fontID:int:=Font.New("IMPACT:50:italic")
Allows you to specify which font/size/style your font will

be and they have to be in that specific order.
Font.Draw("TESTING!...", 250 , 200, fontID, black)
Allows you to write your font on the screen, "250" is the x axis spacing and "200" is the y axis spacing,

try this and see if you can get the hang of it.

Fahreneit to Celsius

var celsius,fahrenheit: real
var counter:int:=0

put "Please enter a degree in fahrenheit"
get fahrenheit

celsius := 5/9 * (fahrenheit - 32)

put "When converted "..
put fahrenheit..
put " degrees fahrenheit into celsius it would be: ",celsius:50:2 ..
put " degrees celsius"

The main key in this program is the formula "5/9 * (fahrenheit - 32)" which converts from two bases... very easy

Minutes to Convert to Days, Hours and Minutes Left

var mins,hr1,min1,days1,hrleft: int

put " Please Enter the Number of Minutes to convert"
get mins

hr1:= mins div 60
days1:= hr1 div 24
min1:= mins mod 60
hrleft:= hr1 - days1 * 24

put "Days "..
put days1
put "Hours "..
put hrleft
put "Minutes "..
put min1

This program shows how to pass values when one value is full, and usage of "mod"(remainder) and div "(Divide without

decimal places).

Area of an Triangle

var sd1,sd2,sd3,s,area: real

put "Please Enter the first side of the triangle"
get sd1

put "Please Enter the second side of the triangle"
get sd2

put "Please Enter the third side of the triangle"
get sd3

s:= (sd1 + sd2 + sd3) / 2
area:=( sqrt (s * (s-sd1) * (s-sd2) * (s-sd3) ) )

put "The area of the trangle would be "..
put area

This shows you how to use the forumla "( sqrt (s * (s-sd1) * (s-sd2) * (s-sd3) ) )" to figure out the area inside an


Slot Machine

var token : int := 100
var num1, num2, num3 : int
var ans : string

    if token = 0 then
        play ("8>>b<<>b<b<b>pppp")
        put ("Whoops! You ran out of tokens better luck next time...")
    end if

    put "You have ", token, " tokens. Pull?" ..
    put "   <Y/N>   " ..
    get ans
    if ans = "Y" or ans = "y" then
        token -= 1
        for spin:1..20
            put "Spinning.."
            put "---------"
            randint (num1, 1, 3)
            randint (num2, 1, 3)
            randint (num3, 1, 3)
            put "[", num1, "]" ..
            put "[", num2, "]" ..
            put "[", num3, "]"
            put "---------"

        end for

        if num1 = 1 and num2 = 1 and num3 = 1 then
            play (">>>faba<<<p")
            put "You won 4 Tokens!"
            token += 4

        elsif num1 = 2 and num2 = 2 and num3 = 2 then
            play (">>>faba<<<p")
            put "You won 8 tokens!"

        elsif num1 = 3 and num2 = 3 and num3 = 3 then
            play (">>>faba<<<p")
            put "You won 12 tokens!"
            token += 12
            play ("<<<<<f>>>>>p")
            put "You lost"
        end if

    elsif ans = "N" or ans = "n" then
        put "Better Luck Next Time.."
        put "PLEASE ENTER 'Y' for YES or 'N' for NO"
        put ""

    end if

end loop

A fun little olg game which simply uses 3 randint numbers and compares them, if they turn out to be the same you get

tokens,else you lose a token every turn (100 to start off with).

Well, thats it for now hope someone can benefit from this tiny stuff.
More availible at :

Author:  Tony [ Thu May 22, 2003 10:17 am ]
Post subject: 

thx hez Smile


Maybe you could post some more from your site? Or expand on our tutorials if the topics are already covered.

Author:  Prince [ Thu May 22, 2003 10:24 am ]
Post subject: 

good job... cool site too

Author:  whowho [ Thu May 22, 2003 4:55 pm ]
Post subject: 

cool Twisted Evil Twisted Evil Razz Mad
who is Nat Por

Author:  skatelhs [ Thu May 22, 2003 5:01 pm ]
Post subject:  not that newbie

hey, im in grade 10 compsci and that stuff isnt all that easy for me...
try like

var name:string
get name
put "Hello, ", name

Author:  Asok [ Thu May 22, 2003 5:41 pm ]
Post subject: 

we have a tutorial on that allready skate.

Author:  delusional_ [ Sat Nov 15, 2003 5:11 pm ]
Post subject:  thanx

thanks for that website, there should be more sites like that out there for people who suk at proggramming coz their skool courses suk Rolling Eyes

Author:  Tony [ Sat Nov 15, 2003 5:28 pm ]
Post subject: 

yeah... well it looks like we're the only site around Confused

if you have any sujestions for improvement, let us know Wink

Author:  santabruzer [ Sun Nov 16, 2003 8:54 pm ]
Post subject: 

This is an amazing site...
(At least people are taking the initiative... and creating other great sites)

Author:  TheLostSoul [ Thu Mar 11, 2004 6:35 pm ]
Post subject: 

Thx For This, I Have A Question Tho....I Am Learning This In School, And I Am Trying To Make A Animation With This Slot Machine, I Am Wondering How I Would Put The Numbers In Different Positions On The Screen? The Only Way I Can Think Of Is Using

put "":10, "[",num1,"]"

And Such, I Was Wondering If There Is A Better Way, So I Can Change The Size As Well?

Thx A Lot

Author:  Tony [ Thu Mar 11, 2004 7:26 pm ]
Post subject: 

well... use Font module

var fontID:int := Font.New("Arial:30")
var text:string

text:= "["+intstr(Rand.Int(0,9))+"]["+intstr(Rand.Int(0,9))+"]["+intstr(Rand.Int(0,9))+"]"
end loop

Author:  recneps [ Fri Mar 12, 2004 2:34 pm ]
Post subject: 

even simpler than what tony said, if you dont understand it, is use the
intstr command, it converts and integer to a string (or strreal, i tink you can figure that one out) and just stick that in your Font.Draw like this


thatll draw your variable, x, as a string, using Font.Draw at xposition xpos and y position ypos.