Algorithm Match 4

The Algorithm invitational highlights the pure skill of an individual's ability to solve a problem.

Scoring

Scoring for the Match 4 of the Imagine Cup 2008 Algorithm Invitational is based purely on your solutions to the levels in Herbert.

You can run Herbert as many times as you wish during the match period. Each time you exit Herbert, your current set of solutions will be stored. When you next run Herbert, these will be restored so you can pick up where you left off.

Your score for each level of Herbert is based on the number of buttons you press on that level, the size of your program, and the difficulty of the level. The more buttons you press, the smaller your program, and the more difficult the level, the higher your score will be. You get an extra bonus when you "solve" a level (write a program which presses all buttons using at most the maximum number of bytes specified for the level). If you can press all the buttons in under the maximum number of bytes, you get even more points. There is no known limit to the score you can achieve in Herbert - if you find better solutions than we ourselves did, your score will reflect that.

Please note that your score is determined by the number of buttons you press (and also the size of your program and the level difficulty), not based on the "h" program you write - in this respect, the program you write is a means to an end. Be sure to run (and debug) your programs after you write them, in order to get points.

A note concerning gray buttons: Gray buttons reset any pressed white buttons to their unpressed state. Your score for a level depends on the maximum number of buttons you have pressed at any given time. Thus if you write a program which presses five white buttons, then a gray one, and then three more white ones, you will get credit for pressing five buttons. Pressing a gray button never deducts from your score - in particular, if you write a program that solves a level and then hits a gray button after doing that, the level is still solved and you will still have the points you accrued in solving it.

For the analytical among you (and we know you are out there), here is the formula Herbert uses to calculate scores for a level.

Let

Points be the points assigned for solving the level (based on difficulty)
TotalButtons be the number of white buttons on the level
Buttons be the number of white buttons you have pressed
MaxBytes be the maximum number of bytes for the level
Bytes be the number of bytes actually used

Then

  • If Buttons = TotalButtons and Bytes <= MaxBytes, you have solved the level. Your score will be (Points*MaxBytes)/Bytes.
  • If Buttons < TotalButtons or Bytes > MaxBytes, you have not solved the level. Your score will be Buttons*PointsPerButton, where PointsPerButton is determined as follows:
    • If Bytes <= MaxBytes, PointsPerButton = (Points/(2*TotalButtons)). This is an integer divide and the result may be zero.
    • If MaxBytes < Bytes <= 2*MaxBytes, PointsPerButton = (Points*(2*MaxBytes - Bytes)/(2*MaxBytes*TotalButtons)). This is an integer divide and the result may be zero.
    • If 2*MaxBytes < Bytes, PointsPerButton = 0

Example:

A particular level has been assigned 1000 Points and a maximum byte count of 20. There are 50 buttons on the level.

  • If you write a program which presses all 50 buttons in 20 bytes, your level score will be 1000.
  • If you write a program which presses 25 buttons in 20 bytes, your level score will be 250.
  • If you write a program which presses all 50 buttons in 30 bytes, your level score will also be 250.
  • If you write a program which presses all 50 buttons in 10 bytes, your level score will be 2000.

Herbert only considers your best solution to date. So don't worry about losing points by trying other solutions - your score can only increase.
 

Competition rules  
Contestants must adhere to the following rules of competition. We reserve the right to disqualify anyone who, in our opinion, has violated these rules.

  • All work must be exclusively that of the individual contestant.
  • Scores must be achieved using valid "h" programs according to the scoring formula above. It is prohibited to attempt, by any means, to manipulate a score other than through the normal execution of valid "h" programs within the Herbert development environment.