Reference no: EM132260069
LAB Assignment - A game of Hex
To create 6*6 hex game use C++.
Objectives:
1. Work with multiple processes
2. Become familiar with Inter-Process Communication
3. Gain experience with an IDE
You may write the program in any language that is supported under any Integrated Development Environment (IDE). Keep in mind that more help may be available to you in some languages (such as C or C++) than in others. You must demo your lab in class on the due date. If lab is done in a pair, one of the members will present it. You may bring a laptop to demo the program.
You are to implement a game of Hex. Your implementation should consist of three processes. Each process must have a visible window as it runs. The main process is the manager. It should start the other two (player) processes and manage the game. It is responsible for evaluating the game and declaring a winner or a tie. The player processes may be two copies of the same program. Use whatever mechanism you wish to coordinate among the manager and the player processes. You must include enough information in the displays of the player processes to convince me that the two processes are making the moves.
Hex is a 2-player game. In this case the two players are the child processes. You will simulate a 6x6 hex board. Here is a sample board.
The rules of Hex are very simple: The players take turns placing opposite colored markers on empty hexagons on the board. The players attempt to connect opposite sides of the board with a continuous line of pieces. (The line does not have to be horizontal or diagonal - it can twist and turn as it crosses the board. The first player must connect the (more or less) vertical sides, and the second player must connect the horizontal sides. The first player to connect his two sides of the board is the winner.
You must show a game board on the manager process window so that the user can see the status of the game. The board does not have to be this elaborate.
The manager process will tell one of the player processes to make a move. Once the move is made and communicated back to the manager, the manager will update its display, decide if there is a winner, and if not, it will then ask the other player to make a move. Deciding if there is a winner may end up being one of the more interesting challenges of this lab. The player processes do not have to have a strategy - they can just move at random. It will probably be more interesting if you try to make a player's next move somewhere close to its last move, although I believe it has been proved that the game can never end in a draw.
If the parent process detects a winner, it should display a message in its window about the outcome of the game and give the user an option to play again or terminate the game. If the user elects to terminate the game, then the parent should end the game in an orderly way. i.e., the child processes should be stopped first and then the parent process can terminate. Again, this should be done in such a manner that I could see that each child (or both) has ended before the parent ends. If the user elects to play again then the players will have to be able to reinitialize the game and to realize that they are being told to do so. You must provide for the mode: computer vs. computer; the mode of computer vs. human is optional (see extra points below). Note that the game itself is not the point of this lab. If you need to make assumptions, do so. When in doubt, ask.
Write-up: You should submit a write-up which should include any known bugs and limitations in your programs. If you made any assumptions, document what you decided. This write-up should be submitted along with your code. Ideally, your program will be written with Visual Studio and I will be able to use the instructions in your write-up to run your program without your being there.
Attachment:- Assignment File.rar