From the project, finish this method to determine if the pla…
From the project, finish this method to determine if the player can move in the requested direction in the maze. //This method should return true if the player can move in the direction and false otherwise. They should not be able to move “out of bounds”. You can assume the maze is rectangular. //currentX and currentY represent the player’s x and y position //requestedDirection is ‘a’ if left is requested, ‘s’ if down is requested, and ‘w’ if up is requested. (‘d’ is omited intentionally.) //mazeData is a 2d array of ints. //mazeData[x][y] is 0 if a wall is present //mazeData[x][y] is 1 if a wall is not present public boolean canMove(int currentX, int currentY, char requestedDirection, int[][] mazeData) { }
Read DetailsCurrently, this linked list has two data members: one of typ…
Currently, this linked list has two data members: one of type GameData and one of type DocData. Dr. Mood wants his linked list’s Node class to only have one data element instead of two. Modify/rewrite/add to the code as you see fit so that you only have one data variable in the Node class instead of two. Do not modify the main. Your solution should still let you hold either a GameData or a DocData inside of the Node class. public class GameData { //game data members and methods. } public class DocData { //doc data members and methods. } public class Node { GameData gameData; //data piece one DocData docData; //data piece two Node next; public void setData(DocData datain) { docData = datain; } public void setData(GameData datain) { gameData = datain; } } public static void main(String[] args) { Node n = new Node(); n.setData(new DocData()); Node n2 = new Node(); n2.setData(new GameData()); }
Read Details