MacTech Network: MacTech Forums | MacForge.net | Computer Memory | Register Domains | Cables | iPod Deals | Mac Deals | Mac Book Shelf |
|
|
|
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
![]() |
The columns in row r with c columns are numbered from -(c-1)/2 to +(c-1)/2, inclusive, for even numbered rows, and from —(c/2)+1 to (c/2), inclusive, for odd numbered rows. For a position (r,c) in an even numbered row, the adjacent positions are (r,c-1), (r,c+1), (r+1,c), (r+1,c+1), (r-1,c), and (r-1,c+1). For the same position in an odd-numbered row, the adjacent positions are (r,c-1), (r,c+1), (r+1,c), (r+1,c-1), (r-1,c), and (r-1,c-1). (Provided, of course, that those positions exist on the board). 0: 0 1: 0 1 2: -1 0 1 3: -1 0 1 2 4: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 5: -5 -4 -3 -2 -1 0 1 2 3 4 5 6 6: -5 -4 -3 -2 -1 0 1 2 3 4 5 7: -4 -3 -2 -1 0 1 2 3 4 5 8: -4 -3 -2 -1 0 1 2 3 4 9: -4 -3 -2 -1 0 1 2 3 4 5 10: -5 -4 -3 -2 -1 0 1 2 3 4 5 11: -5 -4 -3 -2 -1 0 1 2 3 4 5 6 12: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 13: -1 0 1 2 14: -1 0 1 15: 0 1 16: 0 A move in Chinese Checkers can be either a non-jump move or a sequence of contiguous jumps. Relocating a piece from one position to an unoccupied adjacent position is a non-jump move. Jumping over an adjacent occupied position into an unoccupied position, collinear with the first two, is considered a jump. A single jump move can consist of jumping a single piece over an occupied position, followed by a jump from the new location over an adjacent piece to still another location, repeated as many times as the board situation allows. No pieces are removed from the board at any time. A move may not begin or end in a neutral zone triangles, although a multi-jump move may include an intermediate position in the neutral zone. Some Chinese Checker rules allow a player to pass; this is not allowed in our game. Your InitChineseCheckers routine will be called at the beginning of each game with the game parameters, the number of players in the game (numPlayers), the size of the board (gameSize, described above), the board position for each player (playerPosition[]), and your index as a player in the game (yourIndex). The playerPosition is numbered clockwise starting from the (0,0) position. After every player has been initialized, the player at playerPosition[0] will be asked to play by calling his YourMove routine. That player should return the Position of the piece he is moving in *from, and the position he is moving to in *to. For a non-jump move, the two positions must be adjacent. For a jump move, there must be a valid sequence of jumps between *from and *to. If you cannot make a legal move, set *from to the location of one of your pieces and *to to that same location. Illegal moves will result in disqualification. After a player moves, the other players will be notified of the move by calling their OpponentMove routines, providing the index of the moving player in opponent, and the positions moved from and to in those parameters, respectively. The game is over when one player has moved all of his pieces from the home area to the goal area, provided all players have had the same number of turns to move. At the end of the game, TermChineseCheckers will be called, where you can deallocate any memory allocated during the game. The evaluation will consist of solutions playing against one another in combinations of between 2 and 6 players per game. Each solution will play the same number of games against each other solution, with the same number of opportunities to play first, with fair seating arrangements that will be determined after I see how many solutions are submitted. The winner will be the solution that wins the most games in the least amount of time. Specifically, the winner will be the solution with the greatest score, where the score is two times the number of games won, plus the number of games drawn, minus a time penalty of 1 game per second of execution time. Execution time will include the time used by all of your routines: InitChineseCheckers, YourMove, OpponentMove, and TermChineseCheckers. This will be a native PowerPC Challenge, using the latest CodeWarrior environment. Solutions may be coded in C, C++, or Pascal.
You can get a head start on the Challenge by reading the Programmer's Challenge mailing list. It will be posted to the list on or before the 12th of the preceding month. To join, send an email to listserv@listmail.xplain.com with the subject "subscribe challenge-A". You can also join the discussion list by sending a message with the subject "subscribe challenge-D".
|
|
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
All contents are Copyright 1984-2008 by Xplain Corporation. All rights reserved.
MacTech is a registered trademark of Xplain Corporation. Xplain, Video Depot, Movie Depot, Palm OS Depot, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, NetProLive, JavaTech, WebTech, BeTech, LinuxTech, Apple Expo, MacTech Central and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.