Advertisement
Alexandro2003

3 EN RAYA EN VISUAL BASIC 6.0

Apr 23rd, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim a, b, c, d, e, f, g, h, i As Boolean   'leen si el jugador X ocupa un casillero
  2. Dim a2, b2, c2, d2, e2, f2, g2, h2, i2 As Boolean    'leen si el jugador O ocupa un casillero
  3. Dim a3, b3, c3, d3, e3, f3, g3, h3, i3 As Boolean    'leen si hay un casillero ocupado sin importar quien lo ocupa
  4. Dim w As Boolean             'lee si el jugador ya agoto su turno
  5.  
  6. Private Sub Command10_Click()
  7. End
  8. End Sub
  9.  
  10. Private Sub Form_Load()
  11.  
  12.  
  13. a = False
  14. b = False
  15. c = False
  16. d = False
  17. e = False
  18. f = False
  19. g = False
  20. h = False
  21. i = False
  22. a2 = False
  23. b2 = False
  24. c2 = False
  25. d2 = False
  26. e2 = False
  27. f2 = False
  28. g2 = False
  29. h2 = False
  30. i2 = False
  31. a3 = False
  32. b3 = False
  33. c3 = False
  34. d3 = False
  35. e3 = False
  36. f3 = False
  37. g3 = False
  38. h3 = False
  39. i3 = False
  40.  
  41.  
  42. w = True
  43.  
  44.  
  45. End Sub
  46.  
  47. Private Sub Command1_Click()
  48. Text1.Text = "MENSAJE"
  49. If a3 = True Then                 'si la casilla esta ocupada
  50. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  51. ElseIf w = True Then
  52.    If vx.Visible = True Then    'sino, si es el turno de la x
  53.   Command1.Caption = "X"       'imprime x
  54.   a = True                     'casillero ocupado por x
  55.   a3 = True                    'casillero ocupado
  56.   w = False
  57.    ElseIf w = True Then
  58.    Text1.Text = "Ya paso tu turno"
  59.    End If
  60. ElseIf w = False Then
  61.    If vo.Visible = True Then    'sino, si es el turno de o
  62.   Command1.Caption = "O"           'imprime o
  63.   a2 = True                        'casillero ocupado por o
  64.   a3 = True                     'casillero ocupado
  65.   w = True
  66.    ElseIf w = False Then
  67.    Text1.Text = "Ya paso tu turno"
  68.    End If
  69. End If                           'fin de condicionales
  70. End Sub
  71.  
  72. Private Sub Command2_Click()
  73. Text1.Text = "MENSAJE"
  74. If b3 = True Then                 'si la casilla esta ocupada
  75. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  76. ElseIf w = True Then
  77.    If vx.Visible = True Then    'sino, si es el turno de la x
  78.   Command2.Caption = "X"       'imprime x
  79.   b = True                     'casillero ocupado por x
  80.   b3 = True                    'casillero ocupado
  81.   w = False
  82.    ElseIf w = True Then
  83.    Text1.Text = "Ya paso tu turno"
  84.    End If
  85. ElseIf w = False Then
  86.    If vo.Visible = True Then    'sino, si es el turno de o
  87.   Command2.Caption = "O"           'imprime o
  88.   b2 = True                        'casillero ocupado por o
  89.   b3 = True                     'casillero ocupado
  90.   w = True
  91.    ElseIf w = False Then
  92.    Text1.Text = "Ya paso tu turno"
  93.    End If
  94. End If                           'fin de condicionales
  95. End Sub
  96.  
  97. Private Sub Command3_Click()
  98. Text1.Text = "MENSAJE"
  99. If c3 = True Then                 'si la casilla esta ocupada
  100. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  101. ElseIf w = True Then
  102.    If vx.Visible = True Then    'sino, si es el turno de la x
  103.   Command3.Caption = "X"       'imprime x
  104.   c = True                     'casillero ocupado por x
  105.   c3 = True                    'casillero ocupado
  106.   w = False
  107.    ElseIf w = True Then
  108.    Text1.Text = "Ya paso tu turno"
  109.    End If
  110. ElseIf w = False Then
  111.    If vo.Visible = True Then    'sino, si es el turno de o
  112.   Command3.Caption = "O"           'imprime o
  113.   c2 = True                        'casillero ocupado por o
  114.   c3 = True                     'casillero ocupado
  115.   w = True
  116.    ElseIf w = False Then
  117.    Text1.Text = "Ya paso tu turno"
  118.    End If
  119. End If                           'fin de condicionales
  120. End Sub
  121.  
  122. Private Sub Command4_Click()
  123. Text1.Text = "MENSAJE"
  124. If d3 = True Then                 'si la casilla esta ocupada
  125. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  126. ElseIf w = True Then
  127.    If vx.Visible = True Then    'sino, si es el turno de la x
  128.   Command4.Caption = "X"       'imprime x
  129.   d = True                     'casillero ocupado por x
  130.   d3 = True                    'casillero ocupado
  131.   w = False
  132.    ElseIf w = True Then
  133.    Text1.Text = "Ya paso tu turno"
  134.    End If
  135. ElseIf w = False Then
  136.    If vo.Visible = True Then    'sino, si es el turno de o
  137.   Command4.Caption = "O"           'imprime o
  138.   d2 = True                        'casillero ocupado por o
  139.   d3 = True                     'casillero ocupado
  140.   w = True
  141.    ElseIf w = False Then
  142.    Text1.Text = "Ya paso tu turno"
  143.    End If
  144. End If                           'fin de condicionales
  145. End Sub
  146.  
  147. Private Sub Command5_Click()
  148. Text1.Text = "MENSAJE"
  149. If e3 = True Then                 'si la casilla esta ocupada
  150. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  151. ElseIf w = True Then
  152.    If vx.Visible = True Then    'sino, si es el turno de la x
  153.   Command5.Caption = "X"       'imprime x
  154.   e = True                     'casillero ocupado por x
  155.   e3 = True                    'casillero ocupado
  156.   w = False
  157.    ElseIf w = True Then
  158.    Text1.Text = "Ya paso tu turno"
  159.    End If
  160. ElseIf w = False Then
  161.    If vo.Visible = True Then    'sino, si es el turno de o
  162.   Command5.Caption = "O"           'imprime o
  163.   e2 = True                        'casillero ocupado por o
  164.   e3 = True                     'casillero ocupado
  165.   w = True
  166.    ElseIf w = False Then
  167.    Text1.Text = "Ya paso tu turno"
  168.    End If
  169. End If                           'fin de condicionales
  170. End Sub
  171.  
  172. Private Sub Command6_Click()
  173. Text1.Text = "MENSAJE"
  174. If f3 = True Then                 'si la casilla esta ocupada
  175. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  176. ElseIf w = True Then
  177.    If vx.Visible = True Then    'sino, si es el turno de la x
  178.   Command6.Caption = "X"       'imprime x
  179.   f = True                     'casillero ocupado por x
  180.   f3 = True                    'casillero ocupado
  181.   w = False
  182.    ElseIf w = True Then
  183.    Text1.Text = "Ya paso tu turno"
  184.    End If
  185. ElseIf w = False Then
  186.    If vo.Visible = True Then    'sino, si es el turno de o
  187.   Command6.Caption = "O"           'imprime o
  188.   f2 = True                        'casillero ocupado por o
  189.   f3 = True                     'casillero ocupado
  190.   w = True
  191.    ElseIf w = False Then
  192.    Text1.Text = "Ya paso tu turno"
  193.    End If
  194. End If                           'fin de condicionales
  195. End Sub
  196.  
  197. Private Sub Command7_Click()
  198. Text1.Text = "MENSAJE"
  199. If g3 = True Then                 'si la casilla esta ocupada
  200. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  201. ElseIf w = True Then
  202.    If vx.Visible = True Then    'sino, si es el turno de la x
  203.   Command7.Caption = "X"       'imprime x
  204.   g = True                     'casillero ocupado por x
  205.   g3 = True                    'casillero ocupado
  206.   w = False
  207.    ElseIf w = True Then
  208.    Text1.Text = "Ya paso tu turno"
  209.    End If
  210. ElseIf w = False Then
  211.    If vo.Visible = True Then    'sino, si es el turno de o
  212.   Command7.Caption = "O"           'imprime o
  213.   g2 = True                        'casillero ocupado por o
  214.   g3 = True                     'casillero ocupado
  215.   w = True
  216.    ElseIf w = False Then
  217.    Text1.Text = "Ya paso tu turno"
  218.    End If
  219. End If                           'fin de condicionales
  220. End Sub
  221.  
  222. Private Sub Command8_Click()
  223. Text1.Text = "MENSAJE"
  224. If h3 = True Then                 'si la casilla esta ocupada
  225. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  226. ElseIf w = True Then
  227.    If vx.Visible = True Then    'sino, si es el turno de la x
  228.   Command8.Caption = "X"       'imprime x
  229.   h = True                     'casillero ocupado por x
  230.   h3 = True                    'casillero ocupado
  231.   w = False
  232.    ElseIf w = True Then
  233.    Text1.Text = "Ya paso tu turno"
  234.    End If
  235. ElseIf w = False Then
  236.    If vo.Visible = True Then    'sino, si es el turno de o
  237.   Command8.Caption = "O"           'imprime o
  238.   h2 = True                        'casillero ocupado por o
  239.   h3 = True                     'casillero ocupado
  240.   w = True
  241.    ElseIf w = False Then
  242.    Text1.Text = "Ya paso tu turno"
  243.    End If
  244. End If                           'fin de condicionales
  245. End Sub
  246.  
  247. Private Sub Command9_Click()
  248. Text1.Text = "MENSAJE"
  249. If i3 = True Then                 'si la casilla esta ocupada
  250. Text1.Text = "La casilla esta ocupada"   'imprime la casilla esta ocupada
  251. ElseIf w = True Then
  252.    If vx.Visible = True Then    'sino, si es el turno de la x
  253.   Command9.Caption = "X"       'imprime x
  254.   i = True                     'casillero ocupado por x
  255.   i3 = True                    'casillero ocupado
  256.   w = False
  257.    ElseIf w = True Then
  258.    Text1.Text = "Ya paso tu turno"
  259.    End If
  260. ElseIf w = False Then
  261.    If vo.Visible = True Then    'sino, si es el turno de o
  262.   Command9.Caption = "O"           'imprime o
  263.   i2 = True                        'casillero ocupado por o
  264.   i3 = True                     'casillero ocupado
  265.   w = True
  266.    ElseIf w = False Then
  267.    Text1.Text = "Ya paso tu turno"
  268.    End If
  269. End If                           'fin de condicionales
  270. End Sub
  271.  
  272. Private Sub vx_Click()
  273.  
  274. 'VERIFICA SI HAY GANADOR O EMPATE
  275.  
  276. If a = True And b = True And c = True Then
  277. Text1.Text = "GANASTE CRUZ!!"
  278. Beep
  279. volver.Visible = True
  280. txt_x.Text = txt_x.Text + 1
  281. ElseIf d = True And e = True And f = True Then
  282. Text1.Text = "GANASTE CRUZ!!"
  283. Beep
  284. volver.Visible = True
  285. txt_x.Text = txt_x.Text + 1
  286. ElseIf g = True And h = True And i = True Then
  287. Text1.Text = "GANASTE CRUZ!!"
  288. Beep
  289. volver.Visible = True
  290. txt_x.Text = txt_x.Text + 1
  291. ElseIf a = True And d = True And g = True Then
  292. Text1.Text = "GANASTE CRUZ!!"
  293. Beep
  294. volver.Visible = True
  295. txt_x.Text = txt_x.Text + 1
  296. ElseIf b = True And e = True And h = True Then
  297. Text1.Text = "GANASTE CRUZ!!"
  298. Beep
  299. volver.Visible = True
  300. txt_x.Text = txt_x.Text + 1
  301. ElseIf c = True And f = True And i = True Then
  302. Text1.Text = "GANASTE CRUZ!!"
  303. Beep
  304. volver.Visible = True
  305. txt_x.Text = txt_x.Text + 1
  306. ElseIf a = True And e = True And i = True Then
  307. Text1.Text = "GANASTE CRUZ!!"
  308. Beep
  309. volver.Visible = True
  310. txt_x.Text = txt_x.Text + 1
  311. ElseIf c = True And e = True And g = True Then
  312. Text1.Text = "GANASTE CRUZ!!"
  313. Beep
  314. volver.Visible = True
  315. txt_x.Text = txt_x.Text + 1
  316. ElseIf a3 = True And b3 = True And c3 = True And d3 = True And e3 = True And f3 = True And g3 = True And h3 = True And i3 = True Then
  317. Text1.Text = "EMPATE"
  318. Beep
  319. volver.Visible = True
  320. Else
  321. vx.Visible = False
  322. vo.Visible = True
  323. Text1.Text = "MENSAJE"
  324. End If
  325. End Sub
  326.  
  327. Private Sub vo_Click()
  328. If a2 = True And b2 = True And c2 = True Then
  329. Text1.Text = "GANASTE CIRCULO!!"
  330. Beep
  331. volver.Visible = True
  332. txt_o.Text = txt_o.Text + 1
  333. ElseIf d2 = True And e2 = True And f2 = True Then
  334. Text1.Text = "GANASTE CIRCULO!!"
  335. Beep
  336. volver.Visible = True
  337. txt_o.Text = txt_o.Text + 1
  338. ElseIf g2 = True And h2 = True And i2 = True Then
  339. Text1.Text = "GANASTE CIRCULO!!"
  340. Beep
  341. volver.Visible = True
  342. txt_o.Text = txt_o.Text + 1
  343. ElseIf a2 = True And d2 = True And g2 = True Then
  344. Text1.Text = "GANASTE CIRCULO!!"
  345. Beep
  346. volver.Visible = True
  347. txt_o.Text = txt_o.Text + 1
  348. ElseIf b2 = True And e2 = True And h2 = True Then
  349. Text1.Text = "GANASTE CIRCULO!!"
  350. Beep
  351. volver.Visible = True
  352. txt_o.Text = txt_o.Text + 1
  353. ElseIf c2 = True And f2 = True And i2 = True Then
  354. Text1.Text = "GANASTE CIRCULO!!"
  355. Beep
  356. volver.Visible = True
  357. txt_o.Text = txt_o.Text + 1
  358. ElseIf a2 = True And e2 = True And i2 = True Then
  359. Text1.Text = "GANASTE CIRCULO!!"
  360. Beep
  361. volver.Visible = True
  362. txt_o.Text = txt_o.Text + 1
  363. ElseIf c2 = True And e2 = True And g2 = True Then
  364. Text1.Text = "GANASTE CIRCULO!!"
  365. Beep
  366. volver.Visible = True
  367. txt_o.Text = txt_o.Text + 1
  368. Else
  369. vo.Visible = False
  370. vx.Visible = True
  371. Text1.Text = "MENSAJE"
  372. End If
  373.  
  374. End Sub
  375. Private Sub volver_Click()
  376. Command1.Caption = ""
  377. Command2.Caption = ""
  378. Command3.Caption = ""
  379. Command4.Caption = ""
  380. Command5.Caption = ""
  381. Command6.Caption = ""
  382. Command7.Caption = ""
  383. Command8.Caption = ""
  384. Command9.Caption = ""
  385.  
  386. Text1.Text = "MENSAJE"
  387.  
  388. a = False
  389. b = False
  390. c = False
  391. d = False
  392. e = False
  393. f = False
  394. g = False
  395. h = False
  396. i = False
  397. a2 = False
  398. b2 = False
  399. c2 = False
  400. d2 = False
  401. e2 = False
  402. f2 = False
  403. g2 = False
  404. h2 = False
  405. i2 = False
  406. a3 = False
  407. b3 = False
  408. c3 = False
  409. d3 = False
  410. e3 = False
  411. f3 = False
  412. g3 = False
  413. h3 = False
  414. i3 = False
  415.  
  416.  
  417. w = True
  418.  
  419. vo.Visible = False
  420. vx.Visible = True
  421. volver.Visible = False
  422. End Sub
  423.  
  424. Private Sub Command11_Click()
  425. txt_o.Text = "0"
  426. txt_x.Text = "0"
  427. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement