1. RE: Contest #1 - Winner

Congratulations Aku!!!!

Just out of interest ...

where and when will Aku's program be released to the public?


Robert Craig wrote:
> I've finished judging contest #1 and the winner is Aku.


Ray Smith
http://rays-web.com

new topic     » topic index » view message » categorize

2. RE: Contest #1 - Winner

Hi,

> Robert Craig wrote:
> > I've finished judging contest #1 and the winner is Aku.

I Assume we can all post our attempts now to the list???

It will be interesting to see others attempts .... I'd like 
to see Derek's entry!!!

See my attempt below ...
(Note: Some bad programming practices used for speed!)

--------------------------
--timing stuff
include machine.e
tick_rate(100)
atom t  -- time
t = time()

-- Official Euphoria Contest - Easy
-- Ray Smith 2-Mar-2002

without type_check
without warning
--with trace

sequence p,p2,s,s2,o   -- cipher/extended cipher/stats/compress 
stats/out buffer
sequence b             -- input buffer
integer c,f,l          -- current char / file number / buffer length

function sort(sequence x)
sequence temp
   for i = 1 to length(x) - 1 do
      for j = i + 1 to length(x) do
         if x[j][1] < x[i][1] then
            temp = x[j]
            x[j] = x[i]
            x[i] = temp
         end if
      end for
  end for
  return x
end function

function my_find(integer c)
for i = 1 to 26 do
  if p[i] = c then
    return i
  end if
end for
end function

function get_bytes(integer fn, integer n)
sequence s
integer c
c = getc(fn)
if c = -1 then
  return {}
end if
s = repeat(c, n)
for i = 2 to n do
  s[i] = getc(fn)
end for
if s[n] != -1 then
  return s
else
  while s[n] = -1 do
    n -= 1
  end while
  return s[1..n]
end if
end function

-- init stats(frequency) sequence
s = repeat(0, 128)
-- read cipher
p = gets(0)
-- print inverse
for i = 'A' to 'Z' do
   puts(1, or_bits(64,my_find(i)))
end for
puts(1, "\n")

-- setup extended ciphre table
-- invalid chars remain as 0
-- A-Z live in 'A' - 'Z' slots
-- a-z live in 'a' - 'z' slots
p2=repeat(0,255)
for i = 'A' to 'Z' do
   p2[i] = p[i-64]
   p2[or_bits(i,#20)] = or_bits(p2[i], #20)
end for

-- process text
o = repeat(0, 4096)
while 1 do
   b = get_bytes(0, 4096)
   l = length(b)
   if l = 0 then
      exit
   end if

   for i = 1 to l do
      c = b[i]
      if p2[c] = 0 then
         o[i] = c
      else
         o[i] = p2[c]
         s[c]+=1
      end if
   end for
   puts(1, o[1..l])
end while

-- combine lower and upper totals
for i = 'A' to 'Z' do
   s[i]+=s[or_bits(i,#20)]
end for

-- create a new stats sequence with letters
s2 = repeat( {0,0}, 26)
for i = 1 to 26 do
   s2[i][1] = s[or_bits(i,64)]
   s2[i][2] = or_bits(i,64)
end for

-- sort & write letters.txt
s2 = sort(s2)
f = open("letters.txt", "w")
if f = -1 then
   puts(1, "Can't open letters.txt for output\n")
else
   for i = 26 to 1 by -1 do
      puts(f, s2[i][2] & " " & sprintf("%d\n", s2[i][1]))
   end for
   close(f)
end if

printf(2, "Time = %f\n", time() - t)

-----------------


Ray Smith
http://rays-web.com

new topic     » goto parent     » topic index » view message » categorize

3. RE: Contest #1 - Winner

can you atleast tell us who the first 5 were, i wanna see if the guy who 
inspires me was there!!

jordah 
Robert Craig wrote:
> I've finished judging contest #1 and the winner is Aku.
> 
> His program was correct and was faster 
> than the other 3 competitors.
> 
> The second place competitor was about 
> 12% slower than Aku.
> 
> I ran each program several times on a large input file,
> and Aku's was clearly faster.
> 
> The third place competitor was about 3x slower than Aku,
> and also ran out of memory on a huge input file.
> 
> The fourth place competitor did not produce output that
> was completely correct.
> 
> I'll post Aku's program later today.
> Tomorrow I'll judge contest #2 (7 competitors), and
> hopefully  Wednesday I'll do #3 (6 competitors).
> 
> Congratulations Aku, and I'll note your $20 MicroEconomy earnings
> in my files. Let me know if you want a discount coupon for DigiBuy.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. RE: Contest #1 - Winner

can you atleast tell us who the first 5 were, i wanna see if the guy who 
inspires me was there!!

jordah 
Robert Craig wrote:
> I've finished judging contest #1 and the winner is Aku.
> 
> His program was correct and was faster 
> than the other 3 competitors.
> 
> The second place competitor was about 
> 12% slower than Aku.
> 
> I ran each program several times on a large input file,
> and Aku's was clearly faster.
> 
> The third place competitor was about 3x slower than Aku,
> and also ran out of memory on a huge input file.
> 
> The fourth place competitor did not produce output that
> was completely correct.
> 
> I'll post Aku's program later today.
> Tomorrow I'll judge contest #2 (7 competitors), and
> hopefully  Wednesday I'll do #3 (6 competitors).
> 
> Congratulations Aku, and I'll note your $20 MicroEconomy earnings
> in my files. Let me know if you want a discount coupon for DigiBuy.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu