![]() |
|
#1
|
|||
|
|||
Coding Contest #1The challenge is to produce code that:
1: reads a file of two "poker" hands 2: outputs whether hand 1 or hand 2 is the winner (or if there is a tie) 3: use the best 5 cards of the seven per hand in calculating the value of the hand. 4: output the "string reason" result of the two hands (eg: Straight beats Three of a Kind) The file will be two hands per line as follows: kc 5s 6d 4h ks 3h 4s qc ah jh ac 5d 10d 6h jc 6c qh 4h 3c 9h 10s qs 8d 6s 6h 7s 4d 4c 6d 2c js 3c jd 10s ad 5d 9d 4d jh as 9h 6h as 5s ks kh 6s 9h 8s js 7h 4d kd 10c 3s qc 10s 9h ks 6c 9c 6d 2s 6h 8h 2d 4d 4c js qd 4d 5c 3c 10h as 3h qs 9c 2c 4c 7d ks kh 6h jc qd 7s 3d 6c ad qc 8d 4c 9h qh 10h 2c 10s 10d 4c 2h 10s 7d ah 9c 4s 2c 6s 4d 6h ad 10h ..etc.. Where the first hand is the first 7 "cards" and the second hand is the second set of 7 "cards." The card symbols are decoded as follows: xxy : where x or xx is the face value of the card and the y is the suit of the card. a,k,q,j,10,9,8,7,6,5,4,3,2 are valid face values s = spades, d = diamonds, c = clubs, h = hearts are valid suits as = ace of spades 10d = 10 of diamonds, etc. No wild cards can be accepted and no illegal hands such as two of the same card can be accepted. Any line read in containing an "illegal hand" should produce an appropriate error message and continue processing subsequent lines, if any exist. The "ac" (Ace of Clubs) and all others in the file should be processed case-insensitively! That means that: ac Ac aC AC ...are all treated equally and appropriately! Standard Poker ranking will be used (order highest to lowest): Note that no suit is superior to any other. All suits are of equal ranking. Therefore a straight in spades and a straight in hearts are equal if the face values of the straights are the same. as 2s 3s 4s 5s == ah 2h 3h 4h 5h (result is a tie!) --Challenge entries should use only standard C or standard C++ code/libraries. Challengers should declare the language used based on the type of file extensions used in their code. --For example, if ".c" files are used, then it will be assumed that the entry is a C language entry. --If ".cpp" files are used, then it will be assumed that it is a C++ language entry. --Entries should provide a README.TXT file that indicates any steps used to build and link the code into an executable. --Entries should declare the following at the top of the README.TXT AUTHOR: <your GIDForums username> <your first and last real name> COPYRIGHT: I hereby place this work that I have authored into the public domain and in the process abandon all copyright protection. <those exact words> PLATFORM: <operating system/version> TOOLCHAIN: <preprocessor/compiler/linker version information> LANGUAGE: <the programming language used for the entry> LEVEL: <your programming level Beginner/Intermediate/Advanced> BUILD: <steps required to build/link your code into an executable> DESIGN: <statements describing your design and your implementation decision making process> Note that it will be assumed that a file called "hands.txt" will be available in the same path as the executable and that the executable will perform its intended work on that file. The file may contain any number of "hand lines." Your entry should be prepared to deal with hands.txt files of any size including zero lines. Intermediate and Advanced entries must accept the "hands.txt" by default as well as a command line filename parameter using -f <filename.ext> All entries should continue processing the file containing hands information until the end of the file. Any errors encountered by Intermediate and Advanced entries should be dealt with accordingly and processing resumed, if possible. Execution points will be awarded on the overall quality of the application to perform the task(s). HINT: Proper handling of input and output is essential here! Style points will be awarded on the coding format and consistency of style rather than the preferred coding style of the author. HINT: Be consistent in your style! (Intermediate and Advanced, well-formatted console output will be a big plus!) Performance points will be awarded and all entries will be judged against the same "hands.txt" file that will be generated at the end of the entry deadline. A sample hands.txt file will be provided. HINT: Linked application file size (10%) and execution speed (90%) will be judged in this category! Portability points will be awarded and all entries will be (attempted) compiled and executed on a Windows XP system and a Linux 2.6.x kernel-based system. HINT: No platform-specific headers! (such as stdafx.h, dos.h, etc.) Design points will be awarded based on the general simplicity and straight-forwardness of the design along points given for the judged ease of maintaining the entry code over time. HINT: Appropriate use of comments will definitely be a plus! Grading Scale Specifics: For Beginner entries the following grading scale will apply: Execution: 80% of total Style: 5% of total Performance: 5% of total Portability: 5% of total Design: 5% of total For Intermediate entries the following grading scale will apply: Execution: 50% of total Style: 15% of total Performance: 10% of total Portability: 10% of total Design: 15% of total For Advanced entries the following grading scale will apply: Execution: 20% of total Style: 20% of total Performance: 20% of total Portability: 20% of total Design: 20% of total --Your real first and last name won't be published from your README.TXT file unless you ASK for it to be published with it or if you add your first and last name inside of your code files other than README.TXT. The requirement for first/last name is for the authenticity of the public domain statement only. --Judge(s) will ask (if needed) questions about your entry through the GIDForums private message interface. Please endeavor to respond in a timely manner as without clarification, your entry may be more difficult to judge! --Only one entry per GIDForums member per programming language. Maximum 2 entries per GIDForums member. No changes may be made after an entry is submitted for judging. --Entries will be posted for all to see after the end of the entry deadline. --Points awarded and calculated standings will be posted in highest to lowest order for all entries received in all three categories and for both languages. --Winners will be announced in each of the three skill levels and for both languages. --One overall winner will be announced and that person shall be tasked with coming up with the next coding challenge within 2 weeks to keep things rolling. |
Recent GIDBlog
Developing GUIs with wxPython (Part 4) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code Contest | Paramesh | Miscellaneous Programming Forum | 76 | 30-Jun-2006 12:18 |
| Pls help in this coding. | harsha | C++ Forum | 5 | 08-Apr-2004 20:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The