Question
In this assignment, you will be strictly adhering to the imperative programming paradigm. This means that objects/classes are not to be created as core operational
In this assignment, you will be strictly adhering to the imperative programming paradigm. This means that objects/classes are not to be created as core operational elements in this solution. Instead, functions performing different tasks along with piece of driver code in main would be appropriate. You will be creating a simulation for a traditional sliding tile puzzle.
When writing a program using the imperative programming paradigm, you should be break the problem down into a series of functions that represent the logical interactions with the puzzle. You should be sending information to and from your functions with arguments and return values in a meaningful, thoughtful way. To know if you are operating within the spirit of the imperative paradigm, you should find yourself breaking the problem down into a series of repeatable, independent tasks that represent the individual functions of your solution. You should then have core driver logic in the main() function that orchestrates a series of calls to these functions to execute the simulation as you see fit.
When completing this project, there are several items to take into consideration upfront You must carefully consider the manner in which you scramble the board initially. In some nave approaches, the tiles are simply lifted and placed into random locations on the board. This may sound good in a pinch, but further mathematical investigation will quickly reveal that this approach will produce a board that cannot be solved 50% of the time. This happens because a solved state as illustrated in the first screen shot below cannot be transformed into a board state in which the 7 and 8 tiles are hypothetically transposed. In essence, there are two distinct sets of board states and a board that is currently set in one state will never move to one of the states in the other family through a series of legal moves (slides). As a result, you must create routine that scrambles the board by making a series of repetitious legal moves to the puzzle in a random fashion.
You must strategically use color to get full credit for this assignment. You can easily change the fore-color and back-color for the Windows console through the Windows API. It would probably be best to get the puzzle working first and then tackle the color second. However, make sure the colors update as the individual moves are made. You might want to set up a small demo for yourself to explore the manner in which colors are changed through the Windows API to get a handle on this before integrating it into your projects code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started