Page 1 of 7 12345>Last »
Topic Options
#101334 - 2003-05-23 08:59 PM KiXgolf: MOAN - Mother Of All Networks
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
=============
The Challenge
=============


You are to create the Mother Of All Networks (MOAN) UDF. This UDF will provide certain network information depending on the parameters passed to it. The challenge will be run as a private coding challenge from Friday, May 23, 3pm EST to Friday, May 30, 3pm EST. A second public coding phase will start on Friday, May 30 and end on Wednesday, June 4, 3pm EST. The task is to generate the corresponding output based on the input of either two or three of the parameters IP Address, Network ID, and Subnet Mask. Specifics are provided in section "Inputs & Outputs".

A download is available at http://people.bu.edu/jenmeyer/kixtart/kixgolf_moan.zip

=============
Specification
=============


The Moan UDF has the following prototype
code:
Function MOAN($IP, $NetworkID, $SubnetMask)
EndFunction

All functionality of the UDF must be contained within the FUNCTION/ENDFUNCTION commands. You are not allowed to call code located outside the UDF. The subnet mask $SubnetMask can be either the traditional four-octets or the alternate CIDR number, e.g. 255.255.255.0 and 24. The parameters can contain up to two spaces between the decimal points and the number, e.g. 192.168.0.10 and 192.168.  0. 10 should be treated the same.

=============
Inputs & Outputs
=============

Assumtion: Network/broadcast addresses are not available as regular IP addresses though RFC3021 allows /31 networks (two IP addresses where the network/broadcast addresses are used as regular IP addresses)
  • Input: IP, NetworkID, Subnet Mask
    Output: 1 if the IP is a member of a nework defined by network ID and subnet mask, otherwise 0
  • Input: IP, NetworkID
    Output: Array of all potential subnet masks or empty string if no match
  • Input: IP, Subnet Mask
    Output: Network ID or empty string if no match
  • Input: NetworkID, Subnet Mask
    Output: Array of all potential IP addresses or empty string if no match
  • At least two input parameters must be provided
If the output consists of an array of IP addresses, then the IP addresses must be sorted in ascending order.
========
Example
=======

Input: IP=192.168.10.123,NetworkID=192.168.10.0,SubnetMask=255.255.255.192
Output: MOAN=1

Input: NetworkID=10.10.5.4,SubnetMask=255.255.255.252
Output: Moan[0]=10.10.5.5
Moan[1]=10.10.5.6

Input: IP=192.10.128.55, SubnetMask=27
Output: MOAN=192.10.128.32

=======
Scoring
=======


Your results will be compared with the solutions provided in the kixgolf_moan.ini. You must pass all tests in order to have a valid KiXgolf score.

=============
General rules
=============


  • The UDF must be written as one or more lines.
  • The UDF is expected to finish in a reasonable time, e.g. if it gets started when the challenge opens, it's expected to be finished by the time the challenge closes even on a somewhat slow computer. The UDF has to be valid during the period that the challenge runs.
  • You can submit scores as often as you want to until the deadline, no reason to wait until the last minute. In fact, other people want to see the score to beat. So don't be a spoilsport by hoarding your score. Submit early and often.
  • The UDF may only use the KiXtart commands/functions/macros, no other code fragments are allowed. COM-calls that are part part of a standard default Windows installation are allowed.
  • The UDF should be self-contained (except for any I/O mentioned in the challenge). In particular, you may not do things like fetching extra data from a remote site.
  • You may assume ASCII as character set.
  • You are not allowed to use additional code that is external to the MOAN UDF. All code must be contained within the MOAN UDF.
When posting KiXtart Golf Scores, please include the KIXGOLF_MOAN.TXT file that is created in the script directory. It contains some basic information about the computer that the script is run on.
========
Deadline
========


Private coding starts Friday, May 23, 3pm EST
Private coding ends Friday, May 30, 3pm EST
Public coding start Friday, May 30, 3pm EST
Public coding ends Wednesday, June 4, 3pm EST

============
Test program
============


A test program is provided to help screen entries and to provide the Golf Score.
Any program that passes the test program can be submitted. If you are surprised that your solution passed the test program, please submit it anyway! That will help me identify bugs in the test program.

================================================================
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 $b=0 to ubound($a)
if $a[$b]>0
$c=$c+1
endif
next

for a score of 45.

Another solution is:
code:
DO
$b=$b+1
if $a[$b]>0
$c=$c+1
endif
UNTIL $b>(UBOUND($a)+1)

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 Friday, 3pm EST (BBS+6 time)

2) Public coding phase: From Friday, 3pm EST (BBS+6 time) to the following Wednesday, 3pm EST (BBS+6 time)

3) Final results: Wednesday, 3pm EST (BBS+6 time)

You will need the complete package from http://people.bu.edu/jenmeyer/kixtart/kixgolf_moan.zip.

[ 25. May 2003, 18:58: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#101335 - 2003-05-23 09:10 PM Re: KiXgolf: MOAN - Mother Of All Networks
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Jens, just to be clear...
quote:
The UDF may only use the KiXtart commands/functions/macros, no other code fragments are allowed.
Does this prohibit the use of COM?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101336 - 2003-05-23 09:16 PM Re: KiXgolf: MOAN - Mother Of All Networks
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Yes, calls to external COM functions (if part of a standard Windows install) are allowed. However, you cannot use custom COM functions or other external programs that are not part of a standard Windows installation.
_________________________
There are two types of vessels, submarines and targets.

Top
#101337 - 2003-05-23 11:28 PM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
came back home...
seems like I have to study some network stuff as this is like hebrew to me.
_________________________
!

download KiXnet

Top
#101338 - 2003-05-23 11:40 PM Re: KiXgolf: MOAN - Mother Of All Networks
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
You can always take a peek at the existing network UDFs.
_________________________
There are two types of vessels, submarines and targets.

Top
#101339 - 2003-05-23 11:43 PM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
have tried that before [Big Grin]

can't understand even one line they include [Razz]
_________________________
!

download KiXnet

Top
#101340 - 2003-05-23 11:46 PM Re: KiXgolf: MOAN - Mother Of All Networks
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If Lonk can't understand, then I have a chance [Big Grin]

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

Top
#101341 - 2003-05-23 11:52 PM Re: KiXgolf: MOAN - Mother Of All Networks
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Jens, I thought you sais this one wouldn't include any math?

Well, looks like another outing where I won't even make the cut. [Wink]

Top
#101342 - 2003-05-23 11:54 PM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
doh, it was same thing with last golf and I didn't produce any competitive code in the first round...

so, will see.

anyway...

you have almost all cases in your examples, but...
is this correct:
quote:

Input: IP=10.10.5.4,NetworkID=10.10.5.5
Output:
Moan[0]=2
Moan[1]=255.255.255.5
...
Moan[250]=255.255.255.253

have hard time understanding the subnet mask thing as I'm not network admin...
just a damn coder [Wink]
_________________________
!

download KiXnet

Top
#101343 - 2003-05-24 12:04 AM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
to clarify my wonder, I have no clue how subnet is calculated.

I thought it had some logic but according to logic with input like:
Input: IP=192.10.128.55, Subnet=27

the output should be array...
_________________________
!

download KiXnet

Top
#101344 - 2003-05-24 12:16 AM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if someone else has trouble with this golf:
http://itresources.brainbuzz.com/techlibrary/gethtml.asp?ID=520

it's pretty simple explanation and easiest I found.
still have no understanding about the logic of the calculation and thus decide to leave this golf round...

at least for now.
_________________________
!

download KiXnet

Top
#101345 - 2003-05-24 12:38 AM Re: KiXgolf: MOAN - Mother Of All Networks
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Lonk. Come on... Read CalcLogicalSubnet()

You break the address into octets (4 x 1 byte (4 sets of 8 bits))
1.2.3.4 =
1
2
3
4

Subnet mask is 255.255.255.0
255
255
255
0

Now logical bitwise operations on each octet pair
1&255 = 1
2&255 = 2
3&255 = 3
4&0 = 0

[ 24. May 2003, 00:39: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101346 - 2003-05-24 12:44 AM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and the result is?
mm...
is it like not match as the last is 0?

does this mean...
no, it just means that we will on next friday.

have a good week.
(just like on last course)
_________________________
!

download KiXnet

Top
#101347 - 2003-05-24 12:51 AM Re: KiXgolf: MOAN - Mother Of All Networks
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The logical subnet is 1.2.3.0

The ip address 1.2.3.4 is on logical subnet 1.2.3.0

if the mask was 255.255.255.128

Ip 1.2.3.4 is on subnet 1.2.3.0

IP 1.2.3.150 is on subnet 1.2.3.128

just bitwise and each number together 1&255, 2&255, 3&255, 150&128
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101348 - 2003-05-24 01:18 AM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, may think this over tomorrow.
tonight, seems that have no clue still...
so maybe after 1 slept night have some idea what is going and can start thinking how the code design will look...

anyway, you know that you will meet your enemy in the second round, so just code and keep on praying that you yourself know what you are doing [Big Grin]

btw, wonder where the old golf-fanatics are...

like, haven't heard anything about them except that they are expecting the golf (just they did with the previous one)...
_________________________
!

download KiXnet

Top
#101349 - 2003-05-24 03:19 PM Re: KiXgolf: MOAN - Mother Of All Networks
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Chris: I stand by my statement, there is no math involved, just bit-manipulations [Big Grin]
_________________________
There are two types of vessels, submarines and targets.

Top
#101350 - 2003-05-24 03:41 PM Re: KiXgolf: MOAN - Mother Of All Networks
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Jens, would your terminology be a little clearer if you changed the input term "Subnet" to "Subnet Mask" or just "Mask"?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101351 - 2003-05-24 06:32 PM Re: KiXgolf: MOAN - Mother Of All Networks
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Howard: Thanks for the suggestion, I will change the terms to Subnet Mask. The ZIP package and the first post in this thread have now been updated to reference Subnet Masks.

Jooel: It all comes down to simple AND/OR binary calculations. Your Example:
code:
    IP         192. 10.128. 55
AND
SubnetMask 255.255.255. 0
=
NetworkID 192. 10.128. 0

See for example http://www.telusplanet.net/public/sparkman/netcalc.htm which allows to to enter IP addresses, network IDs, and subnet masks and then explains the results.

[ 24. May 2003, 23:19: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#101352 - 2003-05-24 09:06 PM Re: KiXgolf: MOAN - Mother Of All Networks
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Jens, PM for you.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#101353 - 2003-05-24 09:30 PM Re: KiXgolf: MOAN - Mother Of All Networks
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, that calculator gave different result than you.

neither your example did have nothing to my question.
my question was what if network was this and IP that.
well, maybe you skipped it because hoby explained it...

but anyway, your result: NetworkID 192. 10.255. 0

is quite different from: NetworkID 192.10.128.0
_________________________
!

download KiXnet

Top
Page 1 of 7 12345>Last »


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

Who's Online
0 registered and 255 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.078 seconds in which 0.027 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