1. contest questions

Hi,

The contest is an excellent idea Rob.
I can see alot of discussion re: optimisation and algoritms after the 
contest is over. 

* Obviously the anonymous donor wants to stay "anonymous" ... why?
I can't think of any reason why the donor doesn't want to be known.
(If it was me I'd want everyone to know I donated it!!!!)

* Is the time to load the database part of the calculated time to 
decipher the sentence?  If it is can we re-organise the database in a 
particular order to help the load time.
ie. if we create some new hash scheme can we re-order the table to
make the load time faster and therefore reduce total decipher time.

* Just to get my brain working I did the "easy" contest.  
(60 lines of code executing in 0.05 seconds! - ok I haven't done any
optimisations :( )
How do we calculate total time of execution???

Is this correct?
----------
atom t
t = time()

...
do all processing
...

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

Will you add this to everyone's code or should we do this?

With this above method the execution time seems to vary greatly using 
"ex" under Win98 using the same data.
What methods (OS's?) will be used to do the offical benchmarks?

Thanks,

Ray Smith
http://rays-web.com

new topic     » topic index » view message » categorize

2. contest questions

Contest #1:

   Will the input cipher ALWAYS be upper case? Otherwise the program 
will need to convert the cipher to all uppercase first, to standardize 
it.


Chris

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

3. Re: contest questions

Chris Bensler writes:
> Will the input cipher ALWAYS be upper case? Otherwise the program 
> will need to convert the cipher to all uppercase first, to standardize it.

Yes, you can assume that the cipher line will be present,
and will be all capitals, and will have exactly one occurrence
of each of the 26 letters.

Jeremy Self writes:
> I'm thinking of entering the Beginner's contest, 
> and was wondering if using the machine code library 
> would be allowed or not. Thanks

You can include machine.e if you want, and you can do
peeks and pokes if you want, but I'm going to disallow
the use of machine code routines. I'll also disallow
system() calls to external programs (that might not
even be written in Euphoria). This is supposed to be
a test of Euphoria programming skill, not machine code
or C or anything else.

C.K. Lester writes:
> For the contests, what is "standard input?"

It's file number 0.
i.e. your program should read from file 0,
using for example, getc(0) or gets(0),
and write to file 1, using puts(1, ...) or printf(1, ...) etc.
It should be possible to run your program
from a command line, such as:

        ex yourprog < english.txt > coded.txt

> Or is standard input the keyboard?

Without the "<" on the command-line
it would be, but I'm not going to test it that way.

> Also, will the cipher line necessarily be sequential? For instance, 
> might we encounter:

>ABCDEFGHIJKLMNOPQRSTUVWXYZ
> PRSTWUVZQMABCDEFGHXYIJKLNO <-- cipher line
>
> This is a simple one-to-one replacement, but the cipher line, you'll 
> note, is not sequential.

I'm not sure what you are driving at,
but the cipher line could be any random shuffling
of the letters A to Z, with no duplicate letters.
The example I give on the Web page is in sequential order in places,
but that's just because I started with ABC..YZ, and was kind of 
lazy in shuffling things around.

I'll add these points to the Web page.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

4. Re: contest questions

I assume that the only thing that one can assume is - that you can't assume
anything about the inputs.

In fact, I'd assume the worst - that the inputs just might be invalid - so
make the appropriate checks and adjustments. Code defensively.
----------
Derek.

----- Original Message -----
From: "Robert Craig" <rds at RapidEuphoria.com>
To: "EUforum" <EUforum at topica.com>
Subject: Re: contest questions


>
> Chris Bensler writes:
> > Will the input cipher ALWAYS be upper case? Otherwise the program
> > will need to convert the cipher to all uppercase first, to standardize
it.
>
> Yes, you can assume that the cipher line will be present,
> and will be all capitals, and will have exactly one occurrence
> of each of the 26 letters.
>
> Jeremy Self writes:
> > I'm thinking of entering the Beginner's contest,
> > and was wondering if using the machine code library
> > would be allowed or not. Thanks
>
> You can include machine.e if you want, and you can do
> peeks and pokes if you want, but I'm going to disallow
> the use of machine code routines. I'll also disallow
> system() calls to external programs (that might not
> even be written in Euphoria). This is supposed to be
> a test of Euphoria programming skill, not machine code
> or C or anything else.
>
> C.K. Lester writes:
> > For the contests, what is "standard input?"
>
> It's file number 0.
> i.e. your program should read from file 0,
> using for example, getc(0) or gets(0),
> and write to file 1, using puts(1, ...) or printf(1, ...) etc.
> It should be possible to run your program
> from a command line, such as:
>
>         ex yourprog < english.txt > coded.txt
>
> > Or is standard input the keyboard?
>
> Without the "<" on the command-line
> it would be, but I'm not going to test it that way.
>
> > Also, will the cipher line necessarily be sequential? For instance,
> > might we encounter:
>
> >ABCDEFGHIJKLMNOPQRSTUVWXYZ
> > PRSTWUVZQMABCDEFGHXYIJKLNO <-- cipher line
> >
> > This is a simple one-to-one replacement, but the cipher line, you'll
> > note, is not sequential.
>
> I'm not sure what you are driving at,
> but the cipher line could be any random shuffling
> of the letters A to Z, with no duplicate letters.
> The example I give on the Web page is in sequential order in places,
> but that's just because I started with ABC..YZ, and was kind of
> lazy in shuffling things around.
>
> I'll add these points to the Web page.
>
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com
>
>
>
>

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

5. Re: contest questions

----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: contest questions


>
> Robert Craig wrote:
> >
> > > For the contests, what is "standard input?"
> >
> > It's file number 0.
> > i.e. your program should read from file 0,
> > using for example, getc(0) or gets(0),
>
> Don't I have to do a
>
>   fn = open(thefile,"r")
>
> and then use fn for input:
>
>   nextLine = gets(fn)
>
> Why would I hardcode the '0'?
>
>   nextLine = gets(0)
>
By agreed convention, Unix derived operating systems (ie MS-Dos (via CP/M),
Linux and Windows (via MS-Dos)) use the concept of file handles that are
returned when opening files. These are typically indexes into a system table
that holds all the file's runtime metadata. The first three values 0, 1, 2
have been reserved for stdin (by default the keyboard), stdout (by default
the screen), and stderr (by default the screen). These are not Euphoria
conventions, but derive from Unix conventions.

The shell command processor for these operating systems usually support
redirection of the std file handles using the '<' and '>' syntax. Thus a
command line:

    myprog >file.dat

usually indicates that the program is designed to write to the screen (using
stdout) but the user has decided to redirect the output to a file called
"file.dat". The use of redirection is very useful as it means that many
programs (utilities mainly) can just assume that input comes from stdin and
output goes to stdout and then let the user decide at runtime what actual
files to use via redirection. The programmer then doesn't have to concern
themselves with opening and closing files etc...


> > It should be possible to run your program
> > from a command line, such as:
> >
> >         ex yourprog < english.txt > coded.txt
>
> Can I allow the user to just do this:
>
>   ex yourprog words
>
> and then yourprog loads up words & ".txt" or something?
>
> > Without the "<" on the command-line
> > it would be, but I'm not going to test it that way.
>
> So, "<" becomes standard input?!
>
> Like when I do
>
>   nextLine = gets(0)
>
> it's going to read from the file after the "<"?
>
> OIC. So the first file is file 0 and the second is file 1...?

Yes. This is supposed to be supported in the commandline processing that the
programs/shell does before your program gets to run.
---------
Derek.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu