Annulleret

c puzzle

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.

Evner: Ingeniørarbejde, MySQL, PHP, Projekt Ledelse, Software Arkitektur, Software Testning

Se mere: which of the following is not part of configuration management, input board game, fifth third, c# beginning, puzzle game project, load board, read process memory, sliding puzzle game, open input file php, php open input file, open input file, underscore php, tile game, board question, write project specification, puzzle program, slot game program, underscore, write program print empty, memory game php

Om arbejdsgiveren:
( 0 bedømmelser ) Canada

Projekt ID: #3326899

20 freelancere byder i gennemsnit $41 på dette job

marchent

See private message.

$85 USD in 14 dage
(168 bedømmelser)
6.3
bitdonkey

See private message.

$169.15 USD in 14 dage
(111 bedømmelser)
6.1
genergabasa

See private message.

$85 USD in 14 dage
(35 bedømmelser)
5.9
magadhmindslx

See private message.

$29.75 USD in 14 dage
(161 bedømmelser)
5.4
Apogeesolutions

See private message.

$42.5 USD in 14 dage
(68 bedømmelser)
4.5
vw6959454vw

See private message.

$21.25 USD in 14 dage
(48 bedømmelser)
4.4
dimic

See private message.

$34 USD in 14 dage
(14 bedømmelser)
4.4
alecn2002

See private message.

$102 USD in 14 dage
(20 bedømmelser)
4.3
drboom

See private message.

$16.15 USD in 14 dage
(27 bedømmelser)
4.2
winexsoft

See private message.

$12.75 USD in 14 dage
(19 bedømmelser)
4.0
pgmexpert

See private message.

$3.4 USD in 14 dage
(5 bedømmelser)
2.6
vw6807901vw

See private message.

$17 USD in 14 dage
(2 bedømmelser)
2.2
vw7056055vw

See private message.

$8.5 USD in 14 dage
(3 bedømmelser)
0.0
tbteam

See private message.

$25.5 USD in 14 dage
(0 bedømmelser)
0.0
starscout

See private message.

$17 USD in 14 dage
(0 bedømmelser)
0.0
jimmysprogram

See private message.

$4.25 USD in 14 dage
(0 bedømmelser)
0.0
codeguru2008

See private message.

$42.5 USD in 14 dage
(1 bedømmelse)
0.0
levgvw

See private message.

$25.5 USD in 14 dage
(0 bedømmelser)
0.0
aselaben

See private message.

$27.2 USD in 14 dage
(0 bedømmelser)
0.0
wickedtoad

See private message.

$42.5 USD in 14 dage
(0 bedømmelser)
0.0