Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace igra
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- int potez = 1;
- int click1 = 0;
- int click2 = 0;
- int click3 = 0;
- int click4 = 0;
- int click5 = 0;
- int click6 = 0;
- int click7 = 0;
- int click8 = 0;
- int click9 = 0;
- int IGRAC1 = 0, IGRAC2 = 0;
- private void button1_Click(object sender, EventArgs e)
- {
- if (click1 == 0){
- if (potez % 2 != 0){
- button1.Text = "X";
- click1++;
- }
- else{
- button1.Text = "O";
- click1++;
- }
- potez++;
- }
- else{
- button1.Text = button1.Text;
- }
- display();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- if (click2 == 0) {
- if (potez % 2 != 0){
- button2.Text = "X";
- click2++;
- }
- else {
- button2.Text = "O";
- click2++;
- }
- potez++;
- }
- else{
- button2.Text = button2.Text;
- }
- display();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- if (click3 == 0)
- {
- if (potez % 2 != 0)
- {
- button3.Text = "X";
- click3++;
- }
- else
- {
- button3.Text = "O";
- click3++;
- }
- potez++;
- }
- else
- {
- button3.Text = button3.Text;
- }
- display();
- }
- private void button4_Click(object sender, EventArgs e)
- {
- if (click4 == 0)
- {
- if (potez % 2 != 0)
- {
- button4.Text = "X";
- click4++;
- }
- else
- {
- button4.Text = "O";
- click4++;
- }
- potez++;
- }
- else
- {
- button4.Text = button4.Text;
- }
- display();
- }
- private void button5_Click(object sender, EventArgs e)
- {
- if (click5 == 0)
- {
- if (potez % 2 != 0)
- {
- button5.Text = "X";
- click5++;
- }
- else
- {
- button5.Text = "O";
- click5++;
- }
- potez++;
- }
- else
- {
- button5.Text = button5.Text;
- }
- display();
- }
- private void button6_Click(object sender, EventArgs e)
- {
- if (click6 == 0)
- {
- if (potez % 2 != 0)
- {
- button6.Text = "X";
- click6++;
- }
- else
- {
- button6.Text = "O";
- click6++;
- }
- potez++;
- }
- else
- {
- button6.Text = button6.Text;
- }
- display();
- }
- private void button7_Click(object sender, EventArgs e)
- {
- if (click7 == 0)
- {
- if (potez % 2 != 0)
- {
- button7.Text = "X";
- click7++;
- }
- else
- {
- button7.Text = "O";
- click7++;
- }
- potez++;
- }
- else
- {
- button7.Text = button7.Text;
- }
- display();
- }
- private void button8_Click(object sender, EventArgs e)
- {
- if (click8 == 0)
- {
- if (potez % 2 != 0)
- {
- button8.Text = "X";
- click8++;
- }
- else
- {
- button8.Text = "O";
- click8++;
- }
- potez++;
- }
- else
- {
- button8.Text = button8.Text;
- }
- display();
- }
- private void button9_Click(object sender, EventArgs e)
- {
- if (click9 == 0)
- {
- if (potez % 2 != 0)
- {
- button9.Text = "X";
- click9++;
- }
- else
- {
- button9.Text = "O";
- click9++;
- }
- potez++;
- }
- else
- {
- button9.Text = button9.Text;
- }
- display();
- }
- public void display()
- {
- if (potez % 2 != 0)
- {
- displayturn.Text = "IGRAC 1";
- }
- else
- {
- displayturn.Text = "IGRAC 2";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement