README.md
1 --- 2 title: Assignment 5 3 subtitle: Hangman Game 4 launch-date: 2024-10-23T06:15Z 5 due-date: 2024-11-01T21:59Z 6 date: 2024-11-01T22:53Z 7 --- 8 9 Design, implement and test a Java that program 10 that creates a 9x9 grid with 10 randomly placed objects, 11 and then calculates the distances to the nearest object (if any) 12 from the middle cell in north, east, south, and west direction. 13 14 Have your program print a textual representation 15 of the grid along with the 4 distance values. 16 Example: 17 18 ``` 19 . . . . o . . . . 20 . . o . . . . . . 21 . . . . . . . . o 22 . . . . . . . . . 23 . . . o X . . . . 24 . . . . . o . . . 25 . . . . . . . o o 26 . . . . o . o . . 27 . . . . o . . . . 28 Distance NORTH = 4 29 Distance EAST = 5 30 Distance SOUTH = 3 31 Distance WEST = 1 32 ``` 33 34 Here, 'X' represents the middle point, 35 i.e, grid cell (4,4), '.' represent empty cells, and 'o' represent objects. 36 (In a direction where there is no obstacle, 37 the distance is the number of steps that would take X out of the grid.) 38 39 Remember (always) to **comment your program**! 40 41 ---- 42 43 ```{.java include="GridCore.java" code-line-numbers="true"} 44 ``` 45 46 [Source](https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3YzABgyz2D36LiKe3YcdJ6PcDCXM/tree/assign6/README.md)