MacTech Network: MacTech Forums | MacForge.net | Computer Memory | Register Domains | Cables | iPod Deals | Mac Deals | Mac Book Shelf |
|
|
|
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The Megaminx is a regular solid with twelve faces, where each face is divided into one center face element (which I’ll call a facelet), five corner facelets, and five edge facelets. The faces are colored with six colors, pairs of opposing faces being colored the same. The solid is divided into slices corresponding to the faces of the Megaminx. Each face can be rotated clockwise or counterclockwise, with five rotation steps in the same direction bringing the corresponding slice back to its original position. Your Challenge is to restore a scrambled Megaminx to its original position. Entries this month will be complete applications, so there is no prototype for the code you should write. To describe the coloring of the solid, we’re going to have to agree on some notation to identify the facelets. We’ll number the faces from 1..12, thinking of face 1 as the "top" face. Face 2 will be one of the five faces adjacent to the top face, and faces 3..6 the other faces adjacent to the top face, proceeding clockwise from face 2 when viewed from above the top face. Faces 7..12 will be numbered such that face N+6 is opposite face N. We’ll number the colors of the solved Megaminx using 1..6 as well, assigning color N to the center facelet of faces N and N+6. Sounds complicated perhaps, but if you read carefully, it should become clear. If it isn’t, perhaps the following list of face adjacencies will help:
Your program must process multiple test cases, the number of which is provided in the file input.txt. The initial conditions for each test case are provided in file megaminxNN.in, where NN ranges from 1 to the number of test cases. Each input file contains 120 lines, 60 describing the coloring of the corner facelets, followed by 60 describing the coloring of the edge facelets. The lines describing the corner facelets will contain four comma-delimited numbers: the number of the face on which the facelet lies, the number of one of the other faces on this corner piece, the number of the third face on this corner piece, and the color of the facelet. The lines describing the edge facelets will contain three comma-delimited numbers: the number of the face on which the facelet lies, the number of the other face defining this corner piece, and the color of the facelet. So, for a Megaminx in the "solved" orientation, the megaminxNN.in file would contain the following lines for the top face: 1,2,3,1 The puzzle is solved with a sequence of slice rotations, resulting in each facelet being moved to the face that matches its color. Each rotation moves the corner and edge pieces of the rotated slice to new positions. A clockwise rotation of the slice corresponding to face 1, for example, moves corner piece (1,2,3) to (1,3,4), which moves to (1,4,5), which moves to (1,5,6), which moves to (1,6,2). A clockwise rotation of slice 2 moves the corners from (2,3,1) -> (2,1,6) -> (2,6,10) -> (2,10,11) -> (2,11,3) -> (2,3,1). After reading the input for each test case, you should determine the sequence of rotations needed to solve the puzzle and output them to a file rotationsNN.txt. Each rotation should produce one line of output of the form: face,direction … where face is the number of the slice being rotated, and "direction" is the character ‘+’ for a clockwise rotation and ‘-‘ for a counterclockwise rotation. Finally, your program should produce a megaminx.log file, with one line per test case containing the integer number of microseconds used by your application to solve that test case, including the time to read the input, find the solution, and produce the rotationsNN.txt output. Scoring will be based on minimizing execution time. You can earn a reduction of up to 25% of your execution time if your application has an option to display the Megaminx as it is being solved. (Scoring will be done with the display option disabled, so the display time will not count against your solution.) The bonus will be awarded based on a subjective evaluation of the quality and attractiveness of your application. This will be a native PowerPC Challenge, using the development environment of your choice, provided I have or can obtain a copy - email progchallenge@mactech.com to check before you start. You can develop for Mac OS 9 or Mac OS X. Your solution should be a complete Macintosh application, and your submission should provide everything needed to build your application. Test data for this Challenge is available. 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.