|
01
02 /**
03 * All about my helper classclass is a group of fields and methods used for making objects.
04 * @authorthis is the Javadoc tag for documenting who created the source code hunt
05 */
06 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects Board
07 {open braces start code blocks and must be matched with a close brace
08
09 privateprivate is used to restrict access to the current class only charchar is the type for a single letter or symbol and it is short for character moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
10
11 publicpublic is used to indicate unrestricted access (any other class can have access) Board()
12 {open braces start code blocks and must be matched with a close brace
13
14 moveLocs =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor charchar is the type for a single letter or symbol and it is short for character[brackets are typically used to declare, initialize and index (indicate which element of) arrays 9 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
15
16 charchar is the type for a single letter or symbol and it is short for character ctr =this assignment operator makes the left side equal to the right side '1';
17
18 forfor is a looping structure for repeatedly executing a block of code ( intint is the type for whole numbers and it is short for integer i =this assignment operator makes the left side equal to the right side 0; i < 9; i++this is the increment operator, which increases the variable by 1 )
19 {open braces start code blocks and must be matched with a close brace
20 moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays i ]brackets are typically used to declare, initialize and index (indicate which element of) arrays =this assignment operator makes the left side equal to the right side ctr;
21 ctr++this is the increment operator, which increases the variable by 1;
22 }close braces end code blocks and must match an earlier open brace
23
24 }close braces end code blocks and must match an earlier open brace // end constructor
25
26 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value clearBoard()
27 {open braces start code blocks and must be matched with a close brace
28 charchar is the type for a single letter or symbol and it is short for character ctr =this assignment operator makes the left side equal to the right side '1';
29
30 forfor is a looping structure for repeatedly executing a block of code ( intint is the type for whole numbers and it is short for integer i =this assignment operator makes the left side equal to the right side 0; i < 9; i++this is the increment operator, which increases the variable by 1 )
31 {open braces start code blocks and must be matched with a close brace
32 moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays i ]brackets are typically used to declare, initialize and index (indicate which element of) arrays =this assignment operator makes the left side equal to the right side ctr;
33 ctr++this is the increment operator, which increases the variable by 1;
34 }close braces end code blocks and must match an earlier open brace
35
36 }close braces end code blocks and must match an earlier open brace // end clearBoard()
37
38 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value printBoard()
39 {open braces start code blocks and must be matched with a close brace
40
41 System.out.println( " " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 0 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together " | " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 1 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together " | " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 2 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together
42 "---|---|---" +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together
43 " " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 3 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together " | " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 4 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together " | " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 5 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together
44 "---|---|---" +adds two numbers together or concatenates Strings together "\n" +adds two numbers together or concatenates Strings together
45 " " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 6 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together " | " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 7 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together " | " +adds two numbers together or concatenates Strings together moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays 8 ]brackets are typically used to declare, initialize and index (indicate which element of) arrays +adds two numbers together or concatenates Strings together "\n" );
46 }close braces end code blocks and must match an earlier open brace
47
48 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value makeMove( intint is the type for whole numbers and it is short for integer loc, charchar is the type for a single letter or symbol and it is short for character c )
49 {open braces start code blocks and must be matched with a close brace
50 moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays loc ]brackets are typically used to declare, initialize and index (indicate which element of) arrays =this assignment operator makes the left side equal to the right side c;
51 }close braces end code blocks and must match an earlier open brace
52
53 publicpublic is used to indicate unrestricted access (any other class can have access) charchar is the type for a single letter or symbol and it is short for character getChar( intint is the type for whole numbers and it is short for integer x )
54 {open braces start code blocks and must be matched with a close brace
55 returnreturn means to provide the result of the method and/or cease execution of the method immediately moveLocs[brackets are typically used to declare, initialize and index (indicate which element of) arrays x ]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
56 }close braces end code blocks and must match an earlier open brace
57
58 }close braces end code blocks and must match an earlier open brace // end class Board
|