| 09-28-2003, 02:26 PM | #1 |
Welcome to part 2 of this exciting contest which is much harder the first part, but not startlingly so. Prompt: Impressed by your work, the company was ready to ship the calculator. Until somebody noticed they disabled the hardware division function when they disabled the malfunctionary multiplication function which ironically enough worked fine and was used by many functions to grab certain parts of an answer. Quiet disapointed they frantically need your aid to rewrite the division function and its subsidary functions. (Modulate and Div). So they can hope to ship this calculator on time as it is going into production on friday. Goal: You have to write 3 functions this time around. Same restrictions as the multipy function. (only +,- If then else and loop) -Devide: The devide function uses the operator "/". It will return the fractional lowest term or if possible the integral answer. (9/3 will return 3, 9/2 will return 9/2 and 6/4 will return 3/2) -Mod: The modulate function uses the operator "%". It will return the remainder. (9%3 will return 0, 9%2 will return 1 and 6%4 will return 2) -Div: The div function uses the operator "\". It will return the integer only part of the answer. (9\3 will return 3, 9\2 will return 4 and 6\4 will return 1). Deadline: This friday TestData: I've listed the 3 sets you should try. 9@3,9@2 and 6@4. Make sure to pick up the new calc prototype which is nearer to completion. How to enter: PM me all 3 functions. I'm a purist programmer or a java teacher and I feel repeating the same operations is bad programming practice and inoptimal: Why in gods name are you coding in jass. But for those of you feel that way Next week is optimizing anyway. (Were going to take the 6 functions and maybe another and combine them all into one uber trigger!) |
| 09-28-2003, 07:13 PM | #2 |
But we are also allowed to use the I2S function, for the return statement of divide (9/2 or whatever), right? |
| 09-28-2003, 07:26 PM | #3 |
Yes you are allowed to use I2S and S2I, these aren't really functions in a mathamatical sense or logic sense merely there because the language forces you to use them. |
| 09-29-2003, 01:28 PM | #4 |
Can we call the created mod and div functions from the Devide function? |
| 09-29-2003, 02:53 PM | #5 |
I assume we can use + for string concatenation? I.e. attaching strings to strings. |
| 09-29-2003, 07:00 PM | #6 |
Yes Pepar you can although I think jass does have something like Concat(string1,string2) (Java does anyway). The + is only disqualified in a mathamatical sense. Lord Vexorian: Jass won't allow you to call a function in one trigger from another. This is what I was talking about that will make it a little harder. And thats why the optimization bitch will moan about having to write functions which do simmilar things. |
| 09-29-2003, 11:52 PM | #7 |
Next time I will ask after checking the map. |
| 10-01-2003, 07:42 PM | #8 |
Things that I didn't metntion that I'm noticing. Not everyone is handling for zero for all three functions, I'm sorry I took the assumption that everyone know that when you devide, div or mod by zero it must return an error (Devide is the only one with string output so although its wrong right now you can have Div and Mod return zero). Right now several of your functions will crash absurdly if I type in 9\0... |
| 10-13-2003, 12:01 AM | #9 |
I'm sorry but these last few weeks have been very busy for me. Part 3 is delayed as well as the results of this section. |
