c puzzle

Анульовано Опубліковано %project.relative_time Оплачується при отриманні
Анульовано Оплачується при отриманні

Common puzzle with a 4x4 playing space with 15 tiles, numbered 1 through 15. One "spot" is always left blank.

The goal is to get the tiles in order, 1 through 15, from left to right, top to bottom, by just sliding tiles into the empty square. In this configuration, the goal would be to get the 14 and 15 to switch places, without affecting any of the other squares.

Your goal will be to write a program that allows the user to play this game.

The first part of your program will read in possible puzzle configurations from a file and choose one of them randomly. The file format is as follows:

The first line of the input file will contain a single positive integer n, representing the number of puzzles in the file. The puzzles will be contained in the next 5n lines. In particular, each puzzle will be stored in 5 lines. The first line will contain the first row of values in the puzzle separated by spaces. The second line will contain the second row, the third line, the third row and the fourth line, the fourth row. The blank spot will be designated by the integer 0. The last line (fifth) will be a blank line.

3

1 0 2 3

5 6 7 4

9 10 11 8

13 14 15 12

15 1 2 3

14 13 12 11

10 9 8 7

6 0 5 4

Output Specification

At the very beginning of the program, you will prompt the user to enter in the name of the file (this has already been done for you). Then, the program will open the file and load a puzzle into its memory. (You will do this in the loadPuzzle function.)

Once this is done, the puzzle should be displayed to the user (printPuzzle will do the work, but the call to this function is already in main) and the user should choose a tile to move. Roughly the board should print out as follows:

1 2 _ 3

5 6 7 4

9 10 11 8

13 14 15 12

Note that an underscore is to be used to denote the blank square and that internally, this is stored as 0.

Prompt the user with the following question after showing them the board:

Which piece would you like to slide into the open slot?

Note, answering 0 means you quit the game without winning.

If the user chooses a valid square, process the move and print out:

Sorry, that is not a valid square to slide into the open slot. No move has been executed.

If the user chooses 0, print out:

Sorry, looks like you gave up on the puzzle.

Техніка MySQL PHP Управління проектом Архітектура ПЗ Тестування ПЗ

ID Проекту: #3326899

Про проект

20 заявок(-ки) Дистанційний проект Остання активність Oct 23, 2008

20 фрілансерів(-и) готові виконати цю роботу у середньому за $41

marchent

See private message.

$85 USD за 14 дні(-в)
(168 відгуків(и))
6.3
bitdonkey

See private message.

$169.15 USD за 14 дні(-в)
(111 відгуків(и))
6.1
genergabasa

See private message.

$85 USD за 14 дні(-в)
(35 відгуків(и))
5.9
magadhmindslx

See private message.

$29.75 USD за 14 дні(-в)
(161 відгуків(и))
5.4
Apogeesolutions

See private message.

$42.5 USD за 14 дні(-в)
(68 відгуків(и))
4.5
vw6959454vw

See private message.

$21.25 USD за 14 дні(-в)
(48 відгуків(и))
4.4
dimic

See private message.

$34 USD за 14 дні(-в)
(14 відгуків(и))
4.4
alecn2002

See private message.

$102 USD за 14 дні(-в)
(20 відгуків(и))
4.3
drboom

See private message.

$16.15 USD за 14 дні(-в)
(27 відгуків(и))
4.2
winexsoft

See private message.

$12.75 USD за 14 дні(-в)
(19 відгуків(и))
4.0
pgmexpert

See private message.

$3.4 USD за 14 дні(-в)
(5 відгуків(и))
2.6
vw6807901vw

See private message.

$17 USD за 14 дні(-в)
(2 відгуків(и))
2.2
vw7056055vw

See private message.

$8.5 USD за 14 дні(-в)
(3 відгуків(и))
0.0
starscout

See private message.

$17 USD за 14 дні(-в)
(0 відгуків(и))
0.0
aselaben

See private message.

$27.2 USD за 14 дні(-в)
(0 відгуків(и))
0.0
levgvw

See private message.

$25.5 USD за 14 дні(-в)
(0 відгуків(и))
0.0
codeguru2008

See private message.

$42.5 USD за 14 дні(-в)
(1 відгук)
0.0
wickedtoad

See private message.

$42.5 USD за 14 дні(-в)
(0 відгуків(и))
0.0
jimmysprogram

See private message.

$4.25 USD за 14 дні(-в)
(0 відгуків(и))
0.0
tbteam

See private message.

$25.5 USD за 14 дні(-в)
(0 відгуків(и))
0.0