Page 3 of 5 <12345>
Topic Options
#101713 - 2003-06-02 04:45 AM Re: KIXgolf: MOAN(), Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Your turn Lonkero [Razz]
code:
KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/01 22:51:10.972
Processing End = 2003/06/01 22:51:11.072
Duration = 0000/00/00 00:00:00.100
# Loops = 1
KiXGolf Result = passed (10 out of 10 correct)
KiXGolf Score = 697

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=iif($>8,$-8,0)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$="..."
$=split($c+$d+IIF($b,$b,$)+$d+IIF($a,$a,$),$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+$[$e+8])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=IIF($d+join(split($b),"")=$c,1,0)
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101714 - 2003-06-02 10:12 AM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
my turn?
sure I'll do my job.
and now it's your turn [Big Grin]
quote:
KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 11:18:51.899
Processing End = 2003/06/02 11:18:52.249
Duration = 0000/00/00 00:00:00.350
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 690

Thank you for participating in KiXtart Golf!

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=iif($>8,$-8,0)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$="..."
$=split($c+$d+IIF($b,$b,$),$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=IIF($d+join(split($b),"")=$c,1,0)
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101715 - 2003-06-02 10:19 AM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quote:
KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 11:26:32.060
Processing End = 2003/06/02 11:26:32.411
Duration = 0000/00/00 00:00:00.351
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 679

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=iif($>8,$-8,0)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b+"...",$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=IIF($d+join(split($b),"")=$c,1,0)
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101716 - 2003-06-02 10:23 AM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
should I continue?

KiXGolf Score = 673

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=iif($>8,$-8,0)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=IIF($d+join(split($b),"")=$c,1,0)
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101717 - 2003-06-02 01:07 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehee!
check this score [Wink]
quote:

KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_moan.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium II
Speed = 398 MHz
Memory = 320 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 14:13:39.289
Processing End = 2003/06/02 14:13:39.649
Duration = 0000/00/00 00:00:00.360
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 666

Thank you for participating in KiXtart Golf!

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=iif($>8,$-8,0)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=($d+join(split($b),"")=$c)
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101718 - 2003-06-02 01:10 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
got rid of that number: 663
code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=($>8)*($-8)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=($d+join(split($b),"")=$c)
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101719 - 2003-06-02 01:11 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quote:
KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_moan.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium II
Speed = 398 MHz
Memory = 320 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 14:29:22.465
Processing End = 2003/06/02 14:29:22.805
Duration = 0000/00/00 00:00:00.340
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 661

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=($>8)*($-8)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=$d+join(split($b),"")=$c
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif
$moan=iif(len($c)>1,split(substr($c,2)),$c)
EndFunction
;!
;!
; end MOAN



[ 02. June 2003, 13:22: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#101720 - 2003-06-02 01:30 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
660
code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=($>8)*($-8)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
if $a
;Calculate NetworkID using $ array
$c=""
for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=$d+join(split($b),"")=$c
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$a = $a+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
$c=$a
endif
endif $=$c,split(substr($c,2))
$moan=$[len($c)>1]
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101721 - 2003-06-02 01:41 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and still have some work-time left...
quote:

KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_moan.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium II
Speed = 398 MHz
Memory = 320 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 14:47:28.406
Processing End = 2003/06/02 14:47:28.757
Duration = 0000/00/00 00:00:00.350
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 657

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=($>8)*($-8)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
$c=""
;Calculate NetworkID using $ array
for $e=0 to 3
if $a
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
else
$[$e]=255 + $[$e+4] - $[$e]
endif
next
if $a
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=$d+join(split($b),"")=$c
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to $[0]
for $h=$[5] to $[1]
for $e=$[6] to $[2]
for $f=1+$[7] to $[3]-1
$c = $c+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
endif
endif $=$c,split(substr($c,2))
$moan=$[len($c)>1]
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101722 - 2003-06-02 01:43 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quote:
KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_moan.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium II
Speed = 398 MHz
Memory = 320 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 14:50:01.957
Processing End = 2003/06/02 14:50:02.308
Duration = 0000/00/00 00:00:00.350
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 655

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$f,$g,$h,$m[3]
$d="."

;Build Subnet Mask
$f=0,128,192,224,240,248,252,254
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$m[$g]=iif($/8,255,$f[$ mod 8])
$=($>8)*($-8)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
$c=""
if $a
;Calculate NetworkID using $ array

for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=$d+join(split($b),"")=$c
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $f=1+$[7] to 254 + $[7] - $[3]
$c = $c+" "+$b+$d+$h+$d+$e+$d+$f
next
next
next
next
endif
endif $=$c,split(substr($c,2))
$moan=$[len($c)>1]
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101723 - 2003-06-02 02:15 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quote:
KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_moan.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium II
Speed = 398 MHz
Memory = 320 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: MOAN - Mother Of All Networks
Processing Start = 2003/06/02 15:22:48.305
Processing End = 2003/06/02 15:22:48.695
Duration = 0000/00/00 00:00:00.389
# Loops = 1
KiXGolf Result = passed (9 out of 9 correct)
KiXGolf Score = 652

code:
; begin MOAN
;
;!
Function moan($a,$b,$c)
Dim $,$d,$e,$g,$h,$m[3]

;Build Subnet Mask
for $e=8 to 31
$=$e
$h=1
for $g=0 to 3
$d=0,128,192,224,240,248,252,254
$m[$g]=iif($/8,255,$d[$ mod 8])
$d="."
$=($>8)*($-8)
if $a & $b
$h=$h & split($b,$d)[$g]=(0+split($a,$d)[$g] & $m[$g])
endif
next
if $h
$c=$c+" /"+$e
endif
if $e=$c
$c=join($m,$d)
endif
next
;End build mask array
if instr($c,$d)
;build array of input values by splitting a string. Then convert to integers
; Mask = $[0..3] NetID = $[4..7] IPaddr = $[8..11]
$=split($c+$d+$b,$d)
$c=""
if $a
;Calculate NetworkID using $ array

for $e=0 to 3
$c=$c+$d+(0+$[$e] & 0+split($a,$d)[$e])
next
if $d+join(split($a),"")=$c
$c=""
endif

;Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
;Input NetworkID = Calculated NetworkID
if $b
$c=$d+join(split($b),"")=$c
endif
else
;Output: Network ID or empty string if no match
;Output: Array of all potential IP addresses or empty string if no match
for $b=$[4] to 255 + $[4] - $[0]
for $h=$[5] to 255 + $[5] - $[1]
for $e=$[6] to 255 + $[6] - $[2]
for $a=1+$[7] to 254 + $[7] - $[3]
$c = $c+" "+$b+$d+$h+$d+$e+$d+$a
next
next
next
next
endif
endif $=$c,split(substr($c,2))
$moan=$[len($c)>1]
EndFunction
;!
;!
; end MOAN

_________________________
!

download KiXnet

Top
#101724 - 2003-06-02 02:50 PM Re: KIXgolf: MOAN(), Part II
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Quick remark. The MOAN code will NOT work for subnet masks like 255.0.0.0 if provided as /8, thus it would fail a test like this:

MOAN('126.0.0.1','126.0.0.0/8')
_________________________
There are two types of vessels, submarines and targets.

Top
#101725 - 2003-06-02 03:02 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you are right.
also, the output of subnet masks with slash in them does not fit to the moan idea.
the output should be like the input.
_________________________
!

download KiXnet

Top
#101726 - 2003-06-02 03:13 PM Re: KIXgolf: MOAN(), Part II
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
My mistake, I meant MOAN('126.0.0.1','126.0.0.0',8). I started using Howards CIDR-conversion code in a new UDF that I'm writing and I noticed that subnetmasks of 0-8 will not resolve correctly. It actually was an easy fix but has a 3-stroke penalty.
_________________________
There are two types of vessels, submarines and targets.

Top
#101727 - 2003-06-02 03:27 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, the 8 was hardcoded in his code right from the start...
but wonder who thought that this golf should work on greater space than a-class...
_________________________
!

download KiXnet

Top
#101728 - 2003-06-02 04:17 PM Re: KIXgolf: MOAN(), Part II
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I did not say that it IS limited to /9 and higher [Wink] . Thus, technically, it will have to cover the /0 to /8 range, too.
_________________________
There are two types of vessels, submarines and targets.

Top
#101729 - 2003-06-02 04:54 PM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, I surely asked it during first period.

and the current code is limited to 8 and higher [Wink]

so, if it fails that, there is something weird and it needs to be tested...

[ 02. June 2003, 16:55: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#101730 - 2003-06-02 06:02 PM Re: KIXgolf: MOAN(), Part II
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Well, it looks like I will have to seriously review the current state of things when I get to the hotel this evening. [Eek!]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101731 - 2003-06-02 06:12 PM Re: KIXgolf: MOAN(), Part II
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
My compliments to Jooel and Howard!! You guys are really quick... I give up...

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
#101732 - 2003-06-03 10:25 AM Re: KIXgolf: MOAN(), Part II
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now I'm starting to be scared.
it's wednesday tomorrow...

hoby, if you got better code, post it already... [Eek!]
_________________________
!

download KiXnet

Top
Page 3 of 5 <12345>


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.118 seconds in which 0.071 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