This Tic Tac Toe game has a player vs player mode and a computer vs player mode were the computer always goes first in the top left corner. The computer can only ever be tied or win. In the player vs player mode it doesn’t recognize a winning move until one move after a winning move I need to get this fixed. I’m hoping that I can get a easy and medium level for the computer vs player mode any ways here is the code enjoy and if you find an easier way of scripting this please let me know because it’s a bit long
repeat
script pvp_
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set s1 to "0"
set s2 to "0"
set s3 to "0"
set s4 to "0"
set s5 to "0"
set s6 to "0"
set s7 to "0"
set s8 to "0"
set s9 to "0"
set player1 to "X"
set player2 to "O"
repeat
set move_1 to text returned of (display dialog a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 & "
Where would you like to go?" default answer "")
if move_1 is equal to "1" then
if s1 is equal to "0" then
set a1 to player1
set s1 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "2" then
if s2 is equal to "0" then
set a2 to player1
set s2 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "3" then
if s3 is equal to "0" then
set a3 to player1
set s3 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "4" then
if s4 is equal to "0" then
set a4 to player1
set s4 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "5" then
if s5 is equal to "0" then
set a5 to player1
set s5 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "6" then
if s6 is equal to "0" then
set a6 to player1
set s6 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "7" then
if s7 is equal to "0" then
set a7 to player1
set s7 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "8" then
if s8 is equal to "0" then
set a8 to player1
set s8 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_1 is equal to "9" then
if s9 is equal to "0" then
set a9 to player1
set s9 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
--------------------------------------------------------------
set move_2 to text returned of (display dialog a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 & "
Where would you like to go?" default answer "")
if move_2 is equal to "1" then
if s1 is equal to "0" then
set a1 to player2
set s1 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "2" then
if s2 is equal to "0" then
set a2 to player2
set s2 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "3" then
if s3 is equal to "0" then
set a3 to player2
set s3 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "4" then
if s4 is equal to "0" then
set a4 to player2
set s4 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "5" then
if s5 is equal to "0" then
set a5 to player2
set s5 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "6" then
if s6 is equal to "0" then
set a6 to player2
set s6 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "7" then
if s7 is equal to "0" then
set a7 to player2
set s7 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "8" then
if s8 is equal to "0" then
set a8 to player2
set s8 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if move_2 is equal to "9" then
if s9 is equal to "0" then
set a9 to player2
set s9 to "1"
else
display dialog "That space has already been taken." with icon 0
end if
end if
if s1 & s2 & s3 & s4 & s5 & s6 & s7 & s8 & s9 is equal to ("111111111") then
display dialog "Cats Game!"
exit repeat
end if
if a1 & a2 & a3 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a4 & a5 & a6 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a7 & a8 & a9 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a1 & a4 & a7 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a2 & a5 & a8 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a3 & a6 & a9 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a1 & a5 & a9 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
if a3 & a5 & a7 contains ("XXX") then
display dialog player1 & " Wins!"
exit repeat
end if
------------------------------------------------------------
if a1 & a2 & a3 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a4 & a5 & a6 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a7 & a8 & a9 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a1 & a4 & a7 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a2 & a5 & a8 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a3 & a6 & a9 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a1 & a5 & a9 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
if a3 & a5 & a7 contains ("OOO") then
display dialog player2 & " Wins!"
exit repeat
end if
end repeat
end script
script pvc_
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set move_1 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_1 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_1 is equal to "2" then
run script x_1_2
end if
if move_1 is equal to "3" then
run script x_1_3
end if
if move_1 is equal to "4" then
run script x_1_4
end if
if move_1 is equal to "5" then
run script x_1_5
end if
if move_1 is equal to "6" then
run script x_1_6
end if
if move_1 is equal to "7" then
run script x_1_7
end if
if move_1 is equal to "8" then
run script x_1_8
end if
if move_1 is equal to "9" then
run script x_1_9
end if
script x_1_2
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a2 to player2
set a5 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "3" then
set a9 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "4" then
set a9 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "6" then
set a9 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "7" then
set a9 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "8" then
set a9 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "9" then
set a9 to player2
set a7 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
set a4 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a3 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "6" then
set a4 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a3 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
end script
------------------------->1
script x_1_3
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a3 to player2
set a9 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "2" then
set a5 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "4" then
set a5 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "5" then
set a5 to player2
set a7 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
set a4 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "6" then
set a8 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a8 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a4 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
if move_2 is equal to "6" then
set a5 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "7" then
set a5 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "8" then
set a5 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
-------------------------->2
script x_1_4
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a4 to player2
set a5 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "2" then
set a9 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "3" then
set a9 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "6" then
set a9 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "7" then
set a9 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "8" then
set a9 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "9" then
set a9 to player2
set a3 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
set a7 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "7" then
set a2 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a2 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "2" then
set a7 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
end script
------------------------->3
script x_1_5
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "3" then
run script x_1_5_a_a
end if
if move_2 is equal to "7" then
run script x_1_5_a_b
end if
if move_2 is equal to "2" then
run script x_1_5_b_a
end if
if move_2 is equal to "4" then
run script x_1_5_b_b
end if
if move_2 is equal to "6" then
run script x_1_5_b_c
end if
if move_2 is equal to "8" then
run script x_1_5_b_d
end if
script x_1_5_a_a
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set a3 to player2 --------------------these two change
set a7 to player1 --------------------these two change
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
set a4 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a8 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a4 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "2" then
set a8 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
script x_1_5_a_b
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set a7 to player2 --------------------these two change
set a3 to player1 --------------------these two change
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
set a2 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a6 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a2 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "2" then
set a6 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
script x_1_5_b_a
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set a2 to player2 --------------------these two change
set a8 to player1 --------------------these two change
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_3 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "8" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
set a7 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a7 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "3" then
set a7 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "7" then
set a7 to player2
set a3 to player1
set move_4 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
end if
if move_4 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_4 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "8" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "4" then
set a6 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_4 is equal to "6" then
set a4 to player1
set a6 to player2
display dialog "We Tied
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
script x_1_5_b_b
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set a4 to player2 --------------------these two change
set a6 to player1 --------------------these two change
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_3 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
set a3 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "7" then
set a3 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a3 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "3" then
set a3 to player2
set a7 to player1
set move_4 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
end if
if move_4 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_4 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "6" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "2" then
set a8 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_4 is equal to "8" then
set a8 to player2
set a2 to player1
display dialog "We Tied
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
script x_1_5_b_c
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set a6 to player2 --------------------these two change
set a4 to player1 --------------------these two change
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_3 is equal to "6" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
set a7 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "3" then
set a7 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a7 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "7" then
set a7 to player2
set a3 to player1
set move_4 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
end if
if move_4 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_4 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "6" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "2" then
set a8 to player1
set a2 to player2
display dialog "We Tied
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_4 is equal to "8" then
set a2 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
script x_1_5_b_d
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a5 to player2
set a9 to player1
set a8 to player2 --------------------these two change
set a2 to player1 --------------------these two change
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_3 is equal to "8" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
set a3 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a3 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "7" then
set a3 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "3" then
set a3 to player2
set a7 to player1
set move_4 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
end if
if move_4 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
--------------------------------next two change
if move_4 is equal to "8" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_4 is equal to "6" then
set a4 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_4 is equal to "4" then
set a6 to player1
set a4 to player2
display dialog "We Tied
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end script
end script
--------------------->4
script x_1_6
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a6 to player2
set a5 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "6" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "2" then
set a9 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "3" then
set a9 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "4" then
set a9 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "7" then
set a9 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "8" then
set a9 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "9" then
set a9 to player2
set a3 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "4" then
set a7 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "7" then
set a2 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a2 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "2" then
set a7 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
end script
---------------------->5
script x_1_7
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a7 to player2
set a3 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "6" then
set a2 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "5" then
set a2 to player1
set a5 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "4" then
set a2 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "8" then
set a2 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "9" then
set a2 to player1
set a9 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "2" then
set a2 to player2
set a9 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "6" then
set a5 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "5" then
set a6 to player1
set a5 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a5 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a6 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
end script
-------------------->6
script x_1_8
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a8 to player2
set a5 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "8" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "2" then
set a9 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "3" then
set a9 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "4" then
set a9 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "6" then
set a9 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "7" then
set a9 to player1
set a7 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "9" then
set a9 to player2
set a7 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "8" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "5" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
set a4 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "4" then
set a3 to player1
set a4 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "6" then
set a4 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "2" then
set a3 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
end script
------------------------>7
script x_1_9
set a1 to "1"
set a2 to "2"
set a3 to "3"
set a4 to "4"
set a5 to "5"
set a6 to "6"
set a7 to "7"
set a8 to "8"
set a9 to "9"
set player1 to "X"
set player2 to "O"
set a1 to player1
set a9 to player2
set a7 to player1
set move_2 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_2 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_2 is equal to "2" then
set a4 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "3" then
set a4 to player1
set a3 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "5" then
set a4 to player1
set a5 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "6" then
set a4 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "8" then
set a4 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_2 is equal to "4" then
set a4 to player2
set a3 to player1
set move_3 to text returned of (display dialog "Where would you like to go?
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9 default answer "")
if move_3 is equal to "1" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "9" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "7" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "4" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "3" then
display dialog "That space is taken already!" with icon 0
end if
if move_3 is equal to "2" then
set a5 to player1
set a2 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "5" then
set a2 to player1
set a5 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "6" then
set a5 to player1
set a6 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
if move_3 is equal to "8" then
set a2 to player1
set a8 to player2
display dialog "I won
" & a1 & a2 & a3 & "
" & a4 & a5 & a6 & "
" & a7 & a8 & a9
end if
end if
end script
----------------------------->8 end :)
end script
display dialog "What type of game would you like to play" buttons {"Player v.s. Player", "Player v.s. Computer", "Cancel"} default button 1
if the button returned of the result is "Player v.s. Player" then
run script pvp_
else if the button returned of the result is "Player v.s. Computer" then
run script pvc_
else
exit repeat
end if
end repeat
Model: Mac OS X 10.5.8
AppleScript: 2.2.1
Browser: Firefox 3.6.13
Operating System: Mac OS X (10.7)