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

Username:   Password: 
 RegisterRegister   
 The 20line or less weekly contest!
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2, 3, 4, 5, 6  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
deltamanx




PostPosted: Fri Jan 08, 2010 9:24 pm   Post subject: Re: The 20line or less weekly contest!

This might not look like much; but there's a reason I put it here.

code:

loop
     put "NOOB" ..
end loop


This would normally do nothing special right...
But guess what happened when I ran this with arguments to save everything it outputted to a file.
And then left it running while I was off on a 10 day vacation?
Result?
8.67 GB file composed of only NOOBNOOBNOOBNOOB...
I would have attached, but you put a limit. Razz

So ya. Now take a look at this in perspective...
Sponsor
Sponsor
Sponsor
sponsor
chrisbrown




PostPosted: Fri Jan 08, 2010 10:01 pm   Post subject: RE:The 20line or less weekly contest!

What a fantastic waste of computing power. IMO, each NOOB you have there increases your rank on the noob scale.

Also: you could have had a file 4-6 times bigger in the same time had you used a different language... just for perspective.
deltamanx




PostPosted: Fri Jan 08, 2010 10:22 pm   Post subject: Re: The 20line or less weekly contest!

Above was a joke submission, here's my real one.

code:
%Made by Deltamanx
setscreen ("graphics:600,600")
var a, b, v, x, y: int := 1
for z : 0 .. 800 by 25
    drawline (b, a, x + z, y, black)
    drawline (a, b, y, x + z, black)
    drawline (b, a, y, x + z, yellow)
    drawline (a, b,  x + z,y, yellow)
    drawline (1, 1, 600, 600 - z, blue)
    drawline (1, 1 + z, 600, 600, blue)
    drawline (300 + z, 1, 400, 600, red)
    drawline (300, 1, 200 - z, 600, red)
    drawline (1, 600 - y, 600, 600 - y, green)
    drawline (1, 1 + y, 600, 1 + y, green)
    a := x
    b := y
    v := v + 1
    y := y + v + 1
    delay (80)
end for


20 line on the mark.

I call it: Linear art.
petree08




PostPosted: Thu Apr 08, 2010 11:47 am   Post subject: RE:The 20line or less weekly contest!

It's cool man, but art? maybe not.
prateke




PostPosted: Wed May 12, 2010 5:50 pm   Post subject: Re: The 20line or less weekly contest!

Fastest factor finder in this forum!! Cool

code:

var x : int;loop;put "Enter number to get factors of: " ..;get x;cls;for i : 1 .. x;if (x mod i) = 0 then;put "Factors of ", x, " are :", i; end if;end for;end loop


its also very extremely and awesomely fast
I can has teh award for this week? Mr. Green Wink
Tony




PostPosted: Wed May 12, 2010 6:33 pm   Post subject: Re: The 20line or less weekly contest!

prateke @ Wed May 12, 2010 5:50 pm wrote:
Fastest factor finder in this forum!!

You can make it run in O(logN) instead of O(N) with one tiny change.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Geniis




PostPosted: Thu May 13, 2010 1:04 am   Post subject: Re: The 20line or less weekly contest!

