Please help me solve this c++ question

Discussion in 'C++' started by amoahs70, Mar 25, 2011.

  1. amoahs70

    amoahs70 New Member

    Joined:
    Mar 25, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Ghana
    I am asked to create a game.
    Rules of shuffle
    1.it is a single-player game.
    2.when the game starts,the application displays the name of the player who has completed the game in the minimum number of keystrokes.then,it displays the numbers from zero to eight in random order in a 3x3 grid.
    3.the objective of the game is to arrange the number in ascending order as.
    1. 2. 3
    4. 5. 6
    7. 8. 0
     
  2. jsh

    jsh New Member

    Joined:
    Mar 18, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    JSH:Hi...
    ...............
    Please note the following.


    --a--
    --b--
    cd0ef
    --g--
    --h--

    -----------
    4 َArray = > left , right , top , bottom
    left = [ c , d , 0]
    top = [ a , b , 0]
    bot = [ 0 , g , h]
    right = [ 0 , e , f]
    -----------
    After the first shift..


    --a--
    --0--
    cdbef
    --g--
    --h--

    ---
    left = [ c , d , b]
    top = [ a , 0 , b]
    bot = [ b , g , h]
    right = [ b , e , f]


    or



    --a--
    --b--
    c0def
    --g--
    --h--

    -----
    left = [ c , 0 , d]
    top = [ a , b , d]
    bot = [ d , g , h]
    right = [ d , e , f]



    or



    --a--
    --b--
    cde0f
    --g--
    --h--

    -----
    left = [ c , d , e]
    top = [ a , b , e]
    bot = [ e , g , h]
    right = [ e , 0 , f]


    or



    --a--
    --b--
    cdgef
    --0--
    --h--

    -----
    left = [ c , d , g]
    top = [ a , b , g]
    bot = [ g , 0 , h]
    right = [ g , e , f]


    or

    ------------
    and then Again...
    4 َArray = > left , right , top , bottom
    left = [ c , d , 0]
    top = [ a , b , 0]
    bot = [ 0 , g , h]
    right = [ 0 , e , f]
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice