Page 6 of 7 « First<34567>
Topic Options
#69855 - 2002-09-19 10:48 AM Re: KiXtart Golf V: Game24
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
Well Howarth, if it does not find all 465, it is bound to fail some tests, as one of them is a random one! [Smile]

Being 422 aprox. 91% of 465, it's bound to fail on 1 out of 10 (avg) runs... [Smile]

Just to let you know... [Smile]
_________________________
Later,   [b]Mad[/b]ruga

Top
#69856 - 2002-09-19 11:06 AM Re: KiXtart Golf V: Game24
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
As promised, here are the numbers that evaluate closer to 24:

code:
23.8
23.8333333333333
23.8571428571429
23.875
23.8888888888889
24.1111111111111
24.125
24.1428571428571
24.1666666666667
24.2

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.9
I think that this particular info may be of interest to all that are "fighting" with this game... [Smile]

[ 19. September 2002, 11:17: Message edited by: Fernando Madruga ]
_________________________
Later,   [b]Mad[/b]ruga

Top
#69857 - 2002-09-19 11:09 AM Re: KiXtart Golf V: Game24
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
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 [Wink]

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?

Top
#69858 - 2002-09-19 11:31 AM Re: KiXtart Golf V: Game24
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
quote:

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.

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... [Smile]
_________________________
Later,   [b]Mad[/b]ruga

Top
#69859 - 2002-09-19 11:38 AM Re: KiXtart Golf V: Game24
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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...
 
_________________________
!

download KiXnet

Top
#69860 - 2002-09-20 12:01 AM Re: KiXtart Golf V: Game24
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
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!
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.

Top
#69861 - 2002-09-19 02:54 PM Re: KiXtart Golf V: Game24
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I have lost track of the standings so far and am reposting my current score considering most of the previous discussion.

quote:
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+6.0)+8.0*2.0 = 24

Numbers = 4, 4, 6, 6
Correct answer answer, there is no solution to this combination

Numbers = 3, 3, 8, 8
Please doublecheck your solution to guarantee a correct result
8.0/(3.0-8.0/3.0) = 24

Numbers = 0, 5, 9, 5
No solution found
<> 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
(8.0*9.0)/(2.0+1.0) = 24

Time: 8232 ticks

KixGolf v3.0.3 score = 542, running under KiXtart v4.10

C:\Data\Scripts\Golf>C:\Data\Kix2001\KiX2001.411\kix32 golf4.kix

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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69862 - 2002-09-19 03:03 PM Re: KiXtart Golf V: Game24
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
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.
_________________________
Jack

Top
#69863 - 2002-09-19 03:07 PM Re: KiXtart Golf V: Game24
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
#69864 - 2002-09-19 03:17 PM Re: KiXtart Golf V: Game24
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
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 ]
_________________________
Jack

Top
#69865 - 2002-09-19 03:22 PM Re: KiXtart Golf V: Game24
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Thanks Jack, it's on it's way...
Top
#69866 - 2002-09-19 03:26 PM Re: KiXtart Golf V: Game24
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
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.

Sorry... Wrong again... [Smile]

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...
_________________________
Later,   [b]Mad[/b]ruga

Top
#69867 - 2002-09-19 03:27 PM Re: KiXtart Golf V: Game24
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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 [Big Grin]
_________________________
!

download KiXnet

Top
#69868 - 2002-09-19 03:45 PM Re: KiXtart Golf V: Game24
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
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.
_________________________
Jack

Top
#69869 - 2002-09-19 03:51 PM Re: KiXtart Golf V: Game24
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
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:
[d:\work\admin\kixtart\kixgolf4]timer /1 on %+ kix32 test.kix %+ timer /1 off
Timer 1 on: 14:37:54

Game24 KiXtart Golf running under KiXtart v4.11

In => 1, 2, 3, 4; Out => = => WRONG!!
In => 2, 2, 6, 8; Out => = => WRONG!!
In => 4, 4, 6, 6; Out => = => Correct!!
In => 3, 3, 8, 8; Out => = => Correct!!
In => 0, 4, 8, 9; Out => = => NOT in solution set!!
In => 8, 8, 3, 1; Out => = => Correct!!
In => 5, 1, 5, 6; Out => = => Correct!!
In => 8, 8, 4, 3; Out => = => NOT in solution set!!
In => 9, 9, 4, 8; Out => = => Correct!!
In => 6, 9, 4, 9; Out => = => Correct!!
In => 0, 7, 0, 6; Out => = => NOT in solution set!!
In => 1, 8, 1, 1; Out => = => Correct!!
In => 6, 8, 3, 2; Out => = => Correct!!
In => 1, 5, 4, 8; Out => = => Correct!!
In => 2, 9, 7, 8; Out => = => Correct!!
In => 5, 8, 2, 7; Out => = => Correct!!
In => 1, 0, 3, 7; Out => = => Correct!!
In => 1, 1, 7, 7; Out => = => NOT in solution set!!
In => 5, 6, 0, 3; Out => = => NOT in solution set!!
In => 2, 9, 9, 1; Out => = => NOT in solution set!!
In => 5, 3, 9, 0; Out => = => Correct!!
In => 0, 1, 7, 8; Out => = => NOT in solution set!!
In => 5, 9, 7, 0; Out => = => NOT in solution set!!
In => 0, 7, 6, 6; Out => = => NOT in solution set!!
In => 3, 4, 7, 7; Out => = => WRONG!!
In => 1, 2, 8, 9; Out => = => WRONG!!
In => 3, 3, 7, 7; Out => = => WRONG!!

kix32 Kixgolf3.kix $f=test.kix

KixGolf v3.0.3 score = 38, running under KiXtart v4.11
Timer 1 off: 14:37:57 Elapsed: 0:00:02,83

[d:\work\admin\kixtart\kixgolf4]

Here it is:

code:
BREAK ON

Global $Target, $Valid

$Target = 24
$ErrorMargin = 0.0001
$Valid = "003800460128013601370138013901450146014701480155015602260234"
+ "023602380239024402460248025702580266026802690288033403350337"
+ "033803390344034603480349035803590366036703680378038803890445"
+ "044604470448045604660467046804690478048805660569058806890699"
+ "078908881118112611271128112911341135113611371138113911441145"
+ "114611471148114911551156115711581166116811691188122412251226"
+ "122712281229123312341235123612371238123912441245124612471248"
+ "124912551256125712581259126612671268126912771278127912881289"
+ "133313341335133613371338133913441345134613471348134913561357"
+ "135813591366136713681369137713781379138813891399144414451446"
+ "144714481449145514561457145814591466146714681469147714781479"
+ "148814891555155615591566156715681569157815791588158915991666"
+ "166816691679168816891699177917881789179918881889222322242225"
+ "222722282229223322342235223622372238223922442245224622472248"
+ "224922552256225722582259226622672268226922772278228822892333"
+ "233523362337233823392344234523462347234823492355235623572358"
+ "235923662367236823692377237823792388238923992444244524462447"
+ "244824492455245624572458245924662467246824692477247824792488"
+ "248924992557255825592566256725682569257725782579258825892666"
+ "266726682669267826792688268926992778278827892888288928993333"
+ "333433353336333733383339334433453346334733483349335533563357"
+ "335933663367336833693377337833793389339934443445344634473448"
+ "344934553456345734583459346634683469347734783479348934993556"
+ "355735583559356635673568356935783579358835893599366636673668"
+ "366936773678367936883689369937773778377937883789379938883889"
+ "389939994444444544464447444844494455445644574458446844694477"
+ "447844794488448945554556455745584559456645674568456945774578"
+ "457945884589459946664667466846694677467846794688468946994777"
+ "477847884789479948884889489955555556555955665567556855775578"
+ "558855895599566656675668566956775678567956885689569957795788"
+ "578958885889666666686669667966886689678967996888688968997889"

$rc=SETOPTION('Explicit','ON')
$rc=SETOPTION('NoVarsInString','ON')
$rc=SRND(@MSECS)

? 'Game24 v 1.1 KiXtart Golf running under KiXtart v'@KIX
? ''
Dim $i

test24(1,2,3,4,1)
test24(2,2,6,8,1)
test24(4,4,6,6,2)
test24(3,3,8,8,2)
for $i = 1 to 20
test24(RND(9),RND(9),RND(9),RND(9),3)
next
test24(3,4,7,7,1)
test24(1,2,8,9,1)
test24(3,3,7,7,1)
? ""

; Inputs: $i1..$i4 => 4 numbers to pass to game24
; $behaviour = 1 -> Expected result
; $behaviour = 2 -> Expected to fail
; $behaviour = 3 -> Don't know (random)
function test24($i1,$i2,$i3,$i4,$behaviour)
DIM $rc, $out, $result, $error, $str, $i, $found, $temp, $nums[4], $numbers

$str = 'In => '+$i1+', '+$i2+', '+$i3+', '+$i4+'; Out => '
$out=Game24($i1,$i2,$i3,$i4)
$i = 1
while $i <= Len($out)
if ( SubStr($out,$i,1) >= '0' ) and ( SubStr($out,$i,1) <= '9' )
$out = Left($out,$i) + '.0' + SubStr($out,$i+1)
$i = $i + 2;
endif;
$i = $i + 1;
loop
$error=Execute("$$result=("+$out+")")
$result=Trim($result)
$str = $str + $out + " = " + $result
if ( $behaviour = 3 )
; $str = $str + " => Not sure..."
; sort numbers used, so as to check array of possible solutions
$nums[0] = $i1
$nums[1] = $i2
$nums[2] = $i3
$nums[3] = $i4
do
$found = 0
for $i = 0 to 2
if $nums[$i] > $nums[$i+1]
$found = 1
$temp = $nums[$i+1]
$nums[$i+1] = $nums[$i]
$nums[$i] = $temp
endif
next
until $found == 0
$numbers = "" + $nums[0] + $nums[1] + $nums[2] + $nums[3]
; check for presence in array
$found = 0
$i = 1
while ( $found == 0 ) and ( $i < Len($Valid) )
if ( SubStr( $Valid, $i, 4 ) == $numbers )
$found = 1
endif
$i = $i + 4
loop
if $found
$str = $str + " => Correct!!"
else
$str = $str + " => NOT in solution set!!"
endif
else
if ( ($behaviour=1) and ($result>=$Target-$ErrorMargin)
and ($result<=$Target+$ErrorMargin) )
or ( ($behaviour=2) and ($result='') )
$str = $str + " => Correct!!"
else
$str = $str + " => WRONG!!"
endif
endif
? $str
endfunction

Dim $shellcommand
$shellcommand='kix32 Kixgolf3.kix $f='+@scriptname
? $shellcommand
Shell $shellcommand

; Operators: 64 combinations
; +++ ++- ++* ++/ +-+ +-- +-* +-/ +*+ +*- +** +*/ +/+ +/- +/* +//
; -++ -+- -+* -+/ --+ --- --* --/ -*+ -*- -** -*/ -/+ -/- -/* -//
; *++ *+- *+* *+/ *-+ *-- *-* *-/ **+ **- *** **/ */+ */- */* *//
; /++ /+- /+* /+/ /-+ /-- /-* /-/ /*+ /*- /** /*/ //+ //- //* ///

; Digits: 24 permutations
; abcd abdc acbd acdb adbc adcb
; bacd badc bcad bcda bdac bdca
; cabd cadb cbad cbda cdab cdba
; dabc dacb dbac dbca dcab dcba

; Parentheses: 5 combinations
; a b c d
; a b (c d)
; (a b)(c d)
; a(b c d)
; (a b c)d

; 0 need (ab)cd
; 0 need a(bc)d
; 0 need ab(cd)
; ------------------
; 1 need (abc)d
; ------------------
; 3 need a(bcd)
; 13 need (ab)(cd)
; ------------------
; 131 need at least one '+'
; 174 need at least one '-'
; 306 need at least one '*'
; 36 need at least one '/'
;!
function game24($a,$b,$c,$d)

endfunction

;!
;!



[ 19. September 2002, 16:21: Message edited by: Fernando Madruga ]
_________________________
Later,   [b]Mad[/b]ruga

Top
#69870 - 2002-09-19 03:55 PM Re: KiXtart Golf V: Game24
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wow!
quote:

kix32 Kixgolf3.kix $f=test.kixKix
Golf v3.0.3 score = 38, running under KiXtart v4.11
Timer 1 off: 14:37:57 Elapsed: 0:00:02,83
[d:\work\admin\kixtart\kixgolf4]

wow again! you got only 38 strokes [Eek!]

why you boys keep on fighting anymore [Confused]
_________________________
!

download KiXnet

Top
#69871 - 2002-09-19 04:10 PM Re: KiXtart Golf V: Game24
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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 ]
_________________________
There are two types of vessels, submarines and targets.

Top
#69872 - 2002-09-19 04:24 PM Re: KiXtart Golf V: Game24
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
Eheh... I said I'd only start coding my game24 tonight, and so it will be! [Smile]
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... [Smile] )

[ 19. September 2002, 16:25: Message edited by: Fernando Madruga ]
_________________________
Later,   [b]Mad[/b]ruga

Top
#69873 - 2002-09-20 04:05 AM Re: KiXtart Golf V: Game24
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69874 - 2002-09-20 09:12 PM Re: KiXtart Golf V: Game24
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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...
 
_________________________
!

download KiXnet

Top
Page 6 of 7 « First<34567>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.076 seconds in which 0.029 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org