manuelGame - VadimKachevski/OOP_Ex3 GitHub Wiki
This class represents the Manuel phase of the Maze of Waze.
This class is represented by a single object of MyGameGui.
The functions of this class are as follows
public manualGame(MyGameGUI mgg) - a constructor which gets an already build up object of MyGameGui and saves it as its own.
public void play(String gameNumStr) - this method receives a string which represents the scenario of the game (which level the user chose to play) and if itโs a valid input it calls the startGame method for running the auto phase.
private void startGame(int numberOfGame) - by a given of a valid number verified by the previous method, this function starts the game by setting up the server and painting the game. In addition this method updates the valid position of the fruits and Bots as they change while the game is running by the user.
private void move(game_service game) โ This method moves the Bot by using the assistance of the next method (nextNodeManuel method), and sends it to the server for updating the data.
private int nextNodeManual(game_service game) โ In this method the magic of the manual phase works. Here by every click this function know if itโs the turn of the Bot to be Moved to the Node that was select or the turn of the Bot to be chosen. By every click the information is send to the StdDraw_GameGui method which receives the location of the mouse when it was clicked. If the location is on the spot of the position of a Bot or Node (depends who's turn is it to take place) by a deviation of 0.008 then the Bot is chosen or the bot moves to the selected Node.