jsdares icon indicating copy to clipboard operation
jsdares copied to clipboard

line count confused even more than expected by simple golfing technique

Open SonOfLilit opened this issue 11 years ago • 1 comments

In “Zoo”, this solution gets 0 points for being 10 lines, the maximum allowed:

var context = canvas.getContext("2d");

function animal(x, y) { context.fillRect(x+150, y+50, 50, 50); context.fillRect(x+50, y+100, 100, 50); context.fillRect(x+50, y+150, 30, 50); context.fillRect(x+120, y+150, 30, 50); }

animal(0, 0); animal(250, 0); animal(0, 250); animal(250, 250);

However, this solutions gets 200 points - an additional 100 for being 0 (?) lines, 10 for each line below 100:

var context = canvas.getContext("2d");

function animal(x, y) { context.fillRect(x+150, y+50, 50, 50); context.fillRect(x+50, y+100, 100, 50); context.fillRect(x+50, y+150, 30, 50); context.fillRect(x+120, y+150, 30, 50); }

animal(0, 0); animal(250, 0); animal(0, 250); animal(250, 250);

SonOfLilit avatar Apr 27 '13 11:04 SonOfLilit

Ah yes, that's a problem, you can actually submit a dare and get points while there are errors in the program, that's not good..!

janpaul123 avatar Apr 27 '13 11:04 janpaul123