Advertisement
totoyo

[Basic Casio] Tic Tac Toe (morpion)

Oct 31st, 2014
1,164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. "OX"→Str 1
  2. Do
  3. ClrText
  4. {3,3→Dim Mat A
  5. 1→J
  6. 0→Z
  7. "You choose ?"
  8. " 1. O"
  9. " 2. X"
  10. Do
  11. Getkey
  12. LpWhile Ans≠72 And Ans≠62
  13. If Ans=72
  14. Then 0→I
  15. Else 1→I
  16. IfEnd
  17. ClrText
  18. Locate 10,2,"| |"
  19. Locate 9,3,"-+-+-"
  20. Locate 10,4,"| |"
  21. Locate 9,5,"-+-+-"
  22. Locate 10,6,"| |"
  23. 0→Z
  24. Do
  25. Do
  26. Do
  27. Getkey→K
  28. LpWhile Not K
  29. 1-J→J
  30. 0
  31. K=72⇒1:K=62⇒2:K=52⇒3
  32. K=73⇒4:K=63⇒5:K=53⇒6
  33. K=74⇒7:K=64⇒8:K=54⇒9
  34. LpWhile Not Ans
  35. Ans→B
  36. 1+Int ((B-1)Á3→E
  37. 1+3Frac ((B-1)Á3→F
  38. If Not Mat A[E,F
  39. Then I+1→Mat A[E,F
  40. Locate 7+2F,8-2E,StrMid(Str 1,I+1,1)
  41. 1-I→I
  42. Isz Z
  43. IfEnd
  44. 0→G
  45. For 1→B To 3
  46. Mat A[B,1⇒Mat A[B,1]=Mat A[B,2] And Mat A[B,1]=Mat A[B,3⇒1→G
  47. Next
  48. For 1→B To 3
  49. Mat A[1,B⇒Mat A[1,B]=Mat A[2,B] And Mat A[1,B]=Mat A[3,B⇒1→G
  50. Next
  51. Mat A[2,2⇒(Mat A[2,2]=Mat A[1,1])(Mat A[3,3]=Mat A[1,1])+(Mat A[1,3]=Mat A[2,2])(Mat A[1,3]=Mat A[3,1⇒1→G
  52. LpWhile Not G And Z<9
  53. ClrText
  54. If G=1
  55. Then "Player win !"
  56. Locate 8,1,J+1
  57. Else "Ex-aequo !"
  58. IfEnd
  59. "Play again (1=yes)"?→B
  60. LpWhile B=1
  61.  
  62. =====================================================
  63. Totoyo - www.planet-casio.com
  64. Follow me on Youtube : http://youtu.be/pamqtqJcW5M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement