Thread: 2d Cubik program in C

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    2

    2d Cubik program in C

    i need a help from MInGW for 2d Cubik program in C

    <<mod edit: split from another thread >>

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    2
    This is the question
    any one help me to do in Cyou are required to develop a program for a two dimensional (2D)
    numeric Rubik’s Cube. This program will read a given numeric pattern from a text
    file and solve the 2D Rubik’s Cube by sorting the numbers into ascending order. The
    program can be run in two modes of operations:
    o Manual mode: The user will enter the transform operation sequence one at a
    time to solve Rubik’s cube.
    o Automated mode: The program will animate the sequence of transform
    operations required to solve the 2D Rubik’s Cube. The sequence of transform
    operations is generated by a predefined algorithm.
    1 Functional Requirements:
    In this programming project, you are required to develop a program for the 2D
    Rubik’s Cube. The program should perform the following functions.
    1.) Load Rubik’s Cube
    The 2D Rubik’s Cube contains a numeric pattern of eight unique integer values
    from 1 to 8 (inclusive) in unsorted sequence. The numeric pattern is presented in
    two rows with four columns each. An example of the 2D Rubik’s Cube is given
    below:
    2 3 8 5
    4 7 1 6
    The numeric pattern will be stored in a file and loaded as input to the program.
    The file name will be passed to the program as command line argument.
    2.) Transform Rubik’s Cube
    Five transform operations can be performed on the 2D Rubik’s Cube. These
    operations are represented by numeric commands listed below:
    a. n0 = Switch rows for the n-th column from the left, where n = 1,2,3,4
    Before command 20:
    2 3 8 5
    4 7 1 6
    After command 20: (correction)
    4 7 1 6 2 7 8 5
    2 3 8 5 4 3 1 6
    b. 7 = Rotate Upper row left one step
    Before command 7:
    4 7 1 6
    2 3 8 5
    After command 7:
    7 1 6 4
    2 3 8 5
    c. 1 = Rotate Lower row left one step
    Before command 1:
    7 1 6 4
    2 3 8 5
    After command 1:
    7 1 6 4
    3 8 5 2
    d. 2 = Rotate the mid four "squares/numbers" Clockwise one step
    Before command 2:
    7 1 6 4
    3 8 5 2
    After command 2:
    7 8 1 4
    3 5 6 2
    e. 8 = Rotate the mid four "squares/numbers" anti-clockwise one step
    Before command 8:
    7 8 1 4
    3 5 6 2
    After command 8:
    7 1 6 4
    3 8 5 2
    As shown in the examples, the numeric pattern representing the Rubik’s cube is
    updated after each transform operation.
    3.) Solve Rubik’s Cube
    The Rubik’s Cube is “solved” when the numeric pattern read from the file are
    sorted into ascending order through a sequence of transform operations. A
    predefined algorithm can be used to select the sequence of transform operations
    that will solve the Rubik’s Cube. The sequence of transform operation will be
    animated on the screen (one operation at a time) until the numbers are sorted in
    ascending order.
    4.) Operation Counter
    To count the number of transform operations required to solve the Rubik’s Cube.
    Usability Requirements:
    The 2D Rubik’s Cube must be developed as a Menu Driven program with the
    following two level menu structures shown in the following screen shot:
    Level 1 Menu
    Rubik’s Cube:
    2 3 8 5
    4 7 1 6
    Select the mode of solution:
    1. Manual mode
    2. Automated mode
    Enter your selection:
    Level 2 Menu
    Manual mode
    Rubik’s Cube:
    2 3 8 5
    4 7 1 6
    Manual mode
    Transform Operations:
    n0 = Switch rows for the nth column from the left, where n = 1,2,3,4
    7 = Rotate Upper row left one step
    1 = Rotate Lower row left one step
    2 = Rotate the mid four "squares/numbers" Clockwise one step
    8 = Rotate the mid four "squares/numbers" aNti-clockwise one step
    Enter Transform Operation (one at a time):
    Automated mode
    Rubik’s Cube:
    1 2 3 4
    5 6 7 8
    Automated mode
    Transform Operations:
    n0 = Switch rows for the nth column from the left, where n = 1,2,3,4
    7 = Rotate Upper row left one step
    1 = Rotate Lower row left one step
    2 = Rotate the mid four "squares/numbers" Clockwise one step
    8 = Rotate the mid four "squares/numbers" aNti-clockwise one step
    Sequence: 1-1-30-7-7-7-10-30-40-1-7-8-30-8-7-7-7-1-1-1
    Number of Transform Operations Performed: 20

  3. #3
    Making mistakes
    Join Date
    Dec 2008
    Posts
    476
    What have you done so far?

  4. #4

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    This is a great assignment, imo!

    Are you working on the menu display and manual solving mode, now? That would be a good way to start.

    The automatic mode will need a search to find the answer. Although *all* searches are equal perhaps for this, depth first searches are, in the terminology of "Animal Farm", *more* equal.

    Congrats on a good assignment - so much better than the ditzy one's we typically see students struggling with.

    Please post up your menu and whatever else you have for this, and ask any specific questions you have. It may sound quite difficult, but it is not.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Need Help with 2D Garden Design Program
    By frgmstr in forum C++ Programming
    Replies: 7
    Last Post: 02-04-2002, 04:58 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM