|
|
|||||||
================================= The Challenge - The Magician 11-16 ================================= This challenge is based on a Self Working Card trick. The magic trick would be performed as follows: The magician would take a deck of 52 cards and ask the subject(s) to shuffle the deck. Then the magician takes the deck back and silently starts flipping cards faceup on the table, making what looks to be random piles of cards. Once all the piles are created, the magician turns all the decks face down. He asks the subject to pick any 3 piles. At this point the magician collects all the other piles and puts them into a single pile. Again, he starts making a pile of cards, when he reaches a certain card he says... "OH!, I see! Tricky!" And then the magician continues laying cards on the pile. Once he's done he says, "Now then, despite your best efforts to fool me, I have figured out the value of the top three cards in your stacks. The value is ##." At this point the subject turns over the top card in each stack, and those three cards equal what the magician said. Poof Magic! In addition to being a kixgolf course, this is also a proof. You must solve both the Subject side and the Magicians side and compare those two number before supplying the function value. This means, you must a have section that does the following, or a golfed version of it. Code: ;$a=magician score, $b=subject score if $a=$b $function=$a else $function=0 endif There is no time that this shouldn't work, so if you ever have a 0 result, you know you have something going wrong with your code. I will make an effort to remind you about this requirement throughout the duration of the private round. The card trick is performed by doing the following: Use the following rules for the cards: Number cards are face value, Face Cards are 10, and Aces are 1 Flip the first card over. Silently start placing cards on the pile to add enough cards to make a pile worth 11 Pile #1: So if a 8 flips, Count 8, and add 3 more cards (9,10,11). Four cards total. Take the stack you just created and flip them over. So the 8 is now on top. Pile #2: If on the next pile a K shows first (count 10), add one more card (11). Two cards total. Flip the stack, now the K is on top. Pile #3: If on the next pile a A shows first (count 1), add 10 cards (2,3,4,5,6,7,8,9,10,11). Eleven cards total. Flip Stack, A now on top. Pile #N: Repeat making piles until there is either a last pile of 11, or if it does not equal 11, set those cards aside (but use them later) Ask your subject to select any 3 piles. Leave those piles in place and do not reveal the cards. Now Collect all the other piles (including the discarded pile) and put them back in a stack. The order is irrelvant. Silently count off 16 cards, but act is if the 16th card is very special. From here silently start counting the cards again until you get to the end. The total number of cards is the combined value of the top card of each pile the subject choose earlier. Example #1 If the deck starts as A 2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K Magician Turns over first card, A, counts 1 in his head, and then adds cards to make it so the total is 11. Once a card is turned over and the remaining cards do not equal 11, it is the discard pile This is repeated until the piles are created below Pile #1 A + 10 Cards #2 Q + 1 Card #3 A + 10 Cards #4 Q + 1 Card #5 A + 10 Cards #6 Q + 1 Card #7 A + 10 Cards (2 Cards in Dispile, not for Subject to choose from) Turn Piles over Ask Subject to Pick 3 Piles Subject Selects Piles #1, #2, #3 Magician Collects all the other piles (and discards) and puts them in a new pile (order is irrelvant) Magician Starts Flipping the Cards face up and counting in his head to the 16th Card Once the 16th cards appears, start over counting and flipping cards. The total number of cards in this final stack will equal the sum of the top card from each of the Subjects piles (A+Q+A=12). Example #2 If the deck starts as 8 3 2 A K Q J 10 9 6 7 5 4 A K Q K Q 3 2 10 J 7 9 8 5 6 4 A Q A J 10 9 8 10 7 6 9 8 7 5 4 2 3 J K 2 3 4 5 6 Magician Turns over first card, 8, counts 8 in his head, and then adds cards to make it so the total is 11. Once a card is turned over and the remaining cards do not equal 11, it is the discard pile This is repeated until the piles are created below Pile #1 8 + 3 Cards #2 K + 1 Card #3 J + 1 Card #4 9 + 2 Cards #5 5 + 6 Cards #6 3 + 8 Cards #7 4 + 7 Cards #8 10 + 1 Cards #9 6 + 5 Cards (9 Cards in Dispile) Turn Piles over Ask Subject to Pick 3 Piles Subject Selects Piles #1, #2, #3 Magician Collects all the other piles (and discards) and puts them in a new pile (order is irrelvant) Magician Starts Flipping the Cards face up and counting in his head to the 16th Card Once the 16th cards appears, start over counting and flipping cards. The total number of cards in this final stack will equal the sum of the top card from each of the Subjects piles (8+K+J=28). *-->A download is available at http://www.kixtart.org/forums/ubbthreads.php?ubb=download&Number=387 ================ Inputs and Outputs ================ Input Input1=String of 52 cards, separated by spaces Input2=String of the Piles #s picked by the subject, separated by spaces Aces are worth 1, Face cards are 10, all other cards are face value Output Value of Top Three Cards on Piles or Number of Cards after the 16th, however you have to solve both in your code and compare them. ================================================================ Notes ================================================================ - The scoring engine has added code to help diagnose which cases are failing. To see test case results: Code: kix32 kixgolf_magic $verbose=1 ;shows failing results kix32 kixgolf_magic $verbose=2 ;shows all results - The scoring engine expects your (primary) function to be named a(). ======= Scoring ======= The solution must pass all tests in order for it's KiXgolf Score to be considered. When posting KiXtart Golf Scores, please include the KIXGOLF_*.TXT file that is created in the script directory. It contains some basic information about the computer that the script is run on and the resulting scores. ============ Test program ============ Test cases are provided to help screen entries and to provide the Golf Score. Any script that passes the test cases can be submitted. If you are surprised that your solution passed the test cases, 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 does not generate syntax or other errors when running the script in KiXtart. 4) The final solution MUST pass all test scripts that are part of the KiXtart golf challenge. 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 test script contains the official KiXgolf scoring engine 10) Only the person posting a particular score will be recognized for the score, unless the KiXtart Golf Challenge organizer or another delegate posts code on behalf of a player 11) KiXtart Golf (a.k.a KiXgolf) codes must be written inside the KiXgolf UDF collection tags, ';!' and ';!;!' 12) Parameter names of the UDF's can be changed and additional optional parameters can be added. 13) Additional helper UDFs and code can be written as long as they reside inside the ';!' and ';!;!' tags. 14) The use of '$' as a variable is allowed. 15) The UDF layout is up to coder. 16) The UDF is expected to finish in a reasonable time, that is, on modern computers inside 1 hour timeframe. 17) You can submit scores as often as you want. 18) If you reach leading score, you are obligated to post your score immediately so others can try to compete with you. 19) The UDF may only use the KiXtart/KiXforms commands/functions/macros, no other code fragments are allowed. 20) Calls to COM components that are part of a standard default Windows installation are allowed. 21) The use of the KiXforms DLL is also permitted as the KiXforms DLL can now be considered an integral part of KiXtart scripting. 22) Calls to other executables, as long as they are part of a standard default Windows installation are allowed. 23) 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 or file. 24) You may assume ASCII as character set. 25) You may use block comments as the KiXgolf Scoring Engine now supports block comments. 26) You are allowed to only use publicly available versions of KiXtart and KiXforms, private builds or alpha builds are NOT allowed. 27) Your submitted score must include the result print of the KiXgolf test-engine. 28) The SETOPTION() parameters in the KiXgolf script may not be modified and will govern the script behavior. SETOPTION() parameters may change depending on the particular needs of the KiXgolf challenge. 29) Tokenizing the UDF, script, or portions thereof is not allowed. 30) If something is not explicitly denied by the rules, it's allowed. 31) If Confusion arises, arranger of the KiXgolf round has the final say. 32) Additional test cases can be added at any time during the KiXgolf round. The code is expected to pass based on the rules. The test cases may not include tests for all rules and exceptions. Test cases that are added during the public round will not alter the results of the private round. ================================================================ KiXtart GOLF - The Duration of the Competition ================================================================ 1) Private coding phase: 2018-06-24 to 2018-07-01 (Official Count down clock will determine end time) 2) Public coding phase: 2018-07-01 to 2018-07-08 3) Final results: 2018-08-01 |
||||||||
|
|
|||||||
|
||||||||
|
|
|||||||
Rushed to get it up, so I won't be surprised if I have something screwy. Hope it works out though. |
||||||||
|
|
|||||||
Nice, can‘t make any sense of it right now See you tomorrow |
||||||||
|
|
|||||||
Just for clarification on the cards. Input1 is the order of the cards top and face down. I mention making piles and turning them down in the instructions. There is no reason to do this in code however because they are already in that order when you process Input1. Hope this helps and makes sense. |
||||||||
|
|
|||||||
gonna take a lookie... |
||||||||
|
|
|||||||
Code: # Tests Run = 19 # Tests Passed = 3 # Tests Failed = 16 Result = Failed KiXGolf Score = 692 wonder what I am doing wrong... might have to put my mind to it. |
||||||||
|
|
|||||||
ok... so, not only we have to calculate it, we also have to keep track of the cards and not cheat with that code but use it to test if we calculated correctly after we already calculated correctly? that requirement of if $a=$b doesn't necessarily compute in my head... without that part I have a working code, now I need to go back and write another stack of lines just to make code that checks if a computer calculated wrong? |
||||||||
|
|
|||||||
Two challenges in one... |
||||||||
|
|
|||||||
Honestly, this challenge is beyond easy if you only have to do one side. |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.kix Scoring Engine = 3.3 OS = Windows 10 Pro CPU = Intel Pentium Model 12 Speed = 3999 MHz Memory = 8192 MB Tournament = Magic 11-16 Processing Start = 2018/06/25 19:51:10.206 Processing End = 2018/06/25 19:51:10.244 Duration = 0000/00/00 00:00:00.038 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 833 Thank you for participating in KiXtart Golf! Quote: Tournament = Magic 11-16 Processing Start = 2018/06/25 19:55:31.518 Processing End = 2018/06/25 19:55:31.565 Duration = 0000/00/00 00:00:00.047 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 762 |
||||||||
|
|
|||||||
all that grumbling... and then poof... code |
||||||||
|
|
|||||||
I still don't get it... Code: Processing Start = 2018/06/25 19:56:57.697 Processing End = 2018/06/25 19:56:57.735 Duration = 0000/00/00 00:00:00.038 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 746 edit... I think it just makes for a longer code and then might make it harder to spot a "cheating" code... Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.kix Scoring Engine = 3.3 OS = Windows 10 Pro CPU = Intel Pentium Model 12 Speed = 3999 MHz Memory = 8192 MB Tournament = Magic 11-16 Processing Start = 2018/06/25 20:03:47.634 Processing End = 2018/06/25 20:03:47.681 Duration = 0000/00/00 00:00:00.046 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 656 edit2, wonder if I am playing all alone... Jochen? Code: Tournament = Magic 11-16 Processing Start = 2018/06/25 20:19:58.809 Processing End = 2018/06/25 20:19:58.840 Duration = 0000/00/00 00:00:00.031 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 526 edit3, it sure seems lonely here... Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.kix Scoring Engine = 3.3 OS = Windows 10 Pro CPU = Intel Pentium Model 12 Speed = 3999 MHz Memory = 8192 MB Tournament = Magic 11-16 Processing Start = 2018/06/25 20:35:14.259 Processing End = 2018/06/25 20:35:14.280 Duration = 0000/00/00 00:00:00.020 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 229 |
||||||||
|
|
|||||||
ok, I think I hit my limit... I guess I get to see you guys in 5 days...? Code: Tournament = Magic 11-16 Processing Start = 2018/06/25 21:01:15.690 Processing End = 2018/06/25 21:01:15.728 Duration = 0000/00/00 00:00:00.038 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 215 edit... just a side note. if I didn't have to memorize for the mark as well but could just do my magical part, it would be down to 192... |
||||||||
|
|
|||||||
We supposedly got about 3 more coming. You arent't really done are you? |
||||||||
|
|
|||||||
lol... not really sure what else to do here. it's not like I got million strokes now if jpo pulls of 150 somehow, then I gotta redesign, but short of that, don't really know man... |
||||||||
|
|
|||||||
If you really think it could lead to "cheating" I'm willing to remove the requirement. I don't want to be making a judgement call on a suspect piece of code. My fear is, with only needing to find the answer, your codes are going being to be small and very tough to find strokes. |
||||||||
|
|
|||||||
no need to remove it... I just griping... it's not just intentional cheating either, just the fact that twisting numbers and variables around can lead to mistakes. I had to add explanatory comments to my code to keep up which value we are talking about. first of everything. I guess that means I am really getting old? :'( anyhow, got this far: Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.kix Scoring Engine = 3.3 OS = Windows 10 Pro CPU = Intel Pentium Model 12 Speed = 3999 MHz Memory = 8192 MB Tournament = Magic 11-16 Processing Start = 2018/06/25 21:51:05.720 Processing End = 2018/06/25 21:51:05.755 Duration = 0000/00/00 00:00:00.035 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 203 |
||||||||
|
|
|||||||
Right now things are a bit packed, hope that I get to play around thursday or so.. 203 is really low score regarding what I already have done in the back of my head though. |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.kix Scoring Engine = 3.3 OS = Windows 10 Pro CPU = Intel Pentium Model 12 Speed = 3999 MHz Memory = 8192 MB Tournament = Magic 11-16 Processing Start = 2018/06/26 18:41:47.346 Processing End = 2018/06/26 18:41:47.377 Duration = 0000/00/00 00:00:00.030 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 201 Thank you for participating in KiXtart Golf! |
||||||||
|
|
|||||||
Come on man... sub 200 or nothing, right? |
||||||||
|
|
|||||||
are the test cases like they are ever going to be? if so, I have a code for 194. if we are going to add more complete cases, I can make one that my 194 code would fail. |
||||||||
|
|
|||||||
well... while you are wondering what to answer my question... Code: Tournament = Magic 11-16 Processing Start = 2018/06/26 20:51:19.244 Processing End = 2018/06/26 20:51:19.275 Duration = 0000/00/00 00:00:00.030 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 200 |
||||||||
|
|
|||||||
I'm interested in the failing case. I thought I got most everything. |
||||||||
|
|
|||||||
What you downloaded was actually the second zip I put up, which had 11 more cases. |
||||||||
|
|
|||||||
sub 200 you said. sent you a PM on the tests. Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.kix Scoring Engine = 3.3 OS = Windows 10 Pro CPU = Intel Pentium Model 12 Speed = 3999 MHz Memory = 8192 MB Tournament = Magic 11-16 Processing Start = 2018/06/26 21:11:24.334 Processing End = 2018/06/26 21:11:24.387 Duration = 0000/00/00 00:00:00.052 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 199 |
||||||||
|
|
|||||||
You good, brotha. |
||||||||
|
|
|||||||
New Zip in top post. INI updated to include only upper case letters. I had no intention of having mixed case letters in the INI. |
||||||||
|
|
|||||||
this is then my updated score
|
||||||||
|
|
|||||||
Sorry guys. This is the first night I've been anywhere with internet since our vacation started last weekend. I'd probably need a night or two to get anything hobbled together, so maybe I'll just catch something in the public round. |
||||||||
|
|
|||||||
Go ahead if you want to play. No point in Jooel posting his code with no competition. |
||||||||
|
|
|||||||
No competition from my side this time, sorry guys. Just too busy doing crap |
||||||||
|
|
|||||||
huh. that's not cool. |
||||||||
|
|
|||||||
Same here, I've got boatloads of works |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 11:41:16.503 Processing End = 2018/07/03 11:41:16.514 Duration = 0000/00/00 00:00:00.011 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 285 Thank you for participating in KiXtart Golf! I'll compete in Arend his place then Managed to get something working |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 14:32:45.641 Processing End = 2018/07/03 14:32:45.652 Duration = 0000/00/00 00:00:00.010 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 250 Thank you for participating in KiXtart Golf! Getting there |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 15:28:27.059 Processing End = 2018/07/03 15:28:27.070 Duration = 0000/00/00 00:00:00.010 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 227 Thank you for participating in KiXtart Golf! Not quite there yet |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 15:46:34.494 Processing End = 2018/07/03 15:46:34.505 Duration = 0000/00/00 00:00:00.010 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 203 Thank you for participating in KiXtart Golf! Well i'm almost competing Lonkero |
||||||||
|
|
|||||||
Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 16:06:45.895 Processing End = 2018/07/03 16:06:45.906 Duration = 0000/00/00 00:00:00.011 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 188 |
||||||||
|
|
|||||||
Final version Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 16:14:38.431 Processing End = 2018/07/03 16:14:38.441 Duration = 0000/00/00 00:00:00.010 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 181 Thank you for participating in KiXtart Golf! |
||||||||
|
|
|||||||
The revised end date for the private round will now be this Sunday 7/8 12PM Eastern. I'll update the countdown clock when I have time. As a reminder, you must solve both sides of the equation and compare them. See Notes above for further explanation. |
||||||||
|
|
|||||||
Well thats annoying.... missed the required If a == b part etc and not entirely sure my solution is allowed for the set of rules.... Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/03 16:47:35.986 Processing End = 2018/07/03 16:47:35.996 Duration = 0000/00/00 00:00:00.010 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 192 Thank you for participating in KiXtart Golf! |
||||||||
|
|
|||||||
for me the hard part was keeping the input1 and input2 calculations separate. I might have to look at my code. don't like the fact that you have the same score. |
||||||||
|
|
|||||||
Okay... for fun, and if you so desire... Code Challenge I: As described above in the instructions, comparing magician and subject values. If you have any question about your code passing the rules and or "cheating", just go ahead and consider it not passing. Code Challenge II: Lowest score, no comparison. Please *Visibly* mark posts by putting a I or II above your score. Maybe this will open things up, and possibly find some stragglers who have yet to play (Glenn AND team, J, among others) Points will be given for each challenge. |
||||||||
|
|
|||||||
Allen i'm up for that if Lonkero is up for that as well. In the meanwhile i managed to break away a bit more code I Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/04 09:00:01.175 Processing End = 2018/07/04 09:00:01.184 Duration = 0000/00/00 00:00:00.009 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 191 II Still calculating both numbers but without the comparison check in the end. Code: KiXtart Version = 4.67 KiXGolf Script = kixgolf_magic.KIX Scoring Engine = 3.3 OS = Windows 10.0 / 161 CPU = Intel Pentium Model 15 Speed = 3592 MHz Memory = 65536 MB Tournament = Magic 11-16 Processing Start = 2018/07/04 14:29:30.128 Processing End = 2018/07/04 14:29:30.138 Duration = 0000/00/00 00:00:00.010 # Tests Run = 19 # Tests Passed = 19 # Tests Failed = 0 Result = Passed KiXGolf Score = 175 Thank you for participating in KiXtart Golf! |
||||||||
|
|
|||||||
Sorry, Guys - we had 3 clients close in the past two weeks in addition to my dev work for a project due in August. We're swamped, which is why I posted the "help wanted" request. Glenn |
||||||||
|
|
|||||||
help wanted? |
||||||||
|
|
|||||||
I guess the public phase has started? |
||||||||
|
|
|||||||
yes, it did. I do not have my code at hand. I can post in about 7 hours. |
||||||||
|
|
|||||||
-I- Code: function a($r,$p) dim $t,$q,$,$b $r = Join(Split($r,'10'),'K') $t=36 While $r $ = Asc($r) $ = Iif($ > 65,10, $ & 15) $r = right($r,-24 + $*2) $q = $q + 1 If Ascan(Split($p,' '), $q) + 1 $t = $t - 12 + $ $b = $b + $ If $t == $b $a = $t endfunction -II- Code: function a($r,$p) dim $t,$q,$ $r = Join(Split($r,'10'),'K') $t=36 While $r $ = Asc($r) $ = Iif($ > 65,10, $ & 15) $r = right($r,-24 + $*2) $q = $q + 1 If Ascan(Split($p,' '), $q) + 1 $t = $t - 12 + $ $a = $a + $ endfunction |
||||||||
|
|
|||||||
both of your functions are calculating against $p. if $p is omitted from the input, does your code still work? thinking about it again, my code might be doing something alike... need to see once I get to that computer. |
||||||||
|
|
|||||||
ok, here be my 192: Code: function a($,$b) dim $c, $x, $f, $v ;$c - current card ;$v - the subject knowledge ;$ - original stack of 52 cards, inside for each used to count cards in current stack ;$x - count of stacks this far ;$f - first card in a new stack $a = 36 ;52 cards - 16 for each $c in split($) if 0=$f ;no cards in stack yet, get the face value of the first card $f = 10*(1>$c)+$c-9*('A'=$c) ;case sensitive 199 code has this: ('a'=$c | 'A'=$c) ;value of first card. you could also use ucase() but it doesn't look as good. $ = 0 ;new stack endif $ = 1+$ ;add a card to the current stack if 12=$+$f ; is same as 11 = count of cards in stack minus one plus first card value $x = 1 + $x ;another card stack on da table if 1+ascan(split($b),$x) ;if this is one of the stacks the mark selected $a = $a - $ ;magician removes from the count of cards, the amount of cards $ in the stack that the subject selected $v = $v + $f ;subject selects their stack and sees the face value of $ endif $f = 0 ;start a new stack endif next if $a^$v ;if our calculated sum $a does not match to the sum of marks cards $v, return 0. never will happen so kinda pointless ;) $a=0 endfunction |
||||||||
|
|
|||||||
For 187 Code: function a($r,$p) ;$r input card order ;$p input chosen piles dim $t,$q,$,$b ;$t countdown from 52 cards ;$q current pile number ;$ holds value of current card ;$b sum of values of chosen pile card values $r = Join(Split($r,'10'),'K') ; replaces all 10s bij K to make sure every 2 positions there is 1 card value in every 2 positions $t=36 ;since we have to ignore 16 cards of the leftover cards 52 - 16 While $r $ = Asc($r) $ = Iif($ > 65,10, $ & 15) ;gets the current pile card value $r = right($r,-24 + $*2) ;removes cards from card order $q = $q + 1 ;move to next pile (start at 0) If Ascan(Split($p), $q) + 1 ;check wether the current pile is one of the chosen ones $t = $t - 12 + $ ;remove the cards from the leftover cards $b = $b + $ ;add the current value to the chosen pile sum If $t == $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration $a = $t endfunction |
||||||||
|
|
|||||||
NICE! thanks for the comments! ok, so 183: Code: function a($r,$p) ;$r input card order ;$p input chosen piles dim $t,$q,$,$b ;$t countdown from 52 cards ;$q current pile number ;$ holds value of current card ;$b sum of values of chosen pile card values $r = Join(Split($r,10),K) ; replaces all 10s bij K to make sure every 2 positions there is 1 card value in every 2 positions $t=36 ;since we have to ignore 16 cards of the leftover cards 52 - 16 While $r $ = Asc($r) $ = Iif($ > 65,10, $ & 15) ;gets the current pile card value $r = right($r,-24 + $*2) ;removes cards from card order $q = $q + 1 ;move to next pile (start at 0) If Ascan(Split($p), $q) + 1 ;check wether the current pile is one of the chosen ones $t = $t - 12 + $ ;remove the cards from the leftover cards $b = $b + $ ;add the current value to the chosen pile sum If $t == $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration $a = $t endfunction |
||||||||
|
|
|||||||
180: Code: function a($,$p) ;$r input card order ;$p input chosen piles dim $t,$q,$r,$b ;$t countdown from 52 cards ;$q current pile number ;$ holds value of current card ;$b sum of values of chosen pile card values $ = Join(Split($,10),K) ; replaces all 10s bij K to make sure every 2 positions there is 1 card value in every 2 positions $t=36 ;since we have to ignore 16 cards of the leftover cards 52 - 16 While $ $r = 10*(1>$)+$-9*(65=asc($)) ;gets the current pile card value $ = right($,-24 + $r*2) ;removes cards from card order $q = $q + 1 ;move to next pile (start at 0) If Ascan(Split($p), $q) + 1 ;check wether the current pile is one of the chosen ones $t = $t - 12 + $r ;remove the cards from the leftover cards $b = $b + $r ;add the current value to the chosen pile sum If $t == $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration $a = $t endfunction |
||||||||
|
|
|||||||
I am having trouble figuring out how this can work: Code: $ = right($,-24 + $r*2) ;removes cards from card order |
||||||||
|
|
|||||||
179: Code: function a($,$p) ;??? ;$r input card order ;$p input chosen piles dim $t,$q,$r,$b ;$t countdown from 52 cards ;$q current pile number ;$ holds value of current card ;$b sum of values of chosen pile card values $ = Join(Split($,10),K) ; replaces all 10s bij K to make sure every 2 positions there is 1 card value in every 2 positions $t=36 ;since we have to ignore 16 cards of the leftover cards 52 - 16 While $ $r = 10*(1>$)+$-9*(65=asc($)) ;gets the current pile card value ; ? (-24 + $r*2) " $r is: " $r " from string: " $ $ = right($,-24 + $r*2) ;removes cards from card order ; ? " leaving: " $ ? $q = $q + 1 ;move to next pile (start at 0) If Ascan(Split($p), $q) + 1 ;check wether the current pile is one of the chosen ones $t = $t - 12 + $r ;remove the cards from the leftover cards $b = $b + $r ;add the current value to the chosen pile sum If $t = $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration $a = $t endfunction |
||||||||
|
|
|||||||
this... I don't think this part is kosher... consciously keeping track of both numbers and use them to get the result. this is equivalent of all cards being flipped face up so the magician can teach to mark how to do the trick: Code: If $ = $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration $a = $t |
||||||||
|
|
|||||||
178 Code: function a($,$p) ;??? ;$r input card order ;$p input chosen piles dim $t,$q,$r,$b ;$t countdown from 52 cards ;$q current pile number ;$ holds value of current card ;$b sum of values of chosen pile card values $ = Join(Split($,10),K) ; replaces all 10s bij K to make sure every 2 positions there is 1 card value in every 2 positions $t=36 ;since we have to ignore 16 cards of the leftover cards 52 - 16 While $ $r = 10*(1>$)+$-9*(65=asc($)) ;gets the current pile card value $ = right($,$r*2-24) ;removes cards from card order $q = $q + 1 ;move to next pile (start at 0) If Ascan(Split($p), $q) + 1 ;check wether the current pile is one of the chosen ones $t = $t - 12 + $r ;remove the cards from the leftover cards $b = $b + $r ;add the current value to the chosen pile sum If $t = $b ;if both calculations match then set the output (since one counts up and the other counts down this is always the last iteration $a = $t endfunction p.s. Page is currently broken when trying to view this with javascript on. |
||||||||
|
|
|||||||
too much code. javascript is being killed by your browser as far as I understand it. |
||||||||
|
|
|||||||
wait a second... did this never get solved or was I blind any never saw the concluding thread/post announcing the winners? |
||||||||
|
|
|||||||
Honestly, I quit trying to even read it (I didn't make it in time for the public round anyway). Every time I try to load page 3, it freezes up. |