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

Username:   Password: 
 RegisterRegister   
 New Commands for Turing
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jamonathin




PostPosted: Fri Jun 24, 2005 9:39 pm   Post subject: (No subject)

Interesting way to draw your circle. To bad it only took 40 seconds to draw it on my crap ass comp. I think the only way to do it is to Draw.Fill, but that too would slow it down.

I was thinking of changing all of Turing's Draw.Whatever where we have to input an int, if we were to change that to a real, and in the actualy command (In Draw.tu ) we were to simply round it there, saving time and trouble for the user.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Fri Jun 24, 2005 10:38 pm   Post subject: (No subject)

Hmm, well I ran it on a Althon 64 2.8ghz and it ran pretty fast Wink took only around 1/2 seconds... I guess I didn't really put into consideration the speed of the computer, hmm... Actually, I have another idea *jots it down* thanks jamonathin! I'll try it out and post it if it works.

Oh, and out of interest, what was the thickness/radius of the circle you were drawing?

I'll work on some other fixes/commands too.. I forgot to add the syntax of the Draw.ThickCircle - its:
code:
Draw.ThickCircle (x,y,radius,thickness,colour)

Just in case Smile.
wtd




PostPosted: Fri Jun 24, 2005 11:16 pm   Post subject: (No subject)

If you're drawing simple geometric shapes with thickness, you may wish to add the ability for your procedure to draw one side thicker than the other.
Cervantes




PostPosted: Sat Jun 25, 2005 7:34 am   Post subject: (No subject)

If you're drawing some basic shape and you can SEE it being drawn, it's too slow. I don't think there's much we can do about drawing.
Jamonathin: That's a good idea, but keep in mind you cannot change the code for Draw.Box and others like it. You can change the parameters, but then it doesn't work. I suppose you could make a second procedure, but it would have to have a different name. Too bad Turing doesn't have overloading. Wink
Cervantes




PostPosted: Sat Jun 25, 2005 9:51 am   Post subject: Ideas

If anyone wants any ideas for procedures/functions to code, a good place to look is the Ruby Class and Library Reference. Sections to pay particular attention to would be strings and arrays.
Token




PostPosted: Sat Jun 25, 2005 10:49 am   Post subject: (No subject)

WOW! awsome idea Cervantes, if anyone is gonna start working on this, let me know so that i can add it to the list.
Cervantes




PostPosted: Sat Jun 25, 2005 12:23 pm   Post subject: (No subject)

Here's all the methods I thought were feasible up until "s". I'll finish them later. I've attached it as the Str module, sorry if you prefer otherwise. Keep in mind that you don't have to overwrite the existing Str module; you can just open file from its current location and then delete the module, export, and all the lines starting with external.

Also, Ruby's methods are interesting in that they have, as wtd calls them, "visual indicators" as to what they do. For example, capitalize! is a procedure that will change what it is referring to.
Ruby:

myString = "hello WOrld"
myString.capitalize!
puts myString

Output:

Hello world


On the other hand, you could use the function, capitalize.
Ruby:

myString = "hello WOrld"
puts myString.capitalize

Same output.

Similarly, Ruby has methods that end in a question mark (?) that indicate the method returns a boolean value. Ex. empty?

I've tried to make a system that works something like this. But, Turing will not allow is to have characters such as ! and ? as part of method names (or anything, for that matter Rolling Eyes). So, instead of using ! at the end, I've made it Make_<method name>. Instead of using ? at the end, I've made it Is_<method name>.

Enough talking about Ruby. Here's the file. Smile



Str.tu
 Description:
modified

Download
 Filename:  Str.tu
 Filesize:  5.95 KB
 Downloaded:  81 Time(s)

wtd




PostPosted: Sat Jun 25, 2005 1:16 pm   Post subject: (No subject)

Instead of "make", how about "modify"?
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sat Jun 25, 2005 1:45 pm   Post subject: (No subject)

Amazing! Some of that stuff is really useful, great idea to take stuff from other languages Smile. Ruby seems pretty great.