not sure about O(logN), but i got it O(sqrtN)(at least i think that's what it is) :

Turing:

const number : nat := 7637325

proc PutFactors (num : nat)
    var cur : nat := 1
    var top : nat := num
    loop
        exit when cur >= top
        if num mod cur = 0 then
            put cur, " " ..
            if cur ** 2 not= num then
                put num div cur, " " ..
            end if
        end if
        top := num div cur
        cur += 1
    end loop
end PutFactors

PutFactors (number)
Brightguy




PostPosted: Thu May 13, 2010 8:57 am   Post subject: Re: The 20line or less weekly contest!

Geniis @ Thu May 13, 2010 1:04 am wrote:
not sure about O(logN), but i got it O(sqrtN)(at least i think that's what it is)

Yes, O(sqrt(N)) arithmetic (not bit) operations, where N is the number to factor. The log(N) was probably a misprint: there is no known polynomial time factoring algorithm.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu May 13, 2010 9:46 am   Post subject: Re: The 20line or less weekly contest!

Brightguy @ Thu May 13, 2010 8:57 am wrote:
The log(N) was probably a misprint

Right. I was thinking of N^0.5 (that being sqrt(N)).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
BITISCT




PostPosted: Thu Aug 12, 2010 12:29 am   Post subject: Re: The 20line or less weekly contest!

Very, very minimal langton's ant. Included is the original without lines cut out


Langton's ant(short).t
 Description:

Download
 Filename:  Langton's ant(short).t
 Filesize:  1.5 KB
 Downloaded:  246 Time(s)


Langton's ant.t
 Description:

Download
 Filename:  Langton's ant.t
 Filesize:  532 Bytes
 Downloaded:  237 Time(s)

goroyoshi




PostPosted: Sat Apr 02, 2011 7:45 pm   Post subject: Re: The 20line or less weekly contest!

are we still doing this?
if so then

Turing:

import GUI %required for buttons
setscreen ("nobuttonbar,graphics:200;200,title:Click masher") %making the screen smaller, taking out the annoying buttons at the top, and putting a title
var count, timecounted : int := 0  %the counters for clicks and time
process timecounter %counts the time and stops when at one minute then puts the amount of clicks done
    loop
        timecounted := Time.Elapsed
        exit when timecounted = 60000
    end loop
    put "In one minute you clicked ", count, " times"
end timecounter
proc lol %counter of clicks, starts on the first click
    if count = 0 then
        fork timecounter
    end if
    count += 1
end lol
var button : int := GUI.CreateButton (0, 0, 1, "Mash me", lol) %the button
loop
    exit when GUI.ProcessEvent %required to make button work
end loop
Insectoid




PostPosted: Sat Apr 02, 2011 8:28 pm   Post subject: RE:The 20line or less weekly contest!

If you have a look at some of the other submissions in this thread, you'll see that a button masher is not really contest material.
mirhagk




PostPosted: Thu Nov 03, 2011 2:26 am   Post subject: RE:The 20line or less weekly contest!

Not sure if this is still going, but I made one of the scariest programs ever. It has no variables, instead it directly references memory addresses, and it has a nasty optimization because of this. See if you can a) determine what the program does b) determine how it does it. Have fun Wink

17 lines of code, oh and make sure you input a number at the beginning
Turing:

put nat4@(65536)
get nat4@(65536)
nat2@(65540) := floor (sqrt (nat4@(65536)))
nat4@(65544) := 1
loop
    if nat4@(65536) mod nat2@(65544) = 0 then
        nat2@(65546 + (nat2@(65546) + 1) * 2) := nat2@(65544)
        nat4@(65544) += 1 shl 16 + 1
    else
        nat2@(65544) += 1
    end if
    exit when nat2@(65544) > nat2@(65540)
end loop
nat2@(65544) := 0
loop
    nat2@(65544) += 1
    put nat2@(65536) div nat2@(65546 + nat2@(65544) * 2), ", ", nat2@(65546 + nat2@(65544) * 2), ", " ..
    exit when nat2@(65544) = nat2@(65546)
end loop


EDIT: found another spot for that little optimization, and added a cool feature to the top
Beastinonyou




PostPosted: Thu Nov 03, 2011 7:51 am   Post subject: Re: RE:The 20line or less weekly contest!

mirhagk @ Thu Nov 03, 2011 2:26 am wrote:
a) determine what the program does


Well, it seems it returns all multiples of that number. As for how it does it.... Are you David Copperfield? or David Blaine?
mirhagk




PostPosted: Thu Nov 03, 2011 5:55 pm   Post subject: RE:The 20line or less weekly contest!

It's not super difficult lol, it's essentially just using assembly, have to keep a few things in mind, once you get used to numbers for variables it's not hard, just a bit confusing, I can comment it all if anyone'd like.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 5 of 6  [ 84 Posts ]
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Jump to:   


Style:  
Search: