2nd Contest ... Purpose, get people using RC2

new topic     » topic index » view thread      » older message » newer message

4.0.0 RC has been released, it's time for another mini-contest! I want to be right up front, however, that 4.0 use is not required. You can enter the contest using 3.x.

This contest will be a bit more involved but still pretty easy. This time, however, scoring will be a little bit different. 100 possible points for all test cases working. 20% bonus if you are in the top 20% for token count and a 20% bonus if you are in the top 20% for execution speed. A 20 point bonus will be given to anyone using a new 4.0 construct. A 20 point bonus will be given to anyone using a new 4.0 standard library routine. Total possible points without bonus = 100. Total possible with bonuses awarded to everyone = 140. Total possible points with all bonuses 202.

Now, on with the contest definition.

A certain computer has ten registers. Each register and RAM location holds an integer value. Instructions are encoded as three-digit integers with the exception of the print instructions. The encoding is as follows:

100 halt
2dn set register d to n
3dn add n to register d
4dn multiply register d by n
5ds set register d to the value of register s
6ds add the value of register s to register d
7ds multiply register d by the value of register s
8da set register d to the value in RAM whose address is in register a
9sa set the value in RAM whose address is in register a to that of register s
0ds goto the location in register d unless register s contains 0
?d print the value of register d with a trailing newline
??d print the value of register d with a trailing space

All registers initially contain 000. All ram addresses initially contain 0 except for ram address 0 which should contain -1 making it easy to provide looping structures. Anything after the 3 digit instruction is a comment.

An example program:

$ cat > prog1.txt 
215 Set register 1 to 5 
225 Set register 2 to 5 
612 Added register 2 to register 1 
?1  Print the value of register 1 
?2  Print the value of register 2 
100 Halt 
$ eui cpu.ex prog1.txt 
10 
5 

Let's do this a bit differently. Please state here on this message if you are going to participate. That will make things more interesting. As with the last contest, the contest can be discussed here but code and algorithms should not be discussed in any detail.

Deadline is 1 week, i.e. 7PM EST December 15th 2010. Please do not send me submissions before Monday. I would like to work on my own solution w/o being influenced. Mine will not count, but would like to have fun too smile After Monday, please send submissions to jeremy A.T. cowgar dot com.

Updates

  • Ram is 1,000 bytes long, address 0 should be initialized to -1 for ease of looping structions and all other addresses should be initialized to 0. Ram should store a Euphoria integer
  • Ram, registers and goto are all 0 based index
  • There is no requirement to handle invalid instructions, registers or ram addresses, it's OK to let the program crash
  • ??d should print a trailing space

Sample test cases

Sample test cases are located on our contest SCM server at hg:contest/file/default/2010-12-15-cpu. See the .cpu and .out files. Example testing

% eui myapp.ex basics.cpu > basics.mine 
% diff basics.mine basics.out 

If your application crashes or has a different output then your CPU program is not functioning as expected.

Final Words

Submissions will be added to our hg:contest repository. To count your tokens, you may use the token_count program found there.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu