logo

Project on Development of Game

6 Pages1441 Words65 Views
   

Added on  2020-05-16

Project on Development of Game

   Added on 2020-05-16

ShareRelated Documents
DesignThis project entails the development of a simple game. The developed program has six main classes, namely;ComputerPlayer: This is an abstract class that models a computer player. The Naïve and Smart computer players extends this class and provides implementation to the abstract method “move()” defined in this class. Get15GUI: This class creates the graphical user interface for this game. The class uses a null layout to position various components; with each component Get15Model: the model class contains all data and processing logic for the game. NaivePlayer: Naïve computer play contains an implementation of the move method defined in the abstract class. For the naïve player, a move is generated randomly without any consideration for the appropriateness of the move. SmartPlayer: the smart computer player class implements the move method and adds additional features that allows the play make informed and sometimes aggressive moves to ensure that the computer wins or forces a draw. The classes are generally lined to one another as shown in the class diagram below, which is generated from BlueJ IDE.As seen from the class diagram, both the smart and naïve players inherit the Computer Player and provides implementations for all the abstract methods.
Project on Development of Game_1
TestingTesting the application focused on classes that had some logical computations. As such, the GUIclass was not tested by use of Junit tests, rather it was tested through running of the application.Testing the application commenced after completion of coding. Initial tests were on the GUI toconfirm its proper working. This was followed by intensive testing by use of Junit tests.Testing StrategyA black box testing approach was applied in the testing of the application. The focus was ontesting the proper working of the various methods developed in the main classes of theapplication, without exploring the inner working of the methods. GUI TestingThe graphical user interface was tested manually, with the aim of identifying if it conformed tothe expected levels of operations. Each and every button on the GUI was tested under differentconditions. The tests particularly focused on identifying if the GUI could process button clicks,whether a new game could be stated at any given moment, whether a user could exit the gameand whether buttons selected by computer player were automatically disabled to prevent errorsand double selection. Fig 1.0 GUI Testing; selecting starting player
Project on Development of Game_2
Fig 2.0 GUI TESTING; playing against a Naïve Computer Player. Confirmation that selectedbuttons are automatically disabled to minimize chances of error. Fig 3.0 GUI response after clicking the New Game button. Confirmation that the game can berestarted at any given time; the game requests the user to select the starting play and enables allthe buttons that had been disabled.Unit TestingAfter successfully testing the GUI manually, the next step was to test the inner working of theapplication by use of Junit tests. The classes tested through this approach was the Get15Model.The choice of these classes for unit testing was motivated by the fact that the classes containedmethods with logical computations. Various methods were tested to ascertain their properworking under different conditions and with different data sets.Test ID: J01Description: This test unit tests the generate board method. This board simulates an internallyheld board similar to that used in a Tic Tac Toe game. The board helps ease the process ofmaking smart moves by a smart computer player. The test seeks to identify if the methodgenerates a board as expected. Pre-Condition: Initialize class Get15Model to allow testing of the methodTest Data: A 3x3 board with every index in the array being set with an empty string. The emptypositions mean the value at that position has not been taken yet. Expected Results: we expect that array holding the board to be identical to the array passed bythe method getBoard of the Get15Model class.
Project on Development of Game_3

End of preview

Want to access all the pages? Upload your documents or become a member.