Professional Documents
Culture Documents
Exer 8
Exer 8
This is the last set of exercises for this semester. This means that you will have no new exercises next week, but the practical classes will take place so that you can have these exercises signed-off. I am aware that you have also project 2 to think about, which is another reason for not giving you any more exercises for next week.
then the output should be: Write the method in two ways:
so that the numbers are moved within a singel array so that a new array is created which contains the numbers in reverse order.
Write a program which calls the two versions of the method to test them for correctness.
in which the resulting array is obtaining by appending the elements of the array to the elements of the array b.
Test whether an attempted move is valid (i.e. is the position into which the move is being attempted is in fact free. Test whether a valid move results in the game being won
[Note that it is possible for a game to end in a draw, with the grid being filled without either player creating a line.]
Place the number 1 in the middle of the bottom row. Each time you place a number, the next number should be placed in the next row down, and one place to the right, wrapping round from the right hand to the left, and from the bottom rowto the top as necessary. If the position is occupied, then place the number in the position immediately above the position where the last number was placed.
Write a program that implements this algorithm and displays the resulting magic square. Use the method developed in Exercise 8.4 to check that the square produced has the required properties of a magic square. May I remind you yet again that you should document all your programs both with comments, and by use of the README file associated with each exercise.