|
|
|||||||
KiXtart Golf V: 24 Game The general KiXtart Golf rules are at the end of the post. Following are the goal and rules for the current KiXtart Golf challange. Goal Use four integer numbers from an integer range of 0-9 and the following basic math operations +, -, *, /, (, and ) in such a way that the resulting formula equals 24. Rules
[*]Each integer may only be used once [*]Only the basic math operators +, -, *, / and parentheses ( and ) are allowed [*]The formula must conform to standard math rules, thus for example 3 / 2 = 1.5 or 1 / 3 = 0.3 period (0.333333....). [*]The formula must conform to the math rules of precedence (for example * before +) [*]Some combinations can result in multiple solutions, only one is to be returned [*]Some combinations may not result in a valid solution, then an empty string is to be returned Examples: ( 1 + 2 + 3 ) * 4 = 24 1 * 2 * 3 * 4 = 24 The prototye for the function is as follows: code:Example$outputstring=Game24($digit1,$digit2,$digit3,$digit4) Given the input: code:one possible output string for $out might be$out = Game24(1,2,3,4) code:or$out = '(1+2+3)*4' code:Test Code$out = '1*2*3*4' code:================================================================BREAK ON KiXtart GOLF - How To Play ================================================================ Most importantly, anybody can play, no age restrictions, no penalties, no handicap! The object in "real" golf is to hit the ball in the hole in the fewest strokes. The object in KiXtart Golf is to get from input (tee) to target (hole) in the fewest keystrokes. Example: How many positive elements are in array $a? Array $a could be of structure $a=[1, 2 ,-3, 4, -5, -7, 8, 9] One approach: code:for a score of 45.for $b=0 to ubound($a) Another solution is: code]DO $b=$b+1 if $a[$b]>0 $c=$c+1 endif UNTIL $b>(UBOUND($a)+1)[/code] for a score of 53. Better approach: Code sample 1 ================================================================ KiXtart GOLF - The Rules ================================================================ 1) The goal of KiXtart Golf is to score the lowest strokes. 2) Strokes are all characters in a piece of code except whitespace characters, unless the whitespace character is necessary for the line of code to work. Therefore, carriage returns and line feeds do not count or spaces in between the '=' sign when assigning variables, e.g. '$a = $b' scores 5. 3) Code can be constructed any way you like, as long as it is syntactically correct with KiXtart. 4) The final solution MUST pass all test scripts that accompagny the KiXtart golf challenge. 5) The use of '$' as a variable is allowed. 6) In case of questions about a particular way to count the KiXtart Golf Challenge organizer has the last call. 7) During the private coding phase, no code is allowed to be posted. Violations result in disqualification of said player. 8) During the public coding phase, code should be posted, reused, and borrowed from other players. 9) The following script can be used to count the KiXtart Golf score: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=2;t=003608 ================================================================ KiXtart GOLF - The Duration of the Competition ================================================================ 1) Private coding phase: From date/time of posting the tournament challenge to the following Saturday, 3pm EST (BBS+6 time) 2) Public coding phase: From Saturday, 3pm EST (BBS+6 time) to the following Wednesday, 3pm EST (BBS+6 time) 3) Final results: The following Monday, 11am EST (BBS+6 time) [ 16. September 2002, 23:07: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Whoops there it is.... Gonna start th(dr)inking |
||||||||
|
|
|||||||
Just a little history to this: I was at a good friends party celebrating his Ph.D. defence (after nearly six years of working on it) when a mutual friend of ours started talking about the '24 Game'. He's a math teacher and using it in his classroom. Naturally, with the help of a couple of 'Mike's Hard Lemonade', some of us started solving the numbers he threw at us. We stumbled for about 20 minutes through possible solutions for '3 3 7 7' before he told us. I guess, the increasing amount of empty bottles made him believe we'd never find a solution to that one, even though there are multiple. |
||||||||
|
|
|||||||
that really seems tricky. not an easy job for me this... no no... getting coffee ready... |
||||||||
|
|
|||||||
ok, got it in head... trying to write it in sketchboard gives me headache... shoul eat up a lot of memory... |
||||||||
|
|
|||||||
jens, the 3377 got me badly. last night scrolled it around about an hour... anyway, as trying to solve it, let me ask some: 1) we can't use the same number more than once 2) we are to use integers, not floating point counting? |
||||||||
|
|
|||||||
Given the origins of the game, do you think it is fair for an answer to be able to use Kixtarts 'Integer maths' truncation? i.e. are the following results valid or not ? a) '(9/2)*6-3' b) '(9*5+4)/2' I think we should state that the result should adhere to 'real world' (ie floating point) maths. |
||||||||
|
|
|||||||
Oh boy...a really tough one this is... I'm able to find solutions manually. Now finding a way to make KiX think like me... |
||||||||
|
|
|||||||
I skipped that option already cause wouldn't that make random number mixes? meaning also that solution might never come up... |
||||||||
|
|
|||||||
Hmmm, then maybe the other way around... --> Getting myself to think like KiX |
||||||||
|
|
|||||||
My 12 year old son plays this game in Math class. Hopefully I'll get some time today to attack this. |
||||||||
|
|
|||||||
hoby, you are pretty old if your son is almost the same age as I! |
||||||||
|
|
|||||||
You better not get caught under-age drinking...or is that only a U.S. thing? [ 15. September 2002, 15:50: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
hoby, who will know if you drink at home? and also, if you have papers which say you are 32? |
||||||||
|
|
|||||||
Guys: Just to clear up a potential point of confusion: a) '(9/2)*6-3' ==> (9/2)*6-3 = (4.5)*6-3 = 24 is a correct answer for the combination (2,3,6,9) b) '(9*5+4)/2' ==> (9*5+4)/2 = (45+4)/2 = (49)/2 = 24.5 is an invalid answer for the combination (2,4,5,9) You must use 'real world' math, not the incorrect integer math module build into KiXtart. I have updated the rules to reflect this issue. I have also removed the EXECUTE statement that checks for correct answers since it will fail if the '/' is used and the operation results in fractions. This was an oversight in my coding since I forgot about the messed-up integer math in KiXtart. |
||||||||
|
|
|||||||
Another thing. The combination (3,3,7,7) is definitely one of the harder ones to solve and the consumption of alcoholic beverages might not be able to assist successfully in finding that solution. |
||||||||
|
|
|||||||
just wanted to count the possibilities... I may have counted wrong, but got result of 5040 different compinations...   |
||||||||
|
|
|||||||
That's possible I do know that some number combinations can be solved in 80+ ways. However, I just require one single valid combination. For example (1,2,3,4) has a total of 98 solutions but (3+1)*(4+2) could be considered a mutation of (4+2)*(3+1). Or reformatted: code:I've been playing around with it yesterday during my class and I believe it all boils down to four generic formulas. However, you're welcome to code all 5040 unique permutations(1+3)*(2+4)=24 |
||||||||
|
|
|||||||
I'm trying to, but do you understand how many loops I need there... I already have on the paper, 17 internal loops... you know: for each $ in $var for each $var in $ .... next next and it's getting pretty awfull! {edit} for the ones who do not know their path yet, I can say, this is not correct one! I'm making too complex and now I trash everything and start from the cratch... [ 15. September 2002, 19:07: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I think that I get 18,432 permutations. There are 4 possible places for operators ie. Operator*number*operator*number*operator*number*operator*number The first operator can only take on the value + or - but the other 4 can take on all 4 values. So we have 128 operator permutations. The parenthesis generate another 6 permutations. Although this number could go higher if one considers (1+2+3+4) to be different from 1+2+3+4 or if (1)+(2)+(3)+(4) is considered to be different from 1+2+3+4. Finally, then one can rotate the 4 numbers in the 4 positions which gives another 24 permutations. Thus 128*6*24=18,432 I don't obviously see a way to get a solution that doesn't use brut force. I also not sure limiting the number of solutions that are desired influences the size of the code. The code must potentially search all permutations to ensure that no solutions exist. In fact, requiring only 1 soultion might increase the size of the code. Just some thoughts. PS. Maybe the general forum might be a better place for this competition. [ 15. September 2002, 19:22: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
I think that the first operator is actually not necessary since it will not produce distinct solutions that cannot be achieved by other permutations. |
||||||||
|
|
|||||||
mmm... I left out the first potential operator (which actually, as I thought of it, could be -) then, situation with ()()()() is there for nothing, so didn't count that either... the one part I don't get on the operator thing... I got under 100 of them... and paranthesis counted for 5 effective... |
||||||||
|
|
|||||||
Jens, True, but in general, repeat solutions can not be so easily eliminated. So, if someone can put forward a logical position for dropping a permutation or class of permutation in the analysis, this is permitted in the contest? Validation of the resultants could be difficult. Jooel, Parenthesis permutations: (n n n ) n n (n n n) (n n) n n n (n n) n n n (n n) (n n) (n n) I got 128 operator permutations by: 2*4*4*4 but Jens' point reduces this to 4*4*4=64 thus my revised number is: 9,216. Of course there will be many solutions that are effectively repeat solutions in these permutations. Maybe we could might try to identify methods that eliminate repeats? Note, Jens, Commonsense says you are correct but can you put forward a proof of this point covering all permutations. The presence of divisions which are not transative and parenthesis makes this a more difficult proof than I orginally thought. [ 15. September 2002, 20:20: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
I don't thnik you need to be concerned about repeat solutions, since I just want to have one valid solution returned. And whether that is (1+2+3)*4 or 1*2*3*4 or ((3+2)+1)*4 doesn't really matter. |
||||||||
|
|
|||||||
ah, forgot one in the paranthesis part... what comes to increase the size when only one output, I think it actually decreases the size by 2-10 strokes |
||||||||
|
|
|||||||
Jens, But maybe there are cases where only solution or worse none exist. To validate these cases the algorithm must contain loops that eliminate all possibilities. Unless one has a proof that eliminates a permutation as always being a repeat you must code for all permutations. Stopping after finding your first solution requires an IF statement. Maybe someone could make a smaller algorithm that finds all solutions but doesn't contain the if statement. |
||||||||
|
|
|||||||
jack, why you should stop there? just scan trough them all... easy, I already have the finding part in simple loop. I actually made a bad quess and I have to check it out. it may run for days, but will work. if I remember correctly, there is no time limit as long as it works, right? |
||||||||
|
|
|||||||
Nope, there's no time limit. However, I've found a website containing a Game24 solver written entirely in JavaScript. It spits out the solution nearly instantaneously, thus I would not expect KiXtart to run for days I'm leaving now, gonna play some Squash! |
||||||||
|
|
|||||||
jens, it's just about different goals... if you think there is nice source... 1000 strokes and such. what if I can make it 200? with just 500000 times longer run time... |
||||||||
|
|
|||||||
Jens. I presume this is the site. 24Game It is actually tougher because it allows the 4 numbers to take on the values 1 though 13 & not 0 through 9. Also, for those interested he provides his source code. The solution is mainly in "solution.java" & "solution.class". Interesting! This kind of strategy will find fast answers most of the time at the sacrifice of complex code. Several of you have mentioned that your children are using the game at school. This site contains both an internet & standalone version. PS. After looking over the above java code, I realized I forgot 1 type Parenthesis - i.e none what so ever so there are 15,232 permutations. [ 16. September 2002, 01:34: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
Game24 KiXtart Golf running under KiXtart v4.11 Numbers = 1, 2, 3, 4 Please doublecheck your solution to guarantee a correct result 24 = 24 Numbers = 2, 2, 6, 8 Please doublecheck your solution to guarantee a correct result 24 = 24 Numbers = 4, 4, 6, 6 Correct answer answer, there is no solution to this combination Numbers = 3, 3, 8, 8 Correct answer answer, there is no solution to this combination Numbers = 0, 3, 2, 0 No solution found <> 24 Numbers = 3, 4, 7, 7 Please doublecheck your solution to guarantee a correct result 24 = 24 Numbers = 1, 2, 8, 9 Please doublecheck your solution to guarantee a correct result 24 = 24 Time: 1683 ticks KixGolf score = 634 [ 16. September 2002, 00:37: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Nice job, Howard! You would get the First Scorer Award but for the fact that you did not return the formula. The rules state that $out should contain the formula or an empty string. I guess, while we all were chatting away, you've been in stealth mode and coded [ 16. September 2002, 02:08: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Sorry, returned the wrong variable. Game24 KiXtart Golf running under KiXtart v4.11 Numbers = 1, 2, 3, 4 Please doublecheck your solution to guarantee a correct result (1.0*2.0)*(3.0*4.0) = 24 Numbers = 2, 2, 6, 8 Please doublecheck your solution to guarantee a correct result 2.0*(2.0+6.0)+8.0 = 24 Numbers = 4, 4, 6, 6 Correct answer answer, there is no solution to this combination Numbers = 3, 3, 8, 8 Correct answer answer, there is no solution to this combination Numbers = 0, 3, 3, 8 Please doublecheck your solution to guarantee a correct result (0.0/3.0)+(3.0*8.0) = 24 Numbers = 3, 4, 7, 7 Please doublecheck your solution to guarantee a correct result 3.0+(4.0*7.0)-7.0 = 24 Numbers = 1, 2, 8, 9 Please doublecheck your solution to guarantee a correct result (9.0-1.0)+(2.0*8.0) = 24 Time: 1152 ticks KixGolf score = 632 {edit} KixGolf score = 518 {edit} KixGolf score = 488 {edit} KixGolf score = 470 {edit} KixGolf score = 469 [ 16. September 2002, 05:54: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Nice Howard will receive the First Scorer Award. |
||||||||
|
|
|||||||
he migth even win the first period... and we are still lacking the company of brian... neither is fernando here. |
||||||||
|
|
|||||||
I certainly don't want to be the ONLY participant. [ 16. September 2002, 12:44: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
I've been busy! Just found out today. Have some cinema to catch up later, but I'll try and give this a spin afterwards... Later, Madruga P.S.: I have a couple questions: 1) Any particular reason why we're using the "old" kixgolf3 ? 2) Shouldn't the test code include the proper :! before and after the function declaration? [ 16. September 2002, 16:24: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
Fernando: If you have improvements to the KiXtart scoring script, then the posting of code might be better served in the scoring script thread since I will always reference that thread for the official scoring script. [ 16. September 2002, 16:49: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Updated test.kix for Game24. Too many changes to list, but I think this one has a clear output, and it's a lot easier to add new test conditions... Please *DO* test it and post any required fixes: haven't tested it enough... code:P.S. As sugested, I'll post the updated KixGolf script in the proper place.BREAK ON [ 16. September 2002, 17:51: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 446, running under KiXtart v4.11 RC 1 |
||||||||
|
|
|||||||
aha! The game is afoot. Now to trim some more... Richard, do you have the proper out? [ 16. September 2002, 18:08: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 413, running under KiXtart v4.10 KixGolf v3.0.3 score = 401, running under KiXtart v4.10 KixGolf v3.0.3 score = 377, running under KiXtart v4.10 KixGolf v3.0.3 score = 367, running under KiXtart v4.10 [ 16. September 2002, 21:36: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
I think the validation script has a bug. I got a solution for 3,3,8,8 Game24= 8 / ( 3 - 8 / 3 ) My score is 990 - I think I have a long way to go. [ 16. September 2002, 23:01: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
Jack: You're right. I'll correct the test script. |
||||||||
|
|
|||||||
Jens, That invalidates my "first to post". I still have not found that combination. [ 16. September 2002, 23:08: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
I think, Jack is the first one to find this particular solution. I've checked it using one of those online Game 24 things and that one didn't find a solution either. Never trust a computer This will also mean that Richard Howarth is currently recipiend of the First Scorer Award provided that his script passes the updated and corrected test script. [ 16. September 2002, 23:13: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
I also get another inconsistency with Madruga's test script. His script gives: In => 3, 3, 7, 7; Out => ( 3 + 3 / 7 ) * 7 = 21 => WRONG!! Which is clearly incorrect. You know, I have been playing with the math in Kixtart for almost 2 days non stop & I don't believe "execute", "val", "decimalnumber", "join", or "cdbl" generate consistent answers when you feed them various mixes of floating point numbers & integers. All seem to have some type of internal house cleaning rountines that convert all floating points that are integer values to integer values. Sometimes the results are downright bizarre & unpredicatable. It is frustrating as hell & I had to fudge the math to make the routine work consistently. Also, isn't adding zeros to output numbers inconsistent with the game's overall approach of dealing only with integers? My solution doesn't add zeros. [ 16. September 2002, 23:25: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
Although it appears that $s = execute("$$v = 8.0/(3.0-8.0/3.0)") equals 24 try this: code:My code found this combination but did not see it as the correct answer.$s = execute("$$v = 8.0/(3.0-8.0/3.0)") [ 16. September 2002, 23:57: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Hmm, it seems KiX has problems comparing Doubles with Longs.... Give this a try: code:Break on |
||||||||
|
|
|||||||
Howard, Patrick, This is exactly the type of problem that I have been having & there seemed to be no reason for the failures. The calculations are very unstable. I try to get around this by using 2 fudge factors - 1 that I use to enforce floating point but which perturbs the accuracy. I compensate by a second fudge factor that catches values in a very narrow interval. After hours of testing it was the only consistent method that I could find. I can increase the accuracy indefinitely but at the cost of 2 characters per decimal place. I think all of the above mentioned functions are wonky & totally unreliable with floating point. They are not even predictable. Patrick, You might be right Patrick but I get the sense the problem is deeper & more serious than that. For instances, there are about 5 functions for effectively executing a constructed string. If you feed them exactly the same string they give different results on occasions. Howard, Add 0.000001 to all your numbers & then check for a narrow range say + or - 0.0001 about 24. I bet it will work. Absolutely everything must be floating point though. Even the 24 must be written as 24.0. This is kind of like practicing voodoo in my opinion but it does give consistent results. Jens, I think your challange may have pushed kixtart beyond its capabilities. [ 17. September 2002, 00:21: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
Not sure why this works: code:and this does not:$s = Execute("$$v = 8.0/(3.0-8.0/3.0)") code:I guess changing to an INT just plain easier to do..$s = Execute("$$v = 8.0/(3.0-8.0/3.0)") [ 17. September 2002, 00:36: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Howard, My experience is that with out the fudge factors you get trade offs. You can increase the prediction of correct responses but only at the cost of lossing reliability at predicting non-solutions. Many times in the last 48 hours, I thought I had found the answer only to discover the new solution didn't work with other solutions. To be truthful, I am not sure my algorithm is 100% accurate but it worked on the several dozen examples that I had on hand. I though of exporting all the permutations to excel so I could test the forumala in an environment that is reliable but I haven't had time to test that idea yet. |
||||||||
|
|
|||||||
yep, ran this little test script to find the leak: code:and it did not suprise me at all.$s = Execute("$$v = 8.0/(3.0-8.0/3.0)") {edit} I quess I might add the output of it too: 24 is bigger by:0,0106581410364015 / 1000 000 000 000 [ 17. September 2002, 00:46: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Lonkero, I think we are running into 2 problems. Fist as you say there is a leak but also Ruud's string parsing functions for math strings probably has other holes. His routines seem to convert floating point into integer in very caprious ways. Both Join & Execute strip all unnecessary zeros from your code so it is very hard to force either function to do floating point math. My experiments seem to indicate that execute & join are actually more bullet proof than formatdecimal or cdbl. These results that come out of these functions are really weird. These holes in these parsing routines even effect more mundane functions like the if statement. The combination of these various problems seems to create a version of the Heisenburg uncertainy principle in kix. Very accurate matches can only be identified in a probabilistic sense. |
||||||||
|
|
|||||||
Damn, I think I know what it is. Has anybody every heard of EPS? EPS = Floating point relative accuracy. EPS is a permanent variable whose value is initially the distance from 1.0 to the next largest floating point number. Basically, in order to display any give number in a discreet numbering system, it has to be converted into that numering system. And based on the number of bits used in that system you end up with a specific number which is the smallest number that can be displayed. For example, assuming an integer numbering system, EPS equals 1 since the next higher number from 1 is 2. Any number in beweeen 1 and 2 that is to be converted to the integer system will thus end up being either 1 or 2. Which one it is, is being governed by conventions, e.g. IEEE definitions. Another example, in Matlab, a mathematical scripting language, EPS=2.2204e-016 for floating point math. This means any number smaller than EPS cannot be displayed, it will either be rounded down to 0 or up to EPS. It also means that certain numbers cannot be displayed without some (small) loss. Thus, if I calculate 0.0001*3 - 0.0003 in discreet floating point math I will get a result of 5.4210e-020 and not '0'. I hope everybody is still with me on this? Anyway, I don't think there's anything we can do about this since it's a limitation of the underlying number conversion system. |
||||||||
|
|
|||||||
Now that this behavior has been defined, should we defined that the calculated value of the input be close to 24 within some specified range? |
||||||||
|
|
|||||||
If you put a CINT around the resulting value, then that should go back to an integer 24. Also, I just ran this little script and it works fine. code:with outputBreak on code:Result = 24 |
||||||||
|
|
|||||||
This fails: code:This works (in this case):$a='cdbl(8)/(cdbl(3)-cdbl(8)/cdbl(3))' code:? 'Result = '+(cint($b)=24) [ 17. September 2002, 02:04: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
This is obviously wrong but with CINT is passes: code:$a='(cdbl(3)/cdbl(8))+cdbl(8)*cdbl(3)' [ 17. September 2002, 02:08: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Jack, I don't quite get it when you say: quote:Why is that incorrect? If I use integer math, then 3 / 7 = 0, + 3 = 3, * 7 = 21... Have I forgotten something from school? Surelly that is not the intended result! You may be induced in error by the "WRONG!" part: it does not mean that the expression is wrong, it only means that that expression does not evaluate to the expected result of 24... P.S.: I'm still trying to figure out a decent algorithm... When I do, I'll sure as hell post the results here... [ 17. September 2002, 02:08: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
True but one of jens primary goals was to use real number math not just integer number math. It was in this context, I felt was it was incorrect. |
||||||||
|
|
|||||||
Interestingly, I stripped 100 characters out of my code mainly through eliminations of cdbl's & at about character 98, my script started to fail again. Got put them all back in I guess. |
||||||||
|
|
|||||||
Oops... I missed that "real math" thing... Anyway, here's the revised script. code:Being such a big problem, I'd sugest to this group to come up with a 100% working solution for finding the answer and adding a function named checkresult or something else to the test program that would take the {edit}expression{/edit} and return true if the result is the expected one. One should be allowed to use that function in one's code, so as to save a lot of cdlbs/ints/adding error margins/whatevers to the code. I think we all could benefit from that... Not only in the interest of making one's code shorter, but mainly in making it a lot more readable and focusing on the problem at hand, instead of in ways to best deal with what seems to be some incongruencies in the language itself...BREAK ON Just my two cents... {edit} removed poll {/edit} [ 17. September 2002, 20:39: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
If there are 11 combinations of brackets my script is wrong since I only had 7. It is easy to fix but it would add another 100 characters to my script. Initially, I thought the extras were just simple rotations of the orginal 7 but I could be wrong. The java script on the web only deals with 7 basic permutations as well. I am too tired right now to worry it out though. As to your question, all contributions are welcome but this is just a fun thing & I don't think we need to over do it. |
||||||||
|
|
|||||||
The criteria that matters is does it pass the tests that Jens lays out. This is not suppose to be a perfect algorithm or data engine. [ 17. September 2002, 03:22: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Madruga and others, can you give me an example why "((ab)c)d" is also a combination? I think it's the same as "(ab)cd" Also the number of operator permutations I think is 128. Why? check this: -1*-4*-2*-3 So the possible permutations are 2*4*4*4=128 |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 449, running under KiXtart v4.11 RC 1 Time taken (ticks): 10003, Pentium Pro 180. Passes all tests, including finding a solution for "3,3,8,8" {edit} I only fixed the "3,3,8,8" when I saw the messages about an hour ago, so I guess Jack is first to post with a correct solution {/edit} [ 17. September 2002, 11:09: Message edited by: Richard Howarth ] |
||||||||
|
|
|||||||
pat, if you read our older posts, you would see discussion on this issue. isn't: -1*-4*-2*-3 just the same as: 1*4*-2*-3 |
||||||||
|
|
|||||||
Jooel, the result is the same, but the formula isn't: I like it when it't 20 degrees Celsius outside, but when it's -20 degrees I'd rather stay inside!!! |
||||||||
|
|
|||||||
quote:I guess you're right... I was just laying down all the choices, so I could later "trim"/simplify them. It looks as if the outer parentheses will only make sense if the operator before 'c' is a low precedence one (+ or -); if that is the case, then the inner parentheses will not be needed and so becomes '(abc)d'... On the other hand, if it's a high precedence one (* or /) then the outer parentheses will not be needed and it becomes '(ab)cd'... Maybe those 7 cases someone else pointed out as being used by the java applet will be enough... Haven't checked into it yet though... |
||||||||
|
|
|||||||
Maybe I'm missing something... (1+2)+3/3 = 4 ((1+2)+3)/3 = 2 |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 413, running under KiXtart v4.10 |
||||||||
|
|
|||||||
I think I've found a solution with the rounding problems when using CDBL. I can reformat a formula in such a way that it does not require doubles but only integers. This method could be used for those permutations where fractions might show up as interim results. code:By essentially moving the division I end up with an integer devidied by an integer.3 [ 17. September 2002, 14:16: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Jens, I woke up this morning thinking the same as Richard. Madruga's 4 extra combination are legitimate & different. What I also realized is Madruga is fundamentally changing the rules of the game since he is permitting nested parenthesis. Note in all examples of the school game on the web, there is either a template or rules that don't permit nested parenthesis or multiple operaters between numbers. While your rules might permit nested parenthesis most of us picked up on the fact you wanted us to solve the standard school template. You might clarify this point. |
||||||||
|
|
|||||||
Jens, We can have up to 3 divisions though & they can be placed within & without parenthesis & in various combinations with other operators. While I think you are correct in saying that we could recast all so that decimal math was unneeded, programming all the continuances could be a major undertaking. Just identifying all the division patterns plus their alternatives might be a several day project. Also to avoid decimal math your solution needs to go one step further. If your final result is a fraction, you need to check if the denominator is a factor in the numerator. If it is, then integer division can be used to verify compliance with 24 & otherwise it can not be a solution since the result is non integer. [ 17. September 2002, 14:36: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
quote:You are indeed... The 2nd example does NOT need the inner brackets: (1+2+3)/3 = 2... |
||||||||
|
|
|||||||
Aha. Got it. KixGolf v3.0.3 score = 423, running under KiXtart v4.11 RC 1 {edit} KixGolf v3.0.3 score = 414, running under KiXtart v4.11 RC 1 [ 17. September 2002, 14:53: Message edited by: Richard Howarth ] |
||||||||
|
|
|||||||
As for the rounding error question, I don't think we'll have too much trouble with it. Just check the result to be within an error margin as I did in my version of the test program. It should work for all situations: with just 3 operations, you will surelly not have an error THAT big... Besides, with only 4 1-digit numbers and 3 operations, you would not arrive to a "near-perfect" score unless it's a correct answer... As for the nested parentheses, in fact I had not noticed that I'd raise such an issue! As I said in another post, I was simply laying down the options to have a clearer view of the problem and potential solutions... Being as it is, that this is a "game" about program size and not efficiency, I may as well end up using all parentheses if that simplifies my code in any way... |
||||||||
|
|
|||||||
Did some checking: my verification for the example nested parentheses seems to hold true for all the other nested parentheses! So, it looks as if they are not needed as any expression using them can be rewriten using only one set instead of two... In that case, we get left with only 7 diferent cases... Does that 7 ring a bell on anyone? |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 409, running under KiXtart v4.11 RC 1 Runs much slower now though. |
||||||||
|
|
|||||||
Well it looks like it's back to the drawing board. |
||||||||
|
|
|||||||
I think we can rule out one of the 7 situations: a(bcd). {EDIT} BOY! Was I wrong on this one!!! Read below... {/EDIT} Why? Follow me... We can have one of 4 operators between 'a' and the rest of the expression. code:The same may hold true for more cases, but I have to go now. I'll checka+(bcd) -> (bcd)+a : does not matter what ops are inside as the others later... [ 18. September 2002, 02:06: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
Well Richard, I think I must conceed, you gone to far. I think I could bring my score down but 400 is out of reach with the approach I chose. I am looking forward to seeing your solution. |
||||||||
|
|
|||||||
Madruga What about 8/(1*1/4)? Of course you could restructure this & get a large number of alternatives but in general duplicates always exist & eliminating them is more challanging than solving the problem. [ 17. September 2002, 16:04: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
quote:=> 8*4+1-1 is another valid solution to be found without using parens... |
||||||||
|
|
|||||||
Jack, Keep going. It's surprising what you can strip out after staring at the code for 10 minutes. And you never know, I may have violated some rule which will invalidate the code. But just to keep you on your toes... KixGolf v3.0.3 score = 404, running under KiXtart v4.11 RC 1 |
||||||||
|
|
|||||||
Comment to the use of parenthesis, so far I've only seen the use of exactly three operators and either zero, one, or two sets of parentheses. Examples: 0 = a+b+c+d 1 = (a+b/c)*d 2 = (a+b)*(c+d) Also, I do not think that there is a need for nested parentheses since I have not been able to find a formula that require a nested parenthesis and which cannot be rewritten without the need of a nest parenthesis. For example ((a/b)*c)+d = (a/b*c)+d. |
||||||||
|
|
|||||||
TomTieDom, found something else what surprised me: code:comes up with$a='cdbl(8)/(cdbl(3)-cdbl(8)/cdbl(3))' code:Result $b = 24 Does anyone have an explaination for this behaviour??? |
||||||||
|
|
|||||||
God richard, I don't know how you got to 400. After 2 more hours work I am at 721. |
||||||||
|
|
|||||||
Kixtart sets variable type from left to right I believe. Thus in the first test you are doing an integer test & in the second a floating point check. As lonkero has shown floating point has a leak. Thus the comparison fails. Thank you Patrick, Your example did it for me. The execute statement must literally see the cbdl function surrounding all 4 numbers for it to work consistently. I got rid of my fudge factor & I am down to a score of 702. [ 17. September 2002, 22:50: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
I've been doing some perl experiments... Did you know that there are 465 unique 4 number combos that will evaluate to 24 according to the rules? (0038,0308,0380,... and all it's permutations all count as one). Also, of all these possible 465 solutions: code:By now, it's clear to you guys: I was trying to simplify the algorithm by not including something!!!13 (unlucky number!) depend on having two sets of (), that is (ab)(cd) Just thought to share my findings with you guys. Haven't coded a single KiXtart line yet... [ 18. September 2002, 01:09: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
fernando, as I got my papers... 3 of them filled up of plans how to do it, I decided to give up. and surely did the right thing. now I can spend my nights doing something usefull |
||||||||
|
|
|||||||
You're not on this one? That's bad... It's fun... It's my 1st one from "scratch": all I did in the last one was crop some bytes out of someone else's code... Maybe I'll do some coding this time... I did however continue my findings: code:So, and for the purpose of this game that is to find ONE0 need (ab)cd (repeat: ONE) solution, we can eliminate these constructs: (ab)cd, a(bc)d, ab(cd). The (abc)d construct is only used for these numbers (and respective permutations): 1277 == (7*7-1)/2. The a(bcd) construct is needed for these 3 sets: 1346 == 6/(1-3/4); 1456 == 6/(5/4-1); 1668 == 6/(1-6/8) As for the (ab)(cd), 13 is too much to test for... Even 3 may prove to be too much! Hope this helps you guys, even though I may be shooting myself in the foot, but hey! this is just a friendly competition... Gonna do some work, then sleep over it. I'll probably only get back to this in some 48 hours or so to start (and finish) my coding for this one, so don't be surprised if you don't read from me for a couple of days... [ 18. September 2002, 17:31: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
A problem … After thinking on the issues discussed above, I believe several of the points brought up by Jens are important for this project. This basic problem is a topic that was talked about a lot in the 50s through the 70s. During this period most mainframes were IBM which had a ridiculously low word size of 4 bytes. This limited the size & accuracy of all numbers. If I remember, it limited integers to 9 digits & floating point to an accuracy of 7 digits. After this point you got an integer overflow or truncation in floating point. The serious problems occur when you divide by a prime number & the result generates a repeating decimal pattern. Floating point math on a computer must truncate the pattern & thus internally the result is inaccurate. An example: (3.0/7.0)*(7.0/3.0) will not generate 1 in most computer languages. Instead it will generate a decimal number very close to 1. Converting the resultant to integer will not produce exact results with any type of “int” function since the value in general can be above 1 or below 1 & with higher level primes the distance from 1 can get larger. Rounding doesn’t help because it can’t tell the difference between 0.5 or 0.99999 or 1.00001 or 1.49999. Another factor is the mixing of operations types in floating point math. For multiplication or division, a scientific notation representation of the numbers gives the greatest accuracy but you can not add two scientific numbers so for addition floating point arithmetic uses pseudo integer formalism. This implies resultant decimal accuracy of an addition/subtraction is equal to the lowest accuracy of the 2 numbers. Thus we get things like: 20*(1.0/3.0) + (1.0/3.0) = 20*(0.333333)+(0.3333333)= 6.9999933 Note as you increase the size of the leading multiplier the inaccuracy increases. The 2 above factors tend to produce floating point resultants that have small pseudo random numbers added to them. This is why exact compares in floating point tend not to work. The problem worsens as the number of potential primes increases and the size of the numbers increase. If we had been asked to do another common variant of the game that uses a deck of cards then we might have all noticed the problem sooner because it uses a number range of 1 to 13 which includes 2 extra & larger primes. The solution … I have come to the conclusion that Jens point about not using decimal math is an absolute requirement for the routine to work consistently. All calculations must be done in integer math & this means all divisions must be re-structured as Jens suggested above so that division is never done unless the final result will be an integer. A note to Madruga … If you used floating point math in your perl script you can not be sure you found all solutions correctly. |
||||||||
|
|
|||||||
Well, I could rewrite it to use some kind of "infinite" precision math routines: it would probably take a few days instead of some minutes, but would not fail... However, you have to look at floating point math in another way: is the PC's floating point accuracy enough to overcome potential "rounding" errors? I think that, in this case, where we have only 4 numbers in the range 0..9 and 3 (THREE!) operations, any inacuracy that is introduced is certainly VERY close to 0, that is, below 0.000001 or most likely even lower than that. Today's computers conforms to IEEE 8 byte floating point math: it's inexpensive (processing wise due to the builtin math coprocessor) and has "decent" accuracy (don't feel like digging some specs now!). If you consider that, with only 3 operators, and something like 10+ decimal places of accurate calculation you will SURELY not have an error above the 8th decimal digit, I assume that testing for 24 within 1^-6 is most likely enough... Also, I don't know how to prove this mathematically, but you would not get a number THAT close to 24 with only these 4 digits & 3 operators... I'll do the following: I'll change my generator program to save ALL possible combinations regardless of whether they evaluate to near 24 or not, and I'll then see what is the number that comes closer to 24, without actually being 24 and that shouldn't be 24. I'll post the results later... [ 19. September 2002, 01:00: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
Has everyone lost sight of what the purpose of this exercise is? Take a problem with a set of specific given criteria, mix in some KiXtart ingenuity, comradery, and FUN. Uncover some shortcuts, inconsistencies, workarounds, etc. Satisfy the given requirements not all possible requirements. After we play & learn a little, the code can then be written in a percise bulletproof fashion. We are still in the FUN stages. Don't scare away those that don't share is the enthusiasm for extremes. |
||||||||
|
|
|||||||
I second that Howard! The only reason I wrote the perl program to compute all possible solutions, was because I figured that, being a small and easily computable set, I could perhaps simplify the algorithm! I did, as 3 types of parentheses constructs can be safely eliminated! BTW: I'm now running the "updated" script, that will save all possible values, correct or not, but I'm doing this only for fun! I want to know if I'm right in my previous post... Meanwhile, and this is not to blame Ruud, perl's floating point implementation is a LOT more robust: I ported the exact same script to KiXtart and (while taking loads more time to run! ), it only found less than half the solutions! In fact, for some numbers, it wasn't even able to find ANY solution when the perl script DID find at least one! Again, KiXtart is certainly *not* the best tool for this "game" in case you're taking it a bit too serious, but it's a good tool for loads of other stuff! |
||||||||
|
|
|||||||
howard, Being a mathematician, I have a tendency to get over involved in anything that has to do with math. Thanks for the reminder. |
||||||||
|
|
|||||||
I kinda like the high-brow tangents these things fly off into. There is always the danger I might learn something new, and to a jaded techie that's one of the major bonuses of this board. The code I have does *not* work with all possible combinations - it only finds 422 of Fernando's 465. It's been crippled because of keeping the size down. In the processes I've also doubled the time that it takes to run, just to save 2 characters. However, it does adhere to the rules and gives the correct results It's also given me a corker of a UDF that I'll publish once the first round is over. It is so cute I'm going to name my first-born after it. |
||||||||
|
|
|||||||
yeah... this chit chat is nice reading especially when it's weekend. allthough, I think we should do next golf on general so this mumble can't get off topic in anyway... |
||||||||
|
|
|||||||
Well Howarth, if it does not find all 465, it is bound to fail some tests, as one of them is a random one! Being 422 aprox. 91% of 465, it's bound to fail on 1 out of 10 (avg) runs... Just to let you know... |
||||||||
|
|
|||||||
As promised, here are the numbers that evaluate closer to 24: code:As you can see, the closest ones are 23.8888888888889 and 24.1111111111111. They are VERY far from the needed 24 result, so we could even just check for 23.923.8 I think that this particular info may be of interest to all that are "fighting" with this game... [ 19. September 2002, 11:17: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
True. The point is that it passes the tests. The tests may be flawed, but the code passes them. The random "test" is pointless because it does not evaluate the truth of the answer - any response is correct. Besides, those 1 in 10 chances occur less often than you think On a completely different note, I won't be able to post the code until Tuesday - a bit late really. Does anyone not actively participating want to hold it for me and post it when this coding phase closes? |
||||||||
|
|
|||||||
quote:Sorry to disagree with you on this one, but "any response is correct" is not true! You're suposed to check the provided result! And if you "cheat" by "looking the other way" on the random test, you'll fail to comply with the given objectives! Besides, I might take some minutes out of my lunch hour to improve "my" version of the test program so that it "fixes" that manual input... |
||||||||
|
|
|||||||
mmm... I think the test script should contain more than one random... maybe even 10-20 randoms in the row. it's not hard to check if the answer is correct or not...   |
||||||||
|
|
|||||||
quote:It's not cheating, it's taking advantage of a loophole. If the code correctly responds to the random numbers when run it passes the test *and* it complies with all the given objectives. Having said all that, I don't see why the test script shouldn't check for all the valid permutations that you've found so far, except that it would take quite a long time to run, and it doesn't leave much time to tighten up existing code. (some of us have to sneak this is in during quiet moments at work, heh). An exhaustive test would also enumerate all the invalid values, to be sure that a formula is not returned in that case. |
||||||||
|
|
|||||||
I have lost track of the standings so far and am reposting my current score considering most of the previous discussion. quote:My code is using 5 different sets of "()", checking all permutation of operators, and all permutations of numbers. If anyone can prove that more "()"'s are needed, I can add a set of "()"'s with 6 strokes. I still need to optimize a little. [ 19. September 2002, 14:55: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Richard, You can mail your code to me & I will post it for you but there is a risk I might not be able to post it. My son uses my computer whenever I am not on it because mine is faster than his computer & last night it died after he installed something. I can't even use explorer on the damn thing & I will have to rebuilt but I should have it fixed by the weekend. For what its worth, I think you should post your code using whatever criteria you choose. It is up to Jens to decide the final results & as Howard says its only fun. I also had to decrease efficiency to save code size but that's part of the game - right. I am intrigued to see how you got to 400. I look at my code & I wonder where can I cut 300 characters even if I knowingly decrease accuracy. I can’t see how to do it. So I would like to see the script even if it misses some combos. Anyway, I think this accuracy issue is deeper than some might think. I found 2 sites on the Internet that either generate solutions or solve them & both seem to occasionally give incorrect answers. For one, I reviewed the source code & it uses the same basic methodology that I do but it gives different answers from me. I attribute it to the fact that floating-point calculations are ever so slightly differently in both codes. With infinite repeating decimal patterns lengthening the word size will never completely eliminate the issue. The last I remember Richard was at 400. I am at 700 but if I remove some () cases I might be able to get to Howard’s number. |
||||||||
|
|
|||||||
heh... haven't you heard that there is systems which may restrict the abuse of computer? I've used nt-line since 99 on my home computers and seen that it is really good way to disable the ability to what I don't want my quests to do |
||||||||
|
|
|||||||
Lonkero, Yes I know, but unfortunately I tolerate things that my son does that I would never tolerate at work. He thinks he's a hot shot & I am old fart who doesn't really understand the new world. While I disagree with him, he does have more endurance & energy & he wins most of the disputes. The life of a parent can be a challange sometimes. I am seriously thinking of getting a proper backup system at home. This is getting annoying. By the way what is "nt-line"? [ 19. September 2002, 15:22: Message edited by: Jack Lothian ] |
||||||||
|
|
|||||||
Thanks Jack, it's on it's way... |
||||||||
|
|
|||||||
quote:Sorry... Wrong again... Anything that is not repeatable, can't be said to conform to these specs... You see, what happens if the exact same time someone is trying to comprove your code it fails on them? It's almost like going: "this is dangerous: I'll stick my head into the sand and hopefully they'll miss me"... P.S.: I'm not trying to remove the fun here... |
||||||||
|
|
|||||||
I shortened my words from nt and w2k to nt-line. NewTech-line. also, I've made some systems run on dualboot. first, it starts dos7 on 1Gb drive which has the image of w2k install-drive on it. when the the image is dropped it reboots automatically and w2k is run... then when w2k boots up it has in its runkey a command which changes the boot order to be first the dos and ofcourse timeout 0. this way, it does not matter what they install. and if your kid is too wise, install nt so he may not even see what's on this fat32 partition |
||||||||
|
|
|||||||
Thanks Jooel, Maybe my son is correct - the sense of nt-line is obvious. Also, I have been thinking of setting up a dual-boot system for some time know. I would also like to try out Linux so maybe now is the time to make the big leap to triple boot. |
||||||||
|
|
|||||||
I updated the test script to check for all valid solutions when it's given random numbers, and also to tun 20 random tests instead of one. It's fast: only 2 seconds, so it's not THAT much overhead added to your function! Also, I added a version number to the 1st line printed (it now says: "Game 24 v 1.1") code:Here it is:[d:\work\admin\kixtart\kixgolf4]timer /1 on %+ kix32 test.kix %+ timer /1 off code:BREAK ON [ 19. September 2002, 16:21: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
wow! quote:wow again! you got only 38 strokes why you boys keep on fighting anymore |
||||||||
|
|
|||||||
Firstly, I am willing to accept any code sent to me for posting on Saturday. I have not yet found time to code a solution myself because of a lack of time (been working for the last two weeks straight). Secondly, the next KiXtart Golf tournament will be posted into the General forum as per suggestion of both Jack and Jooel. Thirdly, the tests that I implemented in my first post with regards to the validity of the function return are indeed cruel. I'm an idealist and I do believe that anybody participating in the KiXtart Golf games does it because of an intrest in codeing KiXtart, taking KiXtart to the next level, likes to solve tricky stuff, and so on. Thus, I trust everybody to actually make sure the code fulfills the challenge without me pouring through every line of code to see whether there's a loophole. Fourthly, I do hope everybody still has fun despite the problems we're running into with regards to integer/floating point calculations. [ 19. September 2002, 16:25: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Eheh... I said I'd only start coding my game24 tonight, and so it will be! Maybe tomorrow I can have a "valid" score... P.S.: I, for one, am having LOADS of fun with this one! And I haven't even started coding! (Maybe that fun will turn to pain when I do... ) [ 19. September 2002, 16:25: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 476, running under KiXtart v4.10 KixGolf v3.0.3 score = 474, running under KiXtart v4.10 It is getting tougher for me now. KixGolf v3.0.3 score = 468, running under KiXtart v4.10 KixGolf v3.0.3 score = 466, running under KiXtart v4.10 KixGolf v3.0.3 score = 463, running under KiXtart v4.10 KixGolf v3.0.3 score = 453, running under KiXtart v4.10 KixGolf v3.0.3 score = 447, running under KiXtart v4.10 [ 20. September 2002, 21:30: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
no one striking back? this long period (1week) on the first private coding phase has got this thing to flatten a little bit... no great me-first-wars anymore...   |
||||||||
|
|
|||||||
hey ho! Hi guys.. another fine kixgolf game I see. I haven't had time to foray into this.. work at hand ya know..... Very interesting, though.. ! (I'm going to post some code in another spot.. see if anyone is interested... it's on analyzing Microsoft proxy logs..) Brian |
||||||||
|
|
|||||||
brian, these golfs are almost boring when you are not fighting for your life! no, really, you might inform us when you have some days less work so we might plan the golf to suit your schedule also rombl!   |
||||||||
|
|
|||||||
Are you not getting much competition these days, Lonkero? Unfortunately, (or perhaps fortunately), my life has become busier with lots of social activities, church activities, family events, etc. so that I don't have as much time to let the geek out that is cooped up inside of me! Brian |
||||||||
|
|
|||||||
You still have a few hours! |
||||||||
|
|
|||||||
church? is that religion? as if it is, it's bad.   |
||||||||
|
|
|||||||
Brian, if you only need (ab)(cd) and a(bcd) how would you show (a+b+c)/d as a possibility? Did I miss something? {edit} Seems that I jumped the gun. Just noticed your edit. [ 20. September 2002, 22:54: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Brian, what happened to your post? |
||||||||
|
|
|||||||
hmm. i must be lame brained today.. I deleted that post because it was stupid.. but i had it partially right: 3 possibilities: a(bcd),(ab)(cd), and (abc)d... All the others are redundants.. Just my two cents.. (The only reason you need (abc)(d) is because the / and - are not commutative.) Brian |
||||||||
|
|
|||||||
If that is the case I can trim a little more. Haven't thought through it in great detail. |
||||||||
|
|
|||||||
You could have started trimming sooner: back in page 4 of this thread, I had already stated that, although in other terms... Gonna start my coding now. Wish me luck guys! |
||||||||
|
|
|||||||
KixGolf v3.0.3 score = 438, running under KiXtart v4.10 |
||||||||
|
|
|||||||
PPL: need some help... What's the best way to debug a KiXtart program and watch variables? The built-in debugger is very basic... Please advise... |
||||||||
|
|
|||||||
For big projects or repeatative vars (hehe), I have always used WriteLog() UDF and write a file to trace program execution. I document whatever items seem to be affecting my code until the bugs are squashed. [ 21. September 2002, 01:50: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Well... I've managed to fix the bug. However, I don't think I'll be any match to you guys: I've just finished the permutation generation code, and am already running at 277!! When I add the operators, parentheses and tests, I'll be WAY over the current results... Anyway, I'll try and finish this one... I may be leaving KiXtart and this forum real soon. |
||||||||
|
|
|||||||
Why would you be leaving? |
||||||||
|
|
|||||||
I have to make a correction: "may be" -> "will be"... I'm starting to dislike KiXtart: even though it has some nice builtin functions for use in logon scripts, it does lack a LOT... I've become used to more high level languages, or even not so high level but with more descriptive error messages and better debuggers... And this particular KixGolf edition served to show that we can't even rely on floating point! Having written the exact same program in Perl and KiXtart, KiXtart's version fails a LOT... Even though I tried to "ignore" some of KiXtart's "missing" features, I don't like being "tied up"... Everywhere I turn to make something other than the most basic things, KiXtart won't do it... These last 2 KixGolf contests served to show me one thing: doing some major KiXtart development, as I was planning to, would be a MAJOR pain, and I've become used to making the computer work for me, as opposed to having to work for the computer... Also, I've managed to convince my boss that we should buy ScriptLogic's software, and so I won't be needing to do any KiXtart programming at all! If I ever need a small script, I'll do it in Perl or maybe Python (learning this one now...) That's the main reason why I'm leaving. After all, if not "KiXtarting", there's no reason to stay in a KiXtart BB!! As a sidenote: I don't think I'll complete the game script, after all: I am already running at 400+ and it's still missing the parentheses and test condition! And those two will surely add another 100+ keystrokes. Also, my weekend is going to be somewhat busy (got to go for tonight). [ 21. September 2002, 03:15: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
I have been playing with this on and off for days, and only got a working script about 6 hours ago! Not compressed much, but I doubt I can do much better. Golf Score 541. |
||||||||
|
|
|||||||
What? Last post was in 21/09/2002 @ 18:51? Things look VERY quiet in here... Anyway, ppl, in the process of rewriting the 6 hour Perl program to compute all solutions into a 21 minute Python version, I found that one solution had been missed by the perl version! That's 3388 wich does have a valid solution as 8/(3-8/3). So, please add this line: quote:before the following line: quote:in my previously published version of the test program. BTW: If I do get some spare time, I might try to complete this game anyway... As part of my Python learning program I'll make a program to compute a simpler algorithm. If I do find one, I'll try to make a KiXtart program out of it, and if I don't bump into many walls doing it, I may as well end up posting my version of game24... [ 23. September 2002, 17:43: Message edited by: Fernando Madruga ] |
||||||||
|
|
|||||||
Fernando: We moved on to the second part of KiXtart Golf in KixGolf Results/Code |