Here are two really simple things I added to the Math module. CircleArea and Slope. Slope is just basic, and it doesn't give the answer in fraction form even though that's how you usually need it for school?

Turing:
    %
    % Calculate the slope between two points.
    % By: [Gandalf]
    %
    function Slope (x1, y1, x2, y2 : real) : real
        var final : real
        final := (y1 - y2) / (x1 - x2)
        result final
    end Slope

    %
    % Calculate the area of a circle.
    % By: [Gandalf]
    %
    function CircleArea (radius : real) : real
        var area : real
        area := PI * (radius ** 2)   %PI is already declared in the Math module
        result area
    end CircleArea
Token




PostPosted: Sat Jun 25, 2005 3:12 pm   Post subject: (No subject)

hey gandalf, yah its okay that its not in fraction format, it is just over 1 so if it returned 1.5 for the slope its 1.5/1, and hate to break it to yah, lol its already in the new module, umm and i'll add in the Circle one right now. could u please make a help file for the circle one for me and send it over? (using the template I sent). thanks alot, keep em coming guys

Cervantes: yah (as the e-mail said) we'd prefer it in a separate module. if u dont feel like separating them (i wouldent blame you) just let me know which commands you added and then i'll do it, if u do separate it add it to AdvStr or somthin. thx alot
Bacchus




PostPosted: Sat Jun 25, 2005 3:20 pm   Post subject: (No subject)

Gandalf, your ThickCircle draws a bit slowly... I looked at it and didn't figure out why you did some things.. also it can't make Ovals. So here try this:
code:
proc ThickOval (x, y, xr, yr, thickness, c : int)
    for i : 1 .. 360
        Draw.FillOval (round (x + (cosd (i) * xr)), round (y + (sind (i) * yr)), thickness, thickness, c)
    end for
end ThickOval
MysticVegeta




PostPosted: Sat Jun 25, 2005 3:45 pm   Post subject: (No subject)

eh?
code:
proc ThickFillOval (x, y, xr, yr, thickness, ct, cm : int)
    drawoval (x, y, xr, yr, 255)
    for s : 1 .. thickness
        drawoval (x, y, xr + s, yr + s, 255)
        drawoval (x, y, xr - s, yr - s, 255)
    end for
    drawfilloval (x, y, xr - 1, yr - 1, cm)
end ThickFillOval

ThickFillOval (maxx div 2, maxy div 2, 50, 50, 3, 255, brightred)
[Gandalf]




PostPosted: Sat Jun 25, 2005 3:45 pm   Post subject: (No subject)

Thanks Bacchus!

Token, I think you're missing the point. It's better to have it already in the module if there is a coresponding one, and if its some totally new idea (we don't have a lot of those) then we can make a new module. I am strongly inclined to keep the new commands in the already existing modules. Also, I didn't know somebody was working on Math, but that's alright.

Do you need a helpfile for Draw.ThickCircle and Draw.ThickBox too?

*EDIT* What's that MysticVegeta? It doesn't work good at all Confused. The thing we are trying to eliminate is the white spots in the actual circle. We are also avoiding using drawfill* because of speed.

Oh, wait - I noticed the Draw.ThickFILLOval. Thanks for the contribution, but try to get rid of the white spaces.
Token




PostPosted: Sat Jun 25, 2005 3:49 pm   Post subject: (No subject)

alright, i guess we'll put them in their respective modules, but we have to make sure that when we are done the func you fill out a help file. that way we dont miss anything. so yes please fill out a help file, they take 5-10 minutes each so its not that big of a deal
wtd




PostPosted: Sat Jun 25, 2005 3:59 pm   Post subject: (No subject)

[Gandalf] wrote:
Amazing! Some of that stuff is really useful, great idea to take stuff from other languages Smile. Ruby seems pretty great.


So, just use Ruby. Razz
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 4 of 8  [ 119 Posts ]
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Jump to:   


Style:  
Search: