HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JASS Programming survival challenge (Results)

08-28-2006, 06:16 PM#1
Vexorian
Let's make a JASS contest.

Rules
* The winner will get 60 rep and a price icon for bellow his avatar.
* I post 1 programming problem.
* You send me the solution inside [jass] tags by a private message. (Do me a favor and first test it in game)
* Deadline ends then I post the winners. A solution to the problem and explanations on why some people didn't win.

* I post another problem
* The cycle is repeated.

* The catch is that people that solve at least 1 out of the 3 first problems are qualified to enter level 2 which will be a set of other 3 problems. And so and so until only one contestant remains. (Difficulty grows exponentially )

* In case no one solves at least 1 problem of the last level the price will be distributed between the winners of the level before last level. Unless no one beats the first level, in that case I am gonna change this forum's name into "Triggers"

* The idea of the level based elimination is supposed to prevent people losing just because they were busy one week.

* I will release 1 problem each week.

* You can use as much scripts made by someone else as you want, as long as those functions are general usage ones, and they do not solve the problem directly (none of my problems will have a solution of that kind though).

* In no way should you spoil the fun to the other people and post solutions or any clues as to how to solve a problem.

Problem #1
Results
Calculate 1+2+...+n , n is any positive number that is less than 2147483648

- Solution:

Send me a function that has this prototype:
Collapse JASS:
function Sum takes integer n returns nothing

The function should eventually display 1+2+...+n as a game message. If this function calls other functions that are not part of any known general purpose library send them as well.

Example:

call Sum(3)

Shows "6" in the screen.

Example 2:
call Sum(100000)

Shows "5000050000" in the screen. Integers have a limit in JASS so simply summing the numbers might result a negative number for you, so you'll have to deal with it.

Deadline: next monday.
08-28-2006, 06:27 PM#2
blu_da_noob
Lol, ninja edit. And just when I had finished my function too :(.

Anyway, what do we return for invalid input? :P
08-28-2006, 06:28 PM#3
Vexorian
There is no invalid input, the tests will only include numbers in that range. Oh forgot to say that n is not negative, will edit
08-28-2006, 06:32 PM#4
blu_da_noob
Are we supposed to account for the execution limit? :P

Ok, I guess that could've been considered a clue. But for future purposes, should it be accounted for (I am assuming these tasks will become atleast somewhat process intensive).
08-28-2006, 06:34 PM#5
Vexorian
The execution limit shouldn't be a problem here.
08-28-2006, 06:39 PM#6
Mezzer
Sounds like a fun thing to do. So what decides who wins? The way it's scripted or?
08-28-2006, 06:43 PM#7
blu_da_noob
Quote:
Originally Posted by Vexorian
And so and so until only one contestant remains. (Difficulty grows exponentially )

(I wonder if we'll eventually get a theoretically impossible problem to solve :P)

(By theoretically impossible I mean the only currently known method is bruteforce, or that has been proven to be the only possible method)
08-28-2006, 06:50 PM#8
moyack
Man... I think I'm in
08-28-2006, 06:50 PM#9
Vexorian
Quote:
Originally Posted by Mezzer
Sounds like a fun thing to do. So what decides who wins? The way it's scripted or?
If it solves the problem, it wins.
08-28-2006, 06:51 PM#10
Captain Griffen
Does optimisation matter?
08-28-2006, 07:04 PM#11
Chriz.
I'm not one who could possibly enter this, but aren't normal contests only 20 rep as an award?
08-28-2006, 07:10 PM#12
Vexorian
This one contest might last for 9 weeks or have 3 winners that will share the award, so it could even be too small.
08-28-2006, 07:15 PM#13
smith
So if n > 2147483648, the function shouldn't display any number?
08-28-2006, 07:17 PM#14
Vexorian
you can add that check but it won't matter cause I will never use input that is not in the range specified to test.
08-28-2006, 08:15 PM#15
Fireeye
I already got a solution but when i use n > 2147483648 my WE crashs, can i send it with another number to you vex?