Enter Two Adjacent Location Suap Enter Two Adacent Location Sap Question 1 30 Marks Figure Q31355973
Enter the two adjacent location to suap Enter the two adacent location to sap Question 1 (30 marks) Figure Qlii) Apply C+language to program a puzzle game The puzzle involves arranging a set of thirty- six numbers in an ascending order. The numbers are displayed in a 6×6 grid. These numbers are randomly generated and therefore are not sorted initially. The player has to sort these numbers by swapping two adjacent numbers onc at a timc. A number can bc swapped with another number on its right, left, top or bottom. A number cannot be swapped with a number that is diagonally adjacent to it. Figure Q1 (a)(ii) shows the result if the player has successfully sorted the numbers. Figure Q1(i) shows a sample initial screen of the game with the 36 randomly generated numbers arranged in a 6×6 grid. any key to cerntinue You are required to implement the puzzle game with the following specifications: Figure Qli For example, if the number 5461 is to be moved, then i can be swapped with either the number 2118 (top). 218 (bottom), 5397 (left), or 8145 (right). Any illegal swapping will result in an crror mcssagc bcing displaycd. Figurc Q1(ii) shows the rcsult of playcr swapping the numbers 5461 and 218 in a partially sorted manner Show transcribed image text