[Solved] SOLVED:Carcassonne Recursion solution

30 $

File Name: SOLVED:Carcassonne_Recursion_solution.zip
File Size: 348.54 KB

SKU: [Solved] SOLVED:Carcassonne Recursion solution Category: Tag:

Or Upload Your Assignment Here:


Your task for this homework is to solve tile placement puzzles inspired by the board game “Carcassonne” using the technique of recursion. You can read more and see examples of the the full game here: http://en.wikipedia.org/wiki/Carcassonne_(board_game) http://norvig.com/carcassonne.html Understanding the non-linear word search program from Lectures 13 & 14 will be helpful in thinking about how you will solve this type of problem. We strongly urge you to study and play with that program, including tracing through its behavior using a debugger or cout statements or both. Please carefully read the entire assignment and study the provided code before beginning your implementation. You will be given a sequence of square tiles that must be played one at a time onto a two-dimensional grid board. Each of the four tile sides is labeled as “road”, “city”, or “pasture”. The first tile may be played anywhere, but each following tile must touch a previously played tile along an edge. All touching tile edges must match. All tiles must be played in the order given – the sequence may not be rearranged. Finally, for our version of this game, a board layout is a “Solution” only if every “road” and “city” tile edge has a matching neighbor tile touching it. The only tile edges without neighbors should be labeled “pasture”. A tile with 0 or 1 road edges and no city edges is called an abbey tile and we draw a little building on the tile. Note that not all labelings of road/edge/pasture are legal tiles. (And, we use a simpler set than the original board game.) The provided code will check for illegal tiles in the input. You may assume that all input files are properly formatted and use only legal tiles. Below is a sample input file (puzzle5.txt). The keyword tile is followed by four strings that specify the edges of the tile in the north, east, south, and west directions. On the right is a diagram showing these tiles arranged to form the only solution for this particular tile puzzle. Pastures are green, cities are brown, and roads are thick black lines. Note the numbers on each tile, which correspond to the line number from the input file. Every tile touches the edge of at least one tile with a smaller number that was played earlier in the game. tile road road road pasture tile city city road road tile pasture road road pasture tile road pasture city road tile road road pasture pasture tile road pasture pasture road tile pasture pasture pasture city tile pasture pasture road pasture N E S W 2 3 4 8 7 56 1 Your program will expect one or more command line arguments, e.g.: ./carcassonne.exe puzzle5.txt -board_dimensions 4 3 ./carcassonne.exe puzzle5.txt -board_dimensions 4 3 -all_solutions ./carcassonne.exe puzzle5.txt -board_dimensions 4 3 -allow_rotations ./carcassonne.exe puzzle5.txt -allow_rotations -all_solutions The first argument specifies the name of the input puzzle file. To begin, we recommend that you also use the optional argument -board_dimensions

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Carcassonne Recursion solution
30 $