Page 1 of 2 12>
Topic Options
#77166 - 2003-10-19 03:02 PM KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
KiXgolf - PxMagic: Part II

Time to post your final scores of the first private coding round and the associated KiXtart scripts. You're welcome to post the scripts via PostPrep.

As most of you figures out, the primary way to display the images would be via the KiXforms DLL. However, as I already hinted in the rules, there is at least one other way to create the image display. Some of you suspected Internet Explorer as the tool of choice.

The easiest way to use Internet Explorer to display the images is to create a HTML page. The page would consist of a simple table with rows and columns according to the number of pixels for width and height of the image. Then, each table cell would be set to be one pixel wide and one pixel high. The background color of each cell would represent the coor of the corresponding image pixel. The HTML syntax would look like this for a 10x10 image:
code:
<html>

<head>
<style>
<!--
td { width: 1; height: 1; font-size:0px }
-->
</style>
</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" width="10" height="10">
<tr>
<td bgcolor="#000000" >&nbsp;</td>
<td bgcolor="#008000" >&nbsp;</td>
<td bgcolor="#800000" >&nbsp;</td>
<td bgcolor="#808000" >&nbsp;</td>
<td bgcolor="#000080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#808080" >&nbsp;</td>
<td bgcolor="#FFFF00" >&nbsp;</td>
<td bgcolor="#00FF00" >&nbsp;</td>
<td bgcolor="#00FFFF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
<td bgcolor="#FFFFFF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#000000" >&nbsp;</td>
<td bgcolor="#008000" >&nbsp;</td>
<td bgcolor="#800000" >&nbsp;</td>
<td bgcolor="#808000" >&nbsp;</td>
<td bgcolor="#000080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#808080" >&nbsp;</td>
<td bgcolor="#FFFF00" >&nbsp;</td>
<td bgcolor="#00FF00" >&nbsp;</td>
<td bgcolor="#00FFFF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
<td bgcolor="#FF00FF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#000000" >&nbsp;</td>
<td bgcolor="#008000" >&nbsp;</td>
<td bgcolor="#800000" >&nbsp;</td>
<td bgcolor="#808000" >&nbsp;</td>
<td bgcolor="#000080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#808080" >&nbsp;</td>
<td bgcolor="#FFFF00" >&nbsp;</td>
<td bgcolor="#00FF00" >&nbsp;</td>
<td bgcolor="#00FFFF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
<td bgcolor="#FF0000" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#000000" >&nbsp;</td>
<td bgcolor="#008000" >&nbsp;</td>
<td bgcolor="#800000" >&nbsp;</td>
<td bgcolor="#808000" >&nbsp;</td>
<td bgcolor="#000080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#808080" >&nbsp;</td>
<td bgcolor="#FFFF00" >&nbsp;</td>
<td bgcolor="#00FF00" >&nbsp;</td>
<td bgcolor="#00FFFF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#000000" >&nbsp;</td>
<td bgcolor="#008000" >&nbsp;</td>
<td bgcolor="#800000" >&nbsp;</td>
<td bgcolor="#808000" >&nbsp;</td>
<td bgcolor="#000080" >&nbsp;</td>
<td bgcolor="#800080" >&nbsp;</td>
<td bgcolor="#808080" >&nbsp;</td>
<td bgcolor="#FFFF00" >&nbsp;</td>
<td bgcolor="#00FF00" >&nbsp;</td>
<td bgcolor="#00FFFF" >&nbsp;</td>
</tr>
<tr>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
<td bgcolor="#008080" >&nbsp;</td>
</tr>
</table>

</body>

</html>



[ 19. October 2003, 15:04: Message edited by: sealeopard ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77167 - 2003-10-19 03:08 PM Re: KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
code:
KiXtart
KiXtart Version = 4.21
KiXforms Version = 2.3.0.41
KiXGolf Script = kixgolf_pxmagic.kix

Computer
OS = Windows XP Home Edition
CPU = Intel(R) Celeron(R) CPU 2.00GHz
Speed = 1993 MHz
Memory = 382 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: PxMagic - Read & Display PxM Images
Processing Start = 2003/10/19 08:27:08.328
Processing End = 2003/10/19 09:10:53.015
Duration = 0000/00/00 00:43:44.687
# Images = 8
KiXGolf Score PxMagic = 39
KiXGolf Score PxMRead = 167
KiXGolf Score PxMDisplay = 266
KiXGolf Score Total = 472

Thank you for participating in KiXtart Golf!

I have included my two best approaches. The second approach is currentlu commented out.

; begin PxMagic 
;
;!
Function PxMagic($)
PxMRead($)
EndFunction
;!
; end PxMagix


; begin PxMRead 
;
;!
;Reader #2 - runs with displayer #2 CURRENT WINNING CODE
Function PxMRead($)
dim $h
open (1, $)
do
for each $ in split(join(split(split(READLINE(1),"#")[0]," ")))
if $
$h=$h+" "+$
endif
next
until @error
close(1)
PxMDisplay(split($h))
EndFunction


;Reader #1 - runs with displayer #1
;Function PxMRead($)
; dim $o
; open (1, $)
; $ = createobject("VBscript.RegExp")
; $.Global = 1
; $.Pattern = 'P|\s+|#.*|$'
; do
; $o = $.replace($o+READLINE(1)," ")
; until @error
; close(1)
; PxMDisplay(split($o))
;EndFunction
;!
; end PxMRead


; begin PxMDisplay 

;!
;Display 2 - runs with Reader #2 CURRENT WINNING CODE
Function PxMDisplay($)
dim $a, $f, $w, $h, $y, $z

$a = CreateObject("Kixtart.Form")
;$a.ClientSize = $[2],$[3] ; Use this line for properly sized forms
$a.Size = 700,700 ;Comment out if using ClientSize above
$a.Show

$y = 5
$f = 255/$[4]
if $[1]="P1"
$y = 4
$f = 255
endif

$z = $[1]="P3"

for $h=1 to $[3]
for $w=1 to $[2]
$a.PSet($w, $h, $f*(65536*$[$y+2*$z]+256*$[$y+$z]+$[$y]))
$y = 1 + $y + 2*$z
next
next
sleep 10

;Uncomment the lines below to keep the form on the screen
;until closed manually.

;While $a.Visible
; $y=Execute($a.DoEvents)
;Loop
EndFunction


;Display 1 - runs with Reader #1
;Function PxMDisplay($)
; dim $a, $f, $w, $h, $y, $z
;
; $a = CreateObject("Kixtart.Form")
; ;$a.ClientSize = $[2],$[3] ; Use this line for properly sized forms
; $a.Size = 700,700 ;Comment out if using ClientSize above
; $a.Show
;
; $y = 5
; $f = 255/$[4]
; if $[1]=1
; $y = 4
; $f = 255
; endif
;
; $z = $[1]=3
;
; for $h=1 to $[3]
; for $w=1 to $[2]
; $a.PSet($w, $h, $f*(65536*$[$y+2*$z]+256*$[$y+$z]+$[$y]))
; $y = 1 + $y + 2*$z
; next
; next
; sleep 10
;
; ;Uncomment the lines below to keep the form on the screen
; ;until closed manually.
;
; ;While $a.Visible
; ; $y=Execute($a.DoEvents)
; ;Loop
;EndFunction

;!
; end PxMDisplay


[ 19. October 2003, 15:24: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77168 - 2003-10-19 03:38 PM Re: KiXgolf - PxMagic: Part II
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
After looking at Howard's, I am not sure anything can be gained by viewing my effort but here is my final attempt.

code:
KiXtart
KiXtart Version = KiXtart 2001 4.22 Release Candidate 1
KiXforms Version = 2.3.0.41
KiXGolf Script = kixgolf_pxmagic.kix

Computer
OS = Windows 2000 Professional
CPU = AMD Duron(tm) Processor
Speed = 1095 MHz
Memory = 256 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: PxMagic - Read & Display PxM Images
Processing Start = 2003/10/19 08:43:03.377
Processing End = 2003/10/19 08:43:28.323
Duration = 0000/00/00 00:00:24.945
# Images = 2
KiXGolf Score PxMagic = 60
KiXGolf Score PxMRead = 142
KiXGolf Score PxMDisplay = 474
KiXGolf Score Total = 676

Thank you for participating in KiXtart Golf!

code:
; begin PxMagic
;
;!
Function PxMagic($)
$PxMagic=PxMDisplay(PxMRead($))
EndFunction
;!
;!
; end PxMagic

code:
  ; begin PxMRead
;
;!
Function PxMRead($a)
Dim $
$a=Open(3,$a)
DO
$=$+' '+ReadLine(3)
$a=instr($,'#')
$=iif($a>0,left($,$a-1),$)
Until @ERROR<0
$PxMRead=$
$=close(3)
EndFunction
;!
;!
; end PxMRead

code:
; begin PxMDisplay
;
;!
Function PxMDisplay($)
Dim $t, $j, $w, $m, $f, $i, $y, $r, $a, $k
$f=CreateObject("Kixtart.Form")
$=split($)
FOR EACH $t in $
IF($t<>'')
$[$j]=$t
$j=$j+1
EndIf
NEXT
$t=right($[0],1)
$a=iif($t=3,3,1)
$k=iif($t=1,3,4)
$w=$a*$[1]
$m=(1.0/$[3])*255
For $i=$k to $j-1 Step $a
$y=($i-$k)/$w
$r=iif($t=1,255*(1-$[$i]),$m*$[$i])
$r=$r+256*iif($t=3,$m*$[$i+1],$r)+65536*iif($t=3,$m*$[$i+2],$r)
$f.PSet(($i-$y*$w)/$a,$y,$r)
Next
$t=$f.timer(9999)
$t.OnTimer="$f.hide"
$f.Show
While $f.Visible
$=Execute($f.DoEvents)
Loop

EndFunction
;!
;!
; end PxMDisplay

_________________________
Jack

Top
#77169 - 2003-10-19 04:28 PM Re: KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
quote:
After looking at Howard's, I am not sure anything can be gained by viewing my effort
Jack, you sold yourself short. I did not realize that the default form size was sufficient to display the images. But after a quick test it does seem to be so. Thanks.

Commenting out the following line from my PxMDisplay (posted above).
code:
$a.Size = 700,700  

code:
KiXtart
KiXtart Version = KiXtart 2001 4.22 Release Candidate 1
KiXforms Version = 2.3.0.41
KiXGolf Script = kixgolf_pxmagic.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 848 MHz
Memory = 512 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: PxMagic - Read & Display PxM Images
Processing Start = 2003/10/19 10:16:45.679
Processing End = 2003/10/19 10:17:05.818
Duration = 0000/00/00 00:00:20.139
# Images = 1
KiXGolf Score PxMagic = 39
KiXGolf Score PxMRead = 167
KiXGolf Score PxMDisplay = 251
KiXGolf Score Total = 457

Thank you for participating in KiXtart Golf!



[ 19. October 2003, 16:34: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77170 - 2003-10-19 04:50 PM Re: KiXgolf - PxMagic: Part II
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Howard, I really liked that

code:
		for each $ in split(join(split(split(READLINE(1),"#")[0],"	")))

Neat [Cool]
_________________________
Jack

Top
#77171 - 2003-10-19 08:13 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
k, it looks like hoby cheated.
anyway, here is my 481 that works lot better than 480.
; begin PxMagic 
;
;!
Function PxMagic($)
pxmdisplay(pxmread($),createobject(kixtart.form),255,4)
EndFunction
;!
;!
; end PxMagix

; begin PxMRead 
;
;!
Function PxMRead($)
$=""+open(1,$)
do $=join(split($+" "+join(split(split(readline(1),#)[0], ))," ")) until instr($," ")=1+@error
$pxmread=split($)
$=close(1)
EndFunction
;!
;!
; end PxMRead

; begin PxMDisplay 
;
;!
Function PxMDisplay($,$a,$m,$k)

if 0+$[4] $k=5 $m=$m/$[4] endif

dim $3,$l,$!
for $!=$k to ubound($)-1
$3=2*($[1]=P3)
$l=($!-$k)/(1+$3)
$a.pset($l-$l/$[2]*$[2],$l/$[2],$a.rgb($m*$[$!],$m*$[$!+$3/2],$m*$[$!+$3]))
$!=$!+$3
next
$a.show(3)
sleep 10
EndFunction
;!
;!
; end PxMDisplay


now, wasn't the order said, pxmagic does the handling, reader does reading and display does the display?
in hoby's code, the reader does the reading and displaying and thus I would not accept it.
_________________________
!

download KiXnet

Top
#77172 - 2003-10-19 08:20 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
more faults found in hoby's code.
it outputs to console.

anyway, if you accept it:
Function PxMRead($)
dim $h
open (1, $)
do
for each $ in split(join(split(split(READLINE(1),#)[0], )))
if $
$h=$h+" "+$
endif
next
until @error
close(1)
PxMDisplay(split($h))
EndFunction



makes -4
Function PxMDisplay($)
dim $a, $f, $w, $h, $y, $z

$a = CreateObject(Kixtart.Form)
;$a.ClientSize = $[2],$[3] ; Use this line for properly sized forms
$a.Size = 700,700 ;Comment out if using ClientSize above
$a.Show

$y = 5
$f = 255/$[4]
if $[1]=P1
$y = 4
$f = 255
endif

$z = $[1]=P3

for $h=1 to $[3]
for $w=1 to $[2]
$a.PSet($w, $h, $f*(65536*$[$y+2*$z]+256*$[$y+$z]+$[$y]))
$y = 1 + $y + 2*$z
next
next
sleep 10

;Uncomment the lines below to keep the form on the screen
;until closed manually.

;While $a.Visible
; $y=Execute($a.DoEvents)
;Loop
EndFunction

makes -6

total of -10
resulting in 462.

anyway, I don't like hoby's code being acceptable by the 2 reasons I just gave.
_________________________
!

download KiXnet

Top
#77173 - 2003-10-19 08:23 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
reducing even with 12:
Function PxMDisplay($)
dim $a, $f, $w, $h, $y, $z

$a = CreateObject(Kixtart.Form)
;$a.ClientSize = $[2],$[3] ; Use this line for properly sized forms
$a.Show(3)

$y = 5
$f = 255/$[4]
if $[1]=P1
$y = 4
$f = 255
endif

$z = $[1]=P3

for $h=1 to $[3]
for $w=1 to $[2]
$a.PSet($w, $h, $f*(65536*$[$y+2*$z]+256*$[$y+$z]+$[$y]))
$y = 1 + $y + 2*$z
next
next
sleep 10

;Uncomment the lines below to keep the form on the screen
;until closed manually.

;While $a.Visible
; $y=Execute($a.DoEvents)
;Loop
EndFunction


coming to 450.
and still I think hoby's code is not acceptable.
_________________________
!

download KiXnet

Top
#77174 - 2003-10-19 08:24 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
k, I leave my dial-up connection now and leave the judging to to you jens.
way or another, I'm the current leader [Razz]
_________________________
!

download KiXnet

Top
#77175 - 2003-10-19 09:37 PM Re: KiXgolf - PxMagic: Part II
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Jooel,

In your original post is this line correct?

quote:
if 0+$[4] $k=5 $m=$m/$[4] endif

Couldn't we have a P1 format that starts with byte value of 1 or am I misunderstanding the function of this code? I think you might need something like this:

code:
if $[1]<>'P1' $k=5 $m=$m/$[4] endif

I do like your code:
quote:
$3=2*($[1]=P3) { or $z = $[1]=P3}
Cute [Cool]

[ 19. October 2003, 21:39: Message edited by: Jack Lothian ]
_________________________
Jack

Top
#77176 - 2003-10-19 11:07 PM Re: KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Lonkero, I think I provided the best overall solution. Even adding four strokes to silence the open and close commands, my entry has a better score. I think that the nesting of UDFs is permissable since each UDF does what it is suppose to do.

I initially had a fixed 700x700 form that would display the test suite. Jens did not like that since it prohibits the functioning of the code with larger images. You relied on the default form size like Jack did . I opt'ed to reduce my score by doing the same. Since this has the same issue as my fix form we all will need to add variable sizing to each image. I had the code in my post but had it commented out. To meet Jens work with any size requirements, we all need to add code. Both your code and mine will require the addition of this line "$a.ClientSize = $[2],$[3]" an addition of 23 strokes to each of our scores.

But I have to say congrats on finding all those unecessary quotes in my code. I don't remember seeing that technique applied previously in other Golf outings and would not have thought to remove them and test. You are the optimum optimizer.

[ 19. October 2003, 23:09: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77177 - 2003-10-20 02:32 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
hoby, my show(3) does display in fullscreen, and thus I wonder what more resizing it needs.
it will display all images the current display can handle.

jack, you would need to know what it does to say does it worky or not.
the field $[4] ("0" from open in front, thus actually file field 3) is the maximum of color depth in p3 and p2.
in P1 it is either 1 or 0. with check of if it is 0 I remove all the other checking needs.
if it's zero, the value is kept at 255 which is correct for P1.
if it's 1 (which it can be in P1) 255 is devided with it, which means that it still is 255.
thus, the code stands fully correct.
IIRC, that trick removed 1 stroke.
_________________________
!

download KiXnet

Top
#77178 - 2003-10-20 03:10 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
code:
KiXtart
KiXtart Version = KiXtart 2001 4.22 Release Candidate 1
KiXforms Version = 2.3.0.41
KiXGolf Script = kixgolf_pxmagic.kix

Computer
OS = Windows XP Home Edition
CPU = Intel(R) Pentium(R) 4 CPU 2.80GHz
Speed = 2792 MHz
Memory = 512 MB

KiXGolf Scoring Engine
Scoring Engine = 3.2

KiXtart Golf Score
Tournament = KiXtart Golf: PxMagic - Read & Display PxM Images
Processing Start = 2003/10/20 15:57:59.515
Processing End = 2003/10/20 16:12:53.406
Duration = 0000/00/00 00:14:53.891
# Images = 8
KiXGolf Score PxMagic = 39
KiXGolf Score PxMRead = 190
KiXGolf Score PxMDisplay = 219
KiXGolf Score Total = 448

Thank you for participating in KiXtart Golf!

code:
Function PxMagic($)
PxMRead($)
EndFunction

Function PxMRead($)
$=""+open(1,$)
do $=join(split($+" "+join(split(split(readline(1),#)[0], ))," ")) until instr($," ")=1+@error
PxMDisplay(split($),CreateObject(Kixtart.Form))
close(1)
EndFunction

Function PxMDisplay($,$a)
dim $f, $w, $h, $y, $z

$a.Show(3)

$y = 5
$f = 255/$[4]
if $[1]=P1
$y = 4
$f = 255
endif

$z = $[1]=P3

for $h=1 to $[3]
for $w=1 to $[2]
$a.PSet($w, $h, $f*(65536*$[$y+2*$z]+256*$[$y+$z]+$[$y]))
$y = 1 + $y + 2*$z
next
next
sleep 10
EndFunction

btw, the default form size IS NOT sufficient.
there is at least one image which is bigger.

[ 20. October 2003, 15:12: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#77179 - 2003-10-20 03:18 PM Re: KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I stand corrected on the size issue. I missed your show(3).

Then my statement about about adding 23 is only adding 3 strokes to mine.

And like Jack I like your applied logic in using : if 0+$[4] $k=5 $m=$m/$[4] endif
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77180 - 2003-10-20 04:53 PM Re: KiXgolf - PxMagic: Part II
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Jooel & Howard,

You guys are amazing. I thought I had seen most of the tricks for compressing kixtart but between you two you must have found about a dozen that I had never seen in our previous kixgolf matches. You guys must never sleep or if you do you dream kixtart. [Big Grin]

Joel,

Thanks for the explanation. You also you are correct about cropping. I believe that the last line or 2 of pixels in the images "columns" & "Blackbuck" are cropped by the default box size. Also, I think that both the kixform & picturebox objects have beveled edges of 2 pixels width & the beveled edges crop the boxes by 4 extra pixels. Thus I believe the true dimensions of the minimum box is $a.ClientSize = 4+$[2],4+$[3].

PS: When I first started participating in kixgolf, I like Jooel felt players were cheating but after thinking about it I realized the problem was the mindset that I brought to the game. The problem is that I have spent my whole life learning "good" programming techniques & kixgolf forced me & the rest of the players to sometimes disregard this experience. It is kind of like playing give-a-way chess. Every move you make grates on your nerves & feels wrong. The point of this monologue is that I don’t think Howard was cheating. We need to distinguish between breaking “good programming” rules & breaking Jens rules. In Kixgolf the only rules are Jens rules. One of the reason both of you are so successful at kixgolf is your ability to think outside the rules. So how about we leave the penalty calls to the ref.
[Smile] [Wink]
_________________________
Jack

Top
#77181 - 2003-10-20 05:17 PM Re: KiXgolf - PxMagic: Part II
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
BTW, here is the code I was using. It's interesting to see how similar the Read UDFs were...

code:
KiXtart
KiXtart Version = 4.21
KiXforms Version = 2.3.0.42
KiXGolf Script = kixgolf_pxmagic.kix

Computer
OS = Windows 2000 Professional
CPU = Mobile Intel(R) Pentium(R) 4 - M CPU 2.00GHz
Speed = 1998 MHz
Memory = 254 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: PxMagic - Read & Display PxM Images
Processing Start = 2003/10/17 16:50:24.372
Processing End = 2003/10/17 16:50:33.415
Duration = 0000/00/00 00:00:09.042
# Images = 2
KiXGolf Score PxMagic = 86
KiXGolf Score PxMRead = 169
KiXGolf Score PxMDisplay = 293
KiXGolf Score Total = 548

Thank you for participating in KiXtart Golf!



; begin PxMagic
;
;!
Function PxMagic($)
 $=Split(PxMRead($))
 PxMDisplay(Iif($[0]=P1,3,4),$,&FFFFFF)
EndFunction
;!
;!
; end PxMagix





; begin PxMRead
;
;!
Function PxMRead($)
 $=Open(1,$$=' '
 Do $=$+Join(Split(Split(ReadLine(1),#)[0],'    '))+' ' Until @ERROR
 For Each $ in Split($If $ $PxMRead=$PxMRead+$+' ' EndIf Next
 $=Close(1)
EndFunction
;!
;!
; end PxMRead





; begin PxMDisplay
;
;!
Function PxMDisplay($b,$,$w)
    Dim $f,$x,$y,$a,$c,$d
   
    $f=CreateObject(kixtart.form)
    ;$f.ClientSize = $[1],$[2]
    $f.Show
   
    For $a = $b to ubound($)-1
        $d=$[$a]
        If $x=$[1$x=0 $y=$y+1 EndIf
        $c=Iif($d=0,$w,0)
        If $b=4 $c=Iif($d=0,$w,$f.RGB($d,$d,$d)) EndIf
        If $[0]=P3 $c=$f.RGB($d,$[$a+1],$[$a+2]) $a=$a+2 EndIf
       
        $f.PSet($x,$y,$c)
        $x=$x+1
    Next

    Sleep 10

EndFunction
;!
;!
; end PxMDisplay


Top
#77182 - 2003-10-21 12:06 AM Re: KiXgolf - PxMagic: Part II
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Wow,

now this is playing golf... Learned some things here. Sad to say this game was too hard for me [Frown]

Job well done guys...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#77183 - 2003-10-21 02:06 PM Re: KiXgolf - PxMagic: Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
I might later post that long code of mine which used multidimmed arrays and stuff, like hoby at some point asked.

now what comes to rules, when I shouted about those, I was something called drunk.
anyways, shouting aside, IIRC, console-output has been always disliked in golf, no?
if I'm wrong, I'm wrong.

anyway, this brings us back to the base. there might be more than jens doing the rule-sets and such as one mind can't think of everything 2 minds can.
heh, like in the first topic we saw about dozen questions what is allowed and what is not.
never ever it occured to me to ask 2 tricks from hoby are they allowed or not as I just thought they weren't.

now, isn't anyone anymore shrinking the code?
see there is lot of potential...
_________________________
!

download KiXnet

Top
#77184 - 2003-10-21 02:12 PM Re: KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I may have time this weekend, Lonkero. Very busy at work and with activities in the evening this week.

I am just astounded at all the places where quotes are NOT needed and the code still works. With competition like you, one has to pull out all the stops in order to keep ahead of you and keep you wondering. Now that the cat is out out-of-the-bag, it will be hard for me to beat you, but I will give it a try sometime before the cutoff date.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77185 - 2003-10-21 02:15 PM Re: KiXgolf - PxMagic: Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I would really like to be able to compete with Regular expresssions once, but those long class names are killers. Maybe a special scoring match sometime where CreatObject("zzz") counts as 1 regardless of the string inside.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 191 anonymous users online.
Newest Members
thequeen, ameliaryan, shalomsalami, dkdssdk, Vroon
17639 Registered Users

Generated in 0.04 seconds in which 0.011 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