|
|
|||||||
============= 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: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.Function MOAN($IP, $NetworkID, $SubnetMask) ============= 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)
======== 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 =============
======== 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 a score of 45.for $b=0 to ubound($a) Another solution is: code:for a score of 53.DO 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 ] |
||||||||
|
|
|||||||
Jens, just to be clear... quote:Does this prohibit the use of COM? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
came back home... seems like I have to study some network stuff as this is like hebrew to me. |
||||||||
|
|
|||||||
You can always take a peek at the existing network UDFs. |
||||||||
|
|
|||||||
have tried that before can't understand even one line they include |
||||||||
|
|
|||||||
If Lonk can't understand, then I have a chance [ 23. May 2003, 23:46: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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:have hard time understanding the subnet mask thing as I'm not network admin... just a damn coder |
||||||||
|
|
|||||||
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... |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 ] |
||||||||
|
|
|||||||
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) |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 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)... |
||||||||
|
|
|||||||
Chris: I stand by my statement, there is no math involved, just bit-manipulations |
||||||||
|
|
|||||||
Jens, would your terminology be a little clearer if you changed the input term "Subnet" to "Subnet Mask" or just "Mask"? |
||||||||
|
|
|||||||
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: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.IP 192. 10.128. 55 [ 24. May 2003, 23:19: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Jens, PM for you. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
The spaces in Jens example are most likely so that @IPaddressx could be used. You will need to ignore/remove them for calculations. |
||||||||
|
|
|||||||
hoby, I'm not sure about to whom you answered. spaces have nothing to do with difficulty. if you were answering to me, I said that jens' answer is quite different than the one that common-sense gives. wonder if this is the normal way in networking... |
||||||||
|
|
|||||||
I must have misunderstood your spaces statement. A couple errors exist. I have PM'ed Jens regarding a coding issue and Test #3. |
||||||||
|
|
|||||||
Lonkero is right IP 192.010.128.055 SubnetMask 255.255.255.000 Network ID Should be: NetworkID 192.010.128.000 Easy conversion into binary. 3rd Otect on Subnet Mask 128,64,32,16,8,4,2,1 1,1,1,1,1,1,1,1 Network ID 1,0,0,0,0,0,0,0 = 128 Now say the 4th Octec of the Subnet Mask was 128 1 ,0 ,0 ,0 ,0,0,0,0 Network ID would be. 0 ,1 ,1 ,1 ,1,1,1,1 = 127 You should start SuperNetting the Network Address, and that would make it fun. Rich [ 24. May 2003, 23:00: Message edited by: Richard Farthing ] |
||||||||
|
|
|||||||
I'll double-check my test file for correct results tomorrow morning. I corrected the example in my last post. I have to run now, got tickets for The Matrix: Reloaded! |
||||||||
|
|
|||||||
I would NOT claim this is OFFICIAL yet since I had to alter your code and test file. I will post the results again once you look at the issues I raised and post new test code. If you find I made the mistakes then I will retract this post. code:KiXtart Golf Score code:KiXtart Golf Score code:KiXGolf Scoring Engine code:KiXtart Golf Score [ 25. May 2003, 06:18: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
k, have read that cramsession talk and it confused the heck out of me. damn, the talker must have been drunk when he wrote it as there is no red line anywhere. still don't know (as asked about 30 hours ago) how to calc subnet when input is netID and IP. still searching for some teaching article... |
||||||||
|
|
|||||||
Lonkero, take a look at this article by Cisco: http://www.cisco.com/warp/public/701/3.html |
||||||||
|
|
|||||||
Howard: I got your PM and will implement them. However, I won't be able to post then corrected scoring part until about 1pm EST due to some other committments. The corrections look fine, however, and I'm sorry that I misused you guys as "beta-testers". Should have spend more time on the scoring engine instead of developing my own solution |
||||||||
|
|
|||||||
I found it to be part of the fun. |
||||||||
|
|
|||||||
mmm... jens, your prototype looks ok but what I must ask is... doh, as the input is optional, should the arguments be declared as "optional" or do we expect that it's called with "" or 0 if not input? |
||||||||
|
|
|||||||
Jooel: Though some of the inputs might be optional for the purpose of this tournament the inputs will be provided nonetheless as empty strings. Everybody: I've updated the test script and corrected one mistake in test 3, as I provided an incorrect NetworkID. The updated package can be downloaded at http://people.bu.edu/jenmeyer/kixtart/kixgolf_moan.zip Kudos to Howard who found the mistakes. It should all work now. I also added a clarification with regards to the use of /31 subnets. Though RFC3021 allows /31 networks (two IP addresses where the network/broadcast addresses are used as regular IP addresses), they are not considered valiud IP addresses with regards to this tournament. Thus, a /31 network only consistes of a Network ID and a broadcast address but no usable IP addresses. However, I do not see this as a shortcoming as the /31 is a special case that should only happen in very controlled network environments. |
||||||||
|
|
|||||||
Official with the latest Jen's code code:KiXtart |
||||||||
|
|
|||||||
mm... what about this (think I asked it already on the first page)... I quess I somehow understand the calculation already, but. quote:is that like we can return the masks in the format we prefer? |
||||||||
|
|
|||||||
hehee... was already getting mad as my answer was said to be incorrect... but your new check-code proved the old wrong k, now have only about half of the code to code and am under 1500 strokes still! |
||||||||
|
|
|||||||
update. am I correct when I say that there is no check code of calculating the possible subnets? |
||||||||
|
|
|||||||
Yes you are correct that that case is not checked so I commented out my code for that option(rightly or wrongly). |
||||||||
|
|
|||||||
k, then next question. is is possible to have networkID of 0.0.0.0? |
||||||||
|
|
|||||||
KiXGolf Score = 774 |
||||||||
|
|
|||||||
The sorting order for all outputs is covered quote:This would also apply to network IDs and subnet masks. |
||||||||
|
|
|||||||
code:KiXtart Golf Score |
||||||||
|
|
|||||||
IM-ing with Jooel right now, he's a little bit frustrated. Nice score, Howard. |
||||||||
|
|
|||||||
k, as you hoby got that working... maybe you could make your kixgolf-counter close the file damn, hate to have the udf-file locked up |
||||||||
|
|
|||||||
jens? sleeping? should the UDF be able to calculate class-A subnets? getting little fuzzy when going beyond string length limit... |
||||||||
|
|
|||||||
ping pong! have doubled my code size with this. |
||||||||
|
|
|||||||
k, think I got myself around this. well, at least found a way to save some strokes... |
||||||||
|
|
|||||||
code:KiXtart Golf Score [ 26. May 2003, 05:20: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
k, as got no answer... this udf works only with class-c thus it also passes the tests code:KiXtart |
||||||||
|
|
|||||||
Great going Joeel. My first score was 1460. It looks like you might be on your way to catching me. Current:KiXGolf Score = 667 |
||||||||
|
|
|||||||
well, as the rules are rather "undefined" here can't celebrate too much. and as there is no check for that one case, can't know for sure that my UDF is bulletproof. and as can't know, can't really start reducing the score as it's messy enough now too to start changing if needed (rules clarified) [edit] btw hoby, how come your sig says that you use 4.12 and golf summary says 4.21? time to update the signature maybe? [ 26. May 2003, 14:32: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I have many versions on my computer that I use for testing. Version 4.02 is what I use in production at work. And 4.21 is what I using for the current KixGolf outing. And you distributed WKix32 (version 4.12) with the version of bbChecker I am using...hence the 4.12 in my signature line. [ 26. May 2003, 16:23: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
and once again it comes back to historical bbChecker |
||||||||
|
|
|||||||
Jooel: A Class-A network is definitely overkill with regards to testing in case of returning the valid IPs. However, testing whether an IP address is part of a Class-A network should not create any problem. Also, I do not test for every possible return, thus you definitely won't have me check whether it atually returns all 32000+ possible IP addresses for a 255.255.0.0 subnet, but your code should be able to handle it, anyway. I can always decide later on to add some tests to it |
||||||||
|
|
|||||||
It is getting harder to reduce the number of strokes. Without some structure change I think I am getting close to the end. code:KiXtart |
||||||||
|
|
|||||||
Nice Challenge!!! And usefull too. Crunching my brains over it... Will first read tutorials like Lonk did WIll report back later... |
||||||||
|
|
|||||||
Folks: After talking with Jooel, I'd like to clarify one thing. Following is a quote from IM: quote: |
||||||||
|
|
|||||||
What about the section about return an array of masks for a given IP and networkID? No test...do we need to code it to pass? If no, I like my 661...If yes, well crap. |
||||||||
|
|
|||||||
Yes, you do need to code it as it is a requirement. Just because I'm currently not testing for it, doesn't mean you can just drop that part. Jooel already requested additional tests. |
||||||||
|
|
|||||||
My post to date are then NULL and void because the code does not satisfy the requirements. Back the coding I guess. |
||||||||
|
|
|||||||
I've added two more tests to the KiXgolf validation. They will test the case where potential subnet masks need to be returned and accepts both octet- and CIDR-style subnet masks as potential answers. Download the updated package here: http://people.bu.edu/jenmeyer/kixtart/kixgolf_moan.zip |
||||||||
|
|
|||||||
yeah, now we are talking: quote:rock'n roll! quess we are all back to square 6? |
||||||||
|
|
|||||||
But I added only tow new tests? And you show three failing, thus you still had some work to do even before I added the two additional tests [ 27. May 2003, 21:17: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Jens, I think you missed a subnet mask that makes TEST #8 true. 255.255.254.0 (/23) is also valid from what my code says. If you agree, then I have working code again. code:IP Address = 10.10.10.2 code:KiXtart [ 27. May 2003, 03:37: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Could we have a test for a subnetted class B too??? |
||||||||
|
|
|||||||
hoby, I started thinking the same thing... then I came to the conclusion that there is actually more. and then decided to go to bed why 255.255.252.0 would not be ok, dunno... maybe there is this thing that 10 (as starting address) is impossible. |
||||||||
|
|
|||||||
(10 & 252) equals 8 not 10 so 255.255.252.0 does not work as it changes the NetworkID. I checked all possible subet mask values from at 8 bits to 31 bits and only the ones I list seem to be valid. [ 27. May 2003, 13:09: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Hey! Time for a rollcall. Who is working on this KiXgolf problem beside Lonkero and me? We seem to be the only takers here. |
||||||||
|
|
|||||||
Me am Playing Golf too!!! Damn those class A/B subnets. Can't get the subnetmask/ip-addresses to work... Score for determining in-IPrange & NetWorkID = 530 |
||||||||
|
|
|||||||
Need an example / result list of determining the possible subnets for a class A/B subnet... Anyone??? |
||||||||
|
|
|||||||
pat, that's about the score I had there too hoby, I must wonder... if jens disabled that one as that 254 has only broadcast and network-id and thus the IP can't be there. damn, this goes tricky... too tricky. like jens already pointed out, my code broke more when tried to get this piece to work. I think I'm gonna do total re-write... at least try as that method I figured when woke up and in the buss... it seems like zillion times shorter... can't know though... |
||||||||
|
|
|||||||
pat, I could write you a code that generates them but that would be too big part of the golf-solution |
||||||||
|
|
|||||||
K, do NOT send!!! Spoils the fun |
||||||||
|
|
|||||||
Howard, your calculations are correct. IP address 10.10.10.2 and mask 255.255.254.0 would give you: Subnet address: 10.10.10.0 Broadcast address: 10.10.11.255 All addresses in between are valid IP addresses, including 10.10.10.255 and 10.10.11.0 Jens, one question occurs to me. I can't see in the instructions where you are limiting the scope of the masks, so for a network of "10.10.10.0" you could apply a netmask of "10.10.10.255", which would be valid and give you a range of 168,430,336 potential addresses. I assume that you are only using masks with contiguous bits. |
||||||||
|
|
|||||||
I assumed continous valid subnet mask of 8 through 31 bits starting from the high order side (progressing from left to right). [ 27. May 2003, 16:27: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Just to make it official, test 8 does have 255.255.254.0 or /23 as correct solution. I've updated the .INI file accordingly. Download the package at http://people.bu.edu/jenmeyer/kixtart/kixgolf_moan.zip quote:Yes, that's correct. I believe you actually have to use contiguous bits as this is how CIDR is defined. See for example http://www.cisco.com/warp/public/701/3.html#cidr I've also covered the 255.255.255.254 or /31 case where you only have two IP addresses, namely the network ID and the broadcast address. Quote from the rules in the Input&Output section: quote: [ 27. May 2003, 21:40: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
although, both cases can make the logic harder or easier, depending of the logic used. |
||||||||
|
|
|||||||
code:KiXtart |
||||||||
|
|
|||||||
Ok Pat. Why are we not hearing anything from you? |
||||||||
|
|
|||||||
Rumble Flumble Stumble Am here... Digging into my TCP/IP documentation. Discovered my approach is a nogo for the subnets/ip-addresses... Must make redesign |
||||||||
|
|
|||||||
alright! good to hear that I'm not only mixing ideas and codes think I need to do something to my script as only the isinsubnet-part (all parameters provided) is ready and it already has: Duration = 0000/00/00 01:49:34.804 |
||||||||
|
|
|||||||
Hmmm... That part is a bit faster in my version: code:KiXtart |
||||||||
|
|
|||||||
quote:Just wanted to clarify, as the rules stated that "old style 4 octet" representation was acceptable, which of course allows for non-contiguous bit masks. [ 28. May 2003, 09:30: Message edited by: Richard H. ] |
||||||||
|
|
|||||||
Pat, you must be using the same approach I did to have that speed. Lonk likes brute force so that he can take a cat nap while testing. Just as long as you add 330 strokes to get the last tests complete I'll be happy. [ 28. May 2003, 12:56: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
Scribbling on paper now... Got a new approach... 330 strokes??? Hmmm... Guess it will be more |
||||||||
|
|
|||||||
paper could be smart... I added some logic to mine to make it more speedy. well, it seems to take even more time... it was like 2hours and now seems to be 3hours. |
||||||||
|
|
|||||||
Richard: Yes, four-octet representation is allowed, too. I've checked RFC950, which defines subnet masks. It does state quote:However, I have yet to see a non-contigous subnetmask used at all, I can't even find examples or why it sould/should not be used. See http://rfc.net/rfc950.html for details. Thus, with regards to this KiXgolf subnet masks will consist of contiguous bits. |
||||||||
|
|
|||||||
Thank you thank you!! \ Richard, you trying to give me an ulcer? |
||||||||
|
|
|||||||
Heh heh I dimly recall a theoretical use for non contiguous netmasks for improving routing solutions, but to be honest I don't know of any installation in practice. I think that most modern routing protocols abhor them too. Jus' playin' Devils Advocate. ];/p |
||||||||
|
|
|||||||
Now that you've confessed to be very familiar with subnetting, I do have to ask: Where's your KiXgolf code? |
||||||||
|
|
|||||||
Sadly due to timezones and public holidays I didn't get to see the challenge 'till yesterday, and workload means I won't get an opportunity to participate. Besides, it's far more fun worrying Howard. |
||||||||
|
|
|||||||
This is making me nervous. Am I the only one with working code? Or is someone out there sitting with code and a better score waiting for Friday to post it? |
||||||||
|
|
|||||||
Joeel has code but his take 3 hours to complete, thus he can only change one thing and has to wait another three hours to see whether it works. |
||||||||
|
|
|||||||
why shouldn't it work jens is right but will see... have my drinks later on so will have such a burst in brainpower that might have awesome score today... problem is that subnetmask of 254 makes problems with my new method. so will probably end up with even longer code than the one before had. |
||||||||
|
|
|||||||
No working code yet... Still fighting with IP's and subnets... |
||||||||
|
|
|||||||
Come on guys, you are starting to make my head swell. No competition it seems. [ 28. May 2003, 20:38: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
I'm still unable to compete. I can make up a code but once it goes over 1000 I rather skip it. |
||||||||
|
|
|||||||
I'd compete, but I started getting migranes looking at this crap on Saturday. [ 28. May 2003, 23:41: Message edited by: Chris S. ] |
||||||||
|
|
|||||||
Come on guys, there's not even real math involved. |
||||||||
|
|
|||||||
Howard: I've started coding! 1500 strokes with no variable optimization and five correct tests. And to start getting some more people interested, here's an interesting way to generate a consecutive number of zeros or ones. In my case I was looking for a way to generate 32 consecutive 0s as a string. code:$zeros=substr(formatnumber(0,32),3) [ 29. May 2003, 03:30: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
Ahh, getting there, 1769 with 7 of 9 correct. Will work onthe last two tomorrow evening, just the IP address arrays left and then the cleanup. [ 29. May 2003, 04:58: Message edited by: sealeopard ] |
||||||||
|
|
|||||||
think that you guys started from different angle. I got 5/9 with just 300 strokes but getting more doubles it each time. I'm already at 800 and still have 6/9. looking to skipping this first round as don't want to keep making too much logic... doh, this is golf, not logical match |
||||||||
|
|
|||||||
Part of Golf is how to hit the ball to reach the target. I can tell you my approach, so far everything is being done with the binary representations of IP addresses. I just have the IP address array left to be coded but already have a rough idea how to solve that one. Then it's down to consolidating code fragments to make them shorter and reduce the number and length or variables. I also do not see anything complicated in there, a couple of binary ANDs and knowing what patterns to look for in a binary IP format. Just be aware that the second round is shortened and only goes from Friday afternoon to Wednesday afternoon. |
||||||||
|
|
|||||||
doh, I have everything coded in binary but still have problems in the logic. if I don't shorthen the variables, I have only 20 more strokes than my best shortened code. what comes to binary, kixtart has total lack of binary functioning thus it's all about number and string manipulation rather than kixtart usage. |
||||||||
|
|
|||||||
TODO: IPnumbers So Far I Got: code:KiXtart Golf Score |
||||||||
|
|
|||||||
Little bit if cheating IP section only works for C class for now... code:KiXtart |
||||||||
|
|
|||||||
code:I know, it's not stellar but I only spend about five hours of work on it and I haven't even started optimizing it. It does satisfy all conditions and should even be able to handle bogus data.KiXtart |
||||||||
|
|
|||||||
And the Golfers hit the fairway I decided to try to write another solution utilizing a different approach. We'll see what happens. |
||||||||
|
|
|||||||
code:I'm done for this round. There's no way I can still improve this score.KiXtart |
||||||||
|
|
|||||||
I decided to compine my methods into one udf. thus got a result of: code: |
||||||||
|
|
|||||||
The rules actually require a single UDF, one of the reasons I didn't look at coding as it makes the whole thing far more complicated and I knew I wouldn't get time to get a working result: quote: quote: |
||||||||
|
|
|||||||
not sure that this actually works but the it passes the tests and am happy about that code:KiXtart |
||||||||
|
|
|||||||
btw, if not sub udf's are allowed anymore, my score is false as have one. |
||||||||
|
|
|||||||
the question still remains... anyway, hoby, start coding: code:w00t...KiXtart quote: [ 30. May 2003, 12:34: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Now you do this when I have to go to work! There should be a rule against posting a better score when I have to go to work. Crap! |
||||||||
|
|
|||||||
are you at home already? quote:uhm, still found something... quote: [ 30. May 2003, 12:48: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I am not out of this yet! Just a little more to go code:KiXtart |
||||||||
|
|
|||||||
Howard, just sitting here and watch the course (as always ) How did you manage to get a result of '10 out of 10' while all others have '9 of 9' (or even SevenOfNine) |
||||||||
|
|
|||||||
SevenOfNine sure would be my preference...but I added a test for the hell of it. |
||||||||
|
|
|||||||
not sure... but if /31 is proper mask then also x.x.x.255 is proper ip. that brings me to: code:please do correct me if I'm wrong...KiXtart also did some fixing to this version otherwise would be lower (found a buggie) |
||||||||
|
|
|||||||
Argh...I can't keep up |
||||||||
|
|
|||||||
nnn.nnn.nnn.255 is NOT a proper IP as it is reserved for broadcasts ... well you could also argue about that |
||||||||
|
|
|||||||
jochen, that is the point. the current rules allow 31 as mask that allows ip to be: x.x.x.0 and x.x.x.255 btw hoby, even though my code works with current tests, it seems to have a problem with specific idiotic input... will see if I can correct that but mostlikely that raises the score (as always) so, don't loose your faith bro. |
||||||||
|
|
|||||||
I have to go to work. It look's like I can't get much more out of this code now and will lack time at work. Good job Lonkero. |
||||||||
|
|
|||||||
Me too am stuck. Think the Lonk did it again. Curious about his code Here's my latest: code:Note: Don't think this will pass cause only "C" ip number calculations functions.KiXtart Note 2: take a look at my duration... |
||||||||
|
|
|||||||
dudes, don't give up yet. I think the winning score will have some fight as there surely is situations when they don't meet the requirements. well, can't say for sure but know that my udf has pitfalls. like, I have double udf. as jens hasn't stated it more specifically I took it as it has been, multiple udf's are allowed if they just are scored too. |
||||||||
|
|
|||||||
quote: quote: quote: KiXGolf Result = passed (9 out of 9 correct) KiXGolf Score = 789 [ 30. May 2003, 15:16: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Okay, time for me to jump in and cite from the rules: quote:Thus, the first example is valid while the second example is not valid as code outside the MOAN UDF is being called code:;example 1 code:However, COM calls to components that are part of a standard Windows installation are allowed. That is covered in the rules, too.;example 2 I'm glad to see that we finally have some competition going on |
||||||||
|
|
|||||||
k, my all scores can be trashed. was just to post 785 but as the rules are what they are, I have no score and thus hoby is the leader. |
||||||||
|
|
|||||||
That part has always been in there right from when I originally posted the KiXgolf challenge. |
||||||||
|
|
|||||||
Got a new score: code:I've used my own updated .INI file which contaisn a couple of traps ;-) I've posted it below:KiXtart Golf Score code:;WARNING: Some lines are broken for readability purposes. Please unbreak before using. |
||||||||
|
|
|||||||
As there was a little confusion over the rules, I don't think this helper is out of order... There is a way of getting around the requirement for having a single function without adding too much to your code, providing you don't need more than two parameters: code:If you only have a single external function then a simple If/EndIf will suffice.Function Moan($a,$b,$c) |
||||||||
|
|
|||||||
sure, but coded it in already code:nah, let's make it not so:KiXtart code:KiXGolf Score = 806 [ 30. May 2003, 16:08: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
An EXECUTE() would work, too! |
||||||||
|
|
|||||||
jens, you have mistype there. test 12 has actually correct result of 0. anyway, gladly the 13 is not one of the tasks get overflow exception and if I would code around it, that would cause at least 10 strokes more. |
||||||||
|
|
|||||||
Should I post my code? |
||||||||
|
|
|||||||
Please post your codes here: KIXgolf: MOAN(), Part II |