(String[] args)
| 110 | |
| 111 | } |
| 112 | public static void main(String[] args) { |
| 113 | // creating a tic tac toe game.r=5 ,c=5 |
| 114 | char [][] gboard={ |
| 115 | {' ','|',' ','|',' '}, |
| 116 | {'-','|','-','|','-'}, |
| 117 | {' ','|',' ','|',' '}, |
| 118 | {'-','|','-','|','-'}, |
| 119 | {' ','|',' ','|',' '}, |
| 120 | }; |
| 121 | print_board(gboard); |
| 122 | Scanner sc = new Scanner(System.in); |
| 123 | while(true){ |
| 124 | System.out.print("Enter values from 1 to 9 :"); |
| 125 | int user_pos=sc.nextInt(); |
| 126 | while(ur_set.contains(user_pos)|| comp_set.contains(user_pos)){ |
| 127 | System.out.println(); |
| 128 | System.out.print("Retry , Enter values from 1 to 9 :"); |
| 129 | user_pos=sc.nextInt(); |
| 130 | } |
| 131 | p_holder(gboard,user_pos,"Me"); |
| 132 | |
| 133 | String res=check_winner(); |
| 134 | if(res.length()>0) |
| 135 | { |
| 136 | System.out.println(res); |
| 137 | break; |
| 138 | } |
| 139 | |
| 140 | int comp_pos=generate_rd(); |
| 141 | while(ur_set.contains(comp_pos)|| comp_set.contains(comp_pos)){ |
| 142 | |
| 143 | comp_pos=generate_rd(); |
| 144 | } |
| 145 | p_holder(gboard,comp_pos,"Comp"); |
| 146 | |
| 147 | res=check_winner(); |
| 148 | if(res.length()>0) |
| 149 | { |
| 150 | System.out.println(res); |
| 151 | break; |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |
nothing calls this directly
no test coverage detected