Request a Tutorial
Author |
Message |
Paul
|
Posted: Sun Apr 11, 2004 7:09 pm Post subject: (No subject) |
|
|
I dunno exactly what I want, but I wanna learn something new and I don't know where to start or in which direction to go. Heres what I know, Im 3/4 of the way done grade 10 compsci:
string manipulation
graphics like drawing stuff
moving pictures
arrays, 2d arrays
getting and putting stuff with text files
Mouse stuff
keyboard stuff
enough to make pong
procedures but NOT functions
loop stuff
prolly learned some other stuff, but forgot.
Any topics that would be interesting? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
AsianSensation
|
Posted: Sun Apr 11, 2004 7:17 pm Post subject: (No subject) |
|
|
well, first functions, and then OOP. pointers, classes, modules. When you move on to higher languages, you will find that Object Oriented Programming is better. |
|
|
|
|
|
zylum
|
Posted: Sun Apr 11, 2004 7:19 pm Post subject: (No subject) |
|
|
i dunno why you didnt learn functions if you learned procedures... a function is almost like a procedure but what it does is it returns a value. for this reason there is a slightly different way of calling it:
code: | function findSquare (number : int) : real
var square : real
square := sqrt (number)
result square
end findSquare |
notice the " :real" at the end of the declaration... this is the type of what is being returned. to call a function, do it the same way you normally do with predefined functions such as sqrt()
and as far as things to learn, i suggest you learn recursion... its pretty phun
-zylum |
|
|
|
|
|
Paul
|
Posted: Sun Apr 11, 2004 7:35 pm Post subject: (No subject) |
|
|
Oh, so that function if I put "put findSquare (9)" would return 3 right? ok. Yea I've heard recursion being thrown around here and there, but have no idea what it is. There was this one guy who gave a lengthy explanation that made no sense to me. and I quote:
Quote:
A function that calls a simpler version of itself to arrive at a solution. For example, the factorial function (n!) can be defined recursively as (n(n-1)!), where (0!) is defined as equal to1. If a function calls another function that calls back the original function again, it is called mutual recursion; most ray-tracing programs fall into this general category.
|
|
|
|
|
|
zylum
|
Posted: Sun Apr 11, 2004 7:40 pm Post subject: (No subject) |
|
|
basically what recursion is it's a function or procedure which calls itself... this could be very useful for things such as path finding or making fractals and all these phun things. check out catalysts or my tree program... in both cases we have a procedure which calls itself a certain amount of times to creat the effect |
|
|
|
|
|
Paul
|
Posted: Sun Apr 11, 2004 7:42 pm Post subject: (No subject) |
|
|
It sounds pretty complicated to me, but I'd like to learn it. you already taught me the basic function, that means I've actually learned something, which is more than I can say for my last 3 compsci classes. Look I've even made my own function, dunno if its what functions are used for and dunno if theres more to it.
code: |
var num: int
function findsides (tiles: int): real
var side: int
side:=floor(sqrt(tiles))
result side
end findsides
get num
put "The biggest square you can make has a side length of: ", findsides(num)
|
|
|
|
|
|
|
Tony
|
Posted: Sun Apr 11, 2004 7:45 pm Post subject: (No subject) |
|
|
heh, here's an example of factorial function
code: |
function factorial(n:int):int
if n=0 then
result 1
else
result n*factorial(n-1)
end if
end factorial
for i:1..10
put i,"! : ", factorial(i)
end for
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
zylum
|
Posted: Sun Apr 11, 2004 7:51 pm Post subject: (No subject) |
|
|
yup, thats a nice example of recursion |
|
|
|
|
|
Sponsor Sponsor
|
|
|
MyPistolsIn3D
|
Posted: Thu Apr 29, 2004 1:53 pm Post subject: type |
|
|
how to use the type command. the reference is confusng.thx. |
|
|
|
|
|
AsianSensation
|
|
|
|
|
MyPistolsIn3D
|
Posted: Thu Apr 29, 2004 7:01 pm Post subject: (No subject) |
|
|
ty |
|
|
|
|
|
noobprogrammer123
|
Posted: Tue May 04, 2004 6:37 pm Post subject: (No subject) |
|
|
i need a tutorial on making a "hall of fame" type thing in a game, so if the user gets a high score they input their name it goes in the "hall of fame" |
|
|
|
|
|
Delos
|
|
|
|
|
junkpro11
|
Posted: Tue May 04, 2004 7:56 pm Post subject: (No subject) |
|
|
i need help on basic stuff like repeat...can u teach me how to use repeat? i think itz useful but i dunno how to use it |
|
|
|
|
|
Paul
|
Posted: Wed May 05, 2004 6:21 pm Post subject: (No subject) |
|
|
put repeat (string, #timestoberepeated)
example
code: |
put repeat ("a", 5)
|
outputs a, 5 times. |
|
|
|
|
|
|
|