|
| 1 | +#API |
| 2 | +##Class Name: TicTacToe |
| 3 | + |
| 4 | +##Fields |
| 5 | + |
| 6 | +| Name| Data Type| Description| |
| 7 | +|:--------------|:------------------|-------------------------------------| |
| 8 | +| Board| Array of Arrays| Stores the values in the board| |
| 9 | +| currentPlayer| Integer| Who is the current Player?| |
| 10 | +| currentValue| String| What is the current Value? (X or O)| |
| 11 | +| blank (" ")| String| Blank String for comparing| |
| 12 | +| X ("X")| String| String Letter "X" for comparing| |
| 13 | +| O ("O")| String| String Letter "O" for comparing| |
| 14 | + |
| 15 | + |
| 16 | +##Methods - User Interface |
| 17 | +Methods used for creating the User Interface |
| 18 | + |
| 19 | +| Name| Parameters| Return Type| Description| |
| 20 | +|:-------------------------|:---------------|--------------------|---------------------------------------------------| |
| 21 | +| TicTacToe (Constructor)| None| Object (TicTacToe)| Creates an instance of class| |
| 22 | +| drawBoard| None| Void| Draws the Tic Tac Toe Grid| |
| 23 | +| UI| None| Void| Draws the Interface for Input & Grid| |
| 24 | + |
| 25 | + |
| 26 | +##Methods - Change Interface |
| 27 | +Methods used for changing the User Interface |
| 28 | + |
| 29 | +| Name| Parameters| Return Type| Description| |
| 30 | +|:-------------------------|:-------------------------------|--------------------|---------------------------------------------------| |
| 31 | +| changeCurrentPlayer| None| Void| Changes the Current Player & value| |
| 32 | +| setX| Position (int)| Void| Changes Value from blank to X at given position| |
| 33 | +| setO| Position (int)| Void| Changes Value from blank to O at given position| |
| 34 | + |
| 35 | + |
| 36 | +##Methods - Helpher Methods for Changing the Interface |
| 37 | +Helper Methods used for Main Methods of Changing the Interface |
| 38 | + |
| 39 | +| Name| Parameters| Return Type| Description| |
| 40 | +|:-------------------------|:-------------------------------|--------------------|---------------------------------------------------| |
| 41 | +| currentValue| Position (int)| String| Returns the corresponding value at given position| |
| 42 | +| setValue| Position (int), Value (String)| Void| Sets the given value at given position| |
| 43 | +| remainder| Dividend (int), Divisior (int)| Integer| Returns the Remainder of given values| |
| 44 | + |
| 45 | + |
| 46 | +##Logical Methods - Checking the Conditions |
| 47 | + |
| 48 | +Main Logic to check if the player is won or game is draw. |
| 49 | + |
| 50 | +| Name| Parameters| Return Type| Description| |
| 51 | +|:-------------------------|:-------------------------------|--------------------|---------------------------------------------------| |
| 52 | +| checkIfWon| Void| Boolean| Check if the player is won| |
| 53 | +| checkIfDraw| Void| Boolean| Check if the game is draw| |