Computers and Technology, 12.02.2020 23:08 epmeche05
Need some help creating a tic tac toe math random AI that won't override buttons when that button already has an X or O in it. This is what I have so far:
public void CreateInfo(String ButtonNumber) {
if (XorO == true) {
if (ButtonNumber. equals("One") && B1 == true) {
One = "X";
XorO = false;
B1 = false;
}
if (ButtonNumber. equals("Two") && B2 == true) {
Two = "X";
XorO = false;
B2 = false;
}
if (ButtonNumber. equals("Three") && B3 == true) {
Three = "X";
XorO = false;
B3 = false;
}
if (ButtonNumber. equals("Four") && B4 == true) {
Four = "X";
XorO = false;
B4 = false;
}
if (ButtonNumber. equals("Five") && B5 == true) {
Five = "X";
XorO = false;
B5 = false;
}
if (ButtonNumber. equals("Six") && B6 == true) {
Six = "X";
XorO = false;
B6 = false;
}
if (ButtonNumber. equals("Seven") && B7 == true) {
Seven = "X";
XorO = false;
B7 = false;
}
if (ButtonNumber. equals("Eight") && B8 == true) {
Eight = "X";
XorO = false;
B8 = false;
}
if (ButtonNumber. equals("Nine") && B9 == true) {
Nine = "X";
XorO = false;
B9 = false;
}
}
int max = 9;
int min = 1;
int range = max - min + 1;
int rand = (int) (Math. random() * range) + min;
System. out. println(rand);
if (rand == 1 && BB1 == false) {
One = "O";
XorO = true;
BB1 = true;
}
if (rand == 2 && BB2 == false) {
Two = "O";
XorO = true;
BB2 = true;
}
if (rand == 3 && BB3 == false) {
Three = "O";
XorO = true;
BB3 = true;
}
if (rand == 4 && BB4 == false) {
Four = "O";
XorO = true;
BB4 = true;
}
if (rand == 5 && BB5 == false) {
Five = "O";
XorO = true;
BB5 = true;
}
if (rand == 6 && BB6 == false) {
Six = "O";
XorO = true;
BB6 = true;
}
if (rand == 7 && BB7 == false) {
Seven = "O";
XorO = true;
BB7 = true;
}
if (rand == 8 && BB8 == false) {
Eight = "O";
XorO = true;
BB8 = true;
}
if (rand == 9 && BB9 == false) {
Nine = "O";
XorO = true;
BB9 = true;
}
if (One == "X" && Two == "X" && Three == "X"
|| Four == "X" && Five == "X" && Six == "X"
|| Seven == "X" && Eight == "X" && Nine == "X"
|| One == "X" && Five == "X" && Nine == "X"
|| Three == "X" && Five == "X" && Seven == "X"
|| One == "X" && Four == "X" && Seven == "X"
|| Two == "X" && Five == "X" && Eight == "X"
|| Three == "X" && Six == "X" && Nine == "X") {
One = "X Wins!";
}
if (One == "O" && Two == "O" && Three == "O"
|| Four == "O" && Five == "O" && Six == "O"
|| Seven == "O" && Eight == "O" && Nine == "O"
|| One == "O" && Five == "O" && Nine == "O"
|| Three == "O" && Five == "O" && Seven == "O"
|| One == "O" && Four == "O" && Seven == "O"
|| Two == "O" && Five == "O" && Eight == "O"
|| Three == "O" && Six == "O" && Nine == "O") {
One = "O Wins!";
}
}
}
Answers: 3
Computers and Technology, 22.06.2019 06:00
In outlook how can cherie look at the details of an event that appears on the month view of her calendar? check all that apply. by switching to the detail view by switching to the week view by switching to the day view by right-clicking on the event by double-clicking on the event by highlighting the event
Answers: 2
Computers and Technology, 24.06.2019 01:10
Create a program that will take in a single x and y coordinate as the origin. after the input is provided, the output should be all of the coordinates (all 26 coordinates read from the “coordinates.json” file), in order of closest-to-farthest from the origin.
Answers: 1
Computers and Technology, 24.06.2019 12:30
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion is this and example of
Answers: 1
Computers and Technology, 25.06.2019 16:00
Which formulas would work to combine cells with first, middle, and last names from columns a through c and row 2 into a new cell?
Answers: 1
Need some help creating a tic tac toe math random AI that won't override buttons when that button al...
History, 23.04.2020 21:43
Biology, 23.04.2020 21:43
Mathematics, 23.04.2020 21:44
Biology, 23.04.2020 21:44
Chemistry, 23.04.2020 21:45
Engineering, 23.04.2020 21:45
Mathematics, 23.04.2020 21:45
Mathematics, 23.04.2020 21:46
English, 23.04.2020 21:46
Spanish, 23.04.2020 21:46