1. Introduction This coursework requires you to develop a B specification of a version of the Battleships board game. Th
Posted: Tue Jul 05, 2022 10:25 am
(e) Operations The four Battleships game operations are report <--Blayer DeployFleet( ships ) Player 1 places their 3 ships on their own grid, by recording their positions on the grid if the ships are all placed in valid and position then the operation reports su otherwise it reports an eror message indicating what the error was report <-- Bayer DeployFleet( ships ) Player 2 places their 3 ships on their own grid, sinary to the Player 1 operation report <-- Playeri_Shootat target Player 1 shoots at the target square on Player 2's grid. If there is a sho square the ship is deleted and the operation reports at the hit sh in Player 2's foot the game is over and reports that the feet a otherwise there is no ship in the target square the operation reports as the target square is not in the grid it reports an error message 65ENG001W Refered Course 2 report <--Player2_Shootst target) Player 2 shoots at the target square on Player T's grid Operation is similar to the Player 1 operation Note that all operation must output the outcome of an operation, le succes the reason why it failed with an appropriate error message d) Enquiry Operations You must also specify the following enquiry operations, that all output information about the state of the game shipsquares - Locationships (player) Outputs the location of all the ships left in the player's feet shipsCount <-- Shipsteft(player) Outputs the number of ships let in the player's feet shatCount -- Shotstaken(player) target last one Outputs the number of shots taken by the player report - Gaver Outputs a message reporting the game is over. Le one of the players has won 2.2 General Requirements The specification should use the appropriate features to define the data & operations in any machines that you define. The overall structure of the specification can be ther A single B machine that contains all of the state information and operations, etc • A collection of machines that together contain all of the state information and operations, etc. The appropriate 8 structuring features must be used to combine the collection of B machines You should only submit one specification either a single B machine or a collection of S machines, but not both. More marks are available for a multi-machine specification than a single machine specification The specification must be syntactically & type comect, as checked by using the Atelier tool The specification must be animated by Prol. That is it must initialise comectly & all operations can be animated successfully & can be used to place ships and shoot at ship ENG001W RefCourse 2 3. Hoare Logic 10
3. Hoare Logic A simple strategy for choosing targets is to scan the opponent's map row by now, as implemented in the program P given below (modelling only coordinates not map cont *** P wide x 10 y 10 do 10th x end ****1 X+0 y*y*1 end (4) Show that the formula 10 & yox10 is a loop invariant for the while loop in P (b) Show that satses the Hoarele x=10&&y=101 by determining the intermediate assertions for each point i invariant from part() 4. Blackboard Submission The following 5 components are to be submited via Blackboard (1) The Structure Diagram of the Battleships Game machines) You must also include as a note with the diagrama "Plain English explanation of the "state invariants of the system Examples of Structure Diagrams can be found in the lecture notes and in the tutorial exercises. SENGODTWD Coursework 2 SUBMIT: 1 "PDF" gram using the loop [10 MARKS] (2) The Specification of the Battleships Game System, ie, the abstract machine SUBMIT B machines) a plain ASCII Text is "mch 150 MARKS] 140 (3) Examples of successfully using the 2B tools Alser Band Pro For Atelier a single screen shot showing Aller's mainwindow with the successful type checking of all machines in the specification, the specification box with the green TC circle For Proß: a Graph representation of a complete Pro Animation Session history. Using Proß perform an animation session that shows a game being played from start to finish, that includes shots that are hits and misses View this Animation Session a a DOT graph and then save SUBMIT (4) The Hoare Logic proofs 1 Atelier screen shot in either "jpg" or "jpeg" format 1 Pro animation graph "dor e as is (DO NOT open using Word) SUBMIT Hore Logic document as a POF [10 MARKS DeMARKS]