Jump to content

Community durchsuchen

Zeige Ergebnisse für die Stichwörter "'4-gewinnt'".

  • Suche mithilfe von Stichwörtern

    Trenne mehrere Stichwörter mit Kommata voneinander
  • Suche Inhalte eines Autors

Inhaltstyp


Forum

  • Forum
  • Ausbildung/Job
    • Ausbildung im IT-Bereich
    • IT-Arbeitswelt
    • IT-Weiterbildung
    • Stellenangebote für Fachinformatiker
    • Jobsuche, Bewerbung und Zeugnisse
  • Prüfungsforen
    • IHK-Prüfung allgemein
    • Prüfungsaufgaben und -lösungen
    • Abschlussprojekte
  • NEU: Frage / Antwort: 1. Frage stellen - 2. Antworten bekommen - 3. Die beste Antwort auswählen
    • Für Systemadministratoren und Netzwerktechniker
    • Für Anwendungsentwickler und Programmierer
  • Fachliche Foren
    • Administration
    • Programmierung
  • Sonstiges
    • News und Feedback zu Fachinformatiker.de
    • Small Talk
  • Gaming Club's Allgemeine Themen
  • Gaming Club's Games
  • Coffeehouse's Themen
  • Coffeehouse's Soap
  • Fachinformatiker.de Treffen's regionale Treffen

Kalender

  • Gaming Club's Verabreden zum Zocken
  • Fachinformatiker.de Treffen's Kalender

Product Groups

  • Werben bei Fachinformatiker.de

Blogs

Keine Suchergebnisse

Keine Suchergebnisse


Finde Suchtreffer ...

Suchtreffer enthalten ...


Erstellungsdatum

  • Beginn

    Ende


Zuletzt aktualisiert

  • Beginn

    Ende


Suchtreffer filtern nach ...

Benutzer seit

  • Beginn

    Ende


Gruppe


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Ort

1 Ergebnis gefunden

  1. Moin moin! Wie mein Nutzername vermuten lässt habe ich kürzlich erst mit dem Programmieren angefangen. Aktuell versuche ich mich an einem 4-Gewinnt Modell. Bereits beim Programmieren ist mir aufgefallen, dass es vermutlich extrem umständlich und aufwendig geschrieben ist und es mit Sicherheit an so einigen Stellen gekürzt werden könnte. Leider ist das Programm nicht 100% funktionsfähig, es kommt öfter vor, dass er beim Wechseln der Farbe einfach 2x hintereinander die selbe Farbe wählt, meist beim Legen der ersten Steine in einem Gatter. Ich habe beim Programmieren selbstgemalte Paintbilder für die "kästchen" verwendet, habe diese einfach mal im Anhang angefügt falls einer von euch das mal durchprobieren möchte. Danke schonmal im Voraus ! hier der Code: 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 WindowsFormsApp6 { public partial class Form1 : Form { int allbuttoncounter = 0; int button1counter = 0; int button2counter = 0; int button3counter = 0; int button4counter = 0; int button5counter = 0; int button6counter = 0; int button7counter = 0; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (button1counter == 0 && allbuttoncounter %2 ==0) { button1counter++; allbuttoncounter++; pictureBox1.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 0 && allbuttoncounter % 2 != 0) { button1counter++; allbuttoncounter++; pictureBox1.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 1 && allbuttoncounter % 2 == 0) { button1counter++; allbuttoncounter++; pictureBox14.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 1 && allbuttoncounter % 2 != 0) { button1counter++; allbuttoncounter++; pictureBox14.Image = Properties.Resources.kästchen_rot; } else if (button1counter == 2 && allbuttoncounter % 2 == 0) { button1counter++; allbuttoncounter++; pictureBox21.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 2 && allbuttoncounter % 2 != 0) { button1counter++; allbuttoncounter++; pictureBox21.Image = Properties.Resources.kästchen_rot; } else if (button1counter == 3 && allbuttoncounter % 2 == 0) { button1counter++; allbuttoncounter++; pictureBox28.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 3 && allbuttoncounter % 2 != 0) { button1counter++; allbuttoncounter++; pictureBox28.Image = Properties.Resources.kästchen_rot; } else if (button1counter == 4 && allbuttoncounter % 2 == 0) { button1counter++; allbuttoncounter++; pictureBox35.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 4 && allbuttoncounter % 2 != 0) { button1counter++; allbuttoncounter++; pictureBox35.Image = Properties.Resources.kästchen_rot; } else if (button1counter == 5 && allbuttoncounter % 2 == 0) { button1counter++; allbuttoncounter++; pictureBox42.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 5 && allbuttoncounter % 2 != 0) { button1counter++; allbuttoncounter++; pictureBox42.Image = Properties.Resources.kästchen_rot; } } private void button5_Click(object sender, EventArgs e) { if (button5counter == 0 && allbuttoncounter % 2 == 0) { button5counter++; allbuttoncounter++; pictureBox5.Image = Properties.Resources.kästchen_gelb; } else if (button5counter == 0 && allbuttoncounter % 2 != 0) { button5counter++; allbuttoncounter++; pictureBox5.Image = Properties.Resources.kästchen_rot; } else if (button5counter == 1 && allbuttoncounter % 2 == 0) { button5counter++; allbuttoncounter++; pictureBox10.Image = Properties.Resources.kästchen_gelb; } else if (button5counter == 1 && allbuttoncounter % 2 != 0) { button5counter++; allbuttoncounter++; pictureBox10.Image = Properties.Resources.kästchen_rot; } else if (button5counter == 2 && allbuttoncounter % 2 == 0) { button5counter++; allbuttoncounter++; pictureBox17.Image = Properties.Resources.kästchen_gelb; } else if (button5counter == 2 && allbuttoncounter % 2 != 0) { button5counter++; allbuttoncounter++; pictureBox17.Image = Properties.Resources.kästchen_rot; } else if (button5counter == 3 && allbuttoncounter % 2 == 0) { button5counter++; allbuttoncounter++; pictureBox24.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 3 && allbuttoncounter % 2 != 0) { button5counter++; allbuttoncounter++; pictureBox24.Image = Properties.Resources.kästchen_rot; } else if (button5counter == 4 && allbuttoncounter % 2 == 0) { button5counter++; allbuttoncounter++; pictureBox31.Image = Properties.Resources.kästchen_gelb; } else if (button5counter == 4 && allbuttoncounter % 2 != 0) { button5counter++; allbuttoncounter++; pictureBox31.Image = Properties.Resources.kästchen_rot; } else if (button5counter == 5 && allbuttoncounter % 2 == 0) { button5counter++; allbuttoncounter++; pictureBox38.Image = Properties.Resources.kästchen_gelb; } else if (button5counter == 5 && allbuttoncounter % 2 != 0) { button5counter++; allbuttoncounter++; pictureBox38.Image = Properties.Resources.kästchen_rot; } } private void groupBox1_Enter(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { if (button2counter == 0 && allbuttoncounter % 2 == 0) { button2counter++; allbuttoncounter++; pictureBox2.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 0 && allbuttoncounter % 2 != 0) { button2counter++; allbuttoncounter++; pictureBox2.Image = Properties.Resources.kästchen_rot; } else if (button2counter == 1 && allbuttoncounter % 2 == 0) { button2counter++; allbuttoncounter++; pictureBox13.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 1 && allbuttoncounter % 2 != 0) { button2counter++; allbuttoncounter++; pictureBox13.Image = Properties.Resources.kästchen_rot; } else if (button2counter == 2 && allbuttoncounter % 2 == 0) { button2counter++; allbuttoncounter++; pictureBox20.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 2 && allbuttoncounter % 2 != 0) { button2counter++; allbuttoncounter++; pictureBox20.Image = Properties.Resources.kästchen_rot; } else if (button2counter == 3 && allbuttoncounter % 2 == 0) { button2counter++; allbuttoncounter++; pictureBox27.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 3 && allbuttoncounter % 2 != 0) { button2counter++; allbuttoncounter++; pictureBox27.Image = Properties.Resources.kästchen_rot; } else if (button2counter == 4 && allbuttoncounter % 2 == 0) { button2counter++; allbuttoncounter++; pictureBox34.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 4 && allbuttoncounter % 2 != 0) { button2counter++; allbuttoncounter++; pictureBox34.Image = Properties.Resources.kästchen_rot; } else if (button2counter == 5 && allbuttoncounter % 2 == 0) { button2counter++; allbuttoncounter++; pictureBox41.Image = Properties.Resources.kästchen_gelb; } else if (button2counter == 5 && allbuttoncounter % 2 != 0) { button2counter++; allbuttoncounter++; pictureBox41.Image = Properties.Resources.kästchen_rot; } } private void button3_Click(object sender, EventArgs e) { if (button3counter == 0 && allbuttoncounter % 2 == 0) { button3counter++; allbuttoncounter++; pictureBox3.Image = Properties.Resources.kästchen_gelb; } else if (button3counter == 0 && allbuttoncounter % 2 != 0) { button3counter++; allbuttoncounter++; pictureBox3.Image = Properties.Resources.kästchen_gelb; } else if (button3counter == 1 && allbuttoncounter % 2 == 0) { button3counter++; allbuttoncounter++; pictureBox12.Image = Properties.Resources.kästchen_gelb; } else if (button3counter == 1 && allbuttoncounter % 2 != 0) { button3counter++; allbuttoncounter++; pictureBox12.Image = Properties.Resources.kästchen_rot; } else if (button3counter == 2 && allbuttoncounter % 2 == 0) { button3counter++; allbuttoncounter++; pictureBox19.Image = Properties.Resources.kästchen_gelb; } else if (button3counter == 2 && allbuttoncounter % 2 != 0) { button3counter++; allbuttoncounter++; pictureBox19.Image = Properties.Resources.kästchen_rot; } else if (button3counter == 3 && allbuttoncounter % 2 == 0) { button3counter++; allbuttoncounter++; pictureBox26.Image = Properties.Resources.kästchen_gelb; } else if (button3counter == 3 && allbuttoncounter % 2 != 0) { button3counter++; allbuttoncounter++; pictureBox26.Image = Properties.Resources.kästchen_rot; } else if (button3counter == 4 && allbuttoncounter % 2 == 0) { button3counter++; allbuttoncounter++; pictureBox33.Image = Properties.Resources.kästchen_gelb; } else if (button1counter == 4 && allbuttoncounter % 2 != 0) { button3counter++; allbuttoncounter++; pictureBox33.Image = Properties.Resources.kästchen_rot; } else if (button3counter == 5 && allbuttoncounter % 2 == 0) { button3counter++; allbuttoncounter++; pictureBox40.Image = Properties.Resources.kästchen_gelb; } else if (button3counter == 5 && allbuttoncounter % 2 != 0) { button3counter++; allbuttoncounter++; pictureBox40.Image = Properties.Resources.kästchen_rot; } } private void Form1_Load(object sender, EventArgs e) { } private void button4_Click(object sender, EventArgs e) { if (button4counter == 0 && allbuttoncounter % 2 == 0) { button4counter++; allbuttoncounter++; pictureBox4.Image = Properties.Resources.kästchen_gelb; } else if (button4counter == 0 && allbuttoncounter % 2 != 0) { button4counter++; allbuttoncounter++; pictureBox4.Image = Properties.Resources.kästchen_rot; } else if (button4counter == 1 && allbuttoncounter % 2 == 0) { button4counter++; allbuttoncounter++; pictureBox11.Image = Properties.Resources.kästchen_gelb; } else if (button4counter == 1 && allbuttoncounter % 2 != 0) { button4counter++; allbuttoncounter++; pictureBox11.Image = Properties.Resources.kästchen_rot; } else if (button4counter == 2 && allbuttoncounter % 2 == 0) { button4counter++; allbuttoncounter++; pictureBox18.Image = Properties.Resources.kästchen_gelb; } else if (button4counter == 2 && allbuttoncounter % 2 != 0) { button4counter++; allbuttoncounter++; pictureBox18.Image = Properties.Resources.kästchen_rot; } else if (button4counter == 3 && allbuttoncounter % 2 == 0) { button4counter++; allbuttoncounter++; pictureBox25.Image = Properties.Resources.kästchen_gelb; } else if (button4counter == 3 && allbuttoncounter % 2 != 0) { button4counter++; allbuttoncounter++; pictureBox25.Image = Properties.Resources.kästchen_rot; } else if (button4counter == 4 && allbuttoncounter % 2 == 0) { button4counter++; allbuttoncounter++; pictureBox32.Image = Properties.Resources.kästchen_gelb; } else if (button4counter == 4 && allbuttoncounter % 2 != 0) { button4counter++; allbuttoncounter++; pictureBox32.Image = Properties.Resources.kästchen_rot; } else if (button4counter == 5 && allbuttoncounter % 2 == 0) { button4counter++; allbuttoncounter++; pictureBox39.Image = Properties.Resources.kästchen_gelb; } else if (button4counter == 5 && allbuttoncounter % 2 != 0) { button4counter++; allbuttoncounter++; pictureBox39.Image = Properties.Resources.kästchen_rot; } } private void button6_Click(object sender, EventArgs e) { if (button6counter == 0 && allbuttoncounter % 2 == 0) { button6counter++; allbuttoncounter++; pictureBox6.Image = Properties.Resources.kästchen_gelb; } else if (button6counter == 0 && allbuttoncounter % 2 != 0) { button6counter++; allbuttoncounter++; pictureBox6.Image = Properties.Resources.kästchen_rot; } else if (button6counter == 1 && allbuttoncounter % 2 == 0) { button6counter++; allbuttoncounter++; pictureBox9.Image = Properties.Resources.kästchen_gelb; } else if (button6counter == 1 && allbuttoncounter % 2 != 0) { button6counter++; allbuttoncounter++; pictureBox9.Image = Properties.Resources.kästchen_rot; } else if (button6counter == 2 && allbuttoncounter % 2 == 0) { button6counter++; allbuttoncounter++; pictureBox16.Image = Properties.Resources.kästchen_gelb; } else if (button6counter == 2 && allbuttoncounter % 2 != 0) { button6counter++; allbuttoncounter++; pictureBox16.Image = Properties.Resources.kästchen_rot; } else if (button6counter == 3 && allbuttoncounter % 2 == 0) { button6counter++; allbuttoncounter++; pictureBox23.Image = Properties.Resources.kästchen_gelb; } else if (button6counter == 3 && allbuttoncounter % 2 != 0) { button6counter++; allbuttoncounter++; pictureBox23.Image = Properties.Resources.kästchen_rot; } else if (button6counter == 4 && allbuttoncounter % 2 == 0) { button6counter++; allbuttoncounter++; pictureBox30.Image = Properties.Resources.kästchen_gelb; } else if (button6counter == 4 && allbuttoncounter % 2 != 0) { button6counter++; allbuttoncounter++; pictureBox30.Image = Properties.Resources.kästchen_rot; } else if (button6counter == 5 && allbuttoncounter % 2 == 0) { button6counter++; allbuttoncounter++; pictureBox37.Image = Properties.Resources.kästchen_gelb; } else if (button6counter == 5 && allbuttoncounter % 2 != 0) { button6counter++; allbuttoncounter++; pictureBox37.Image = Properties.Resources.kästchen_rot; } } private void button7_Click(object sender, EventArgs e) { if (button7counter == 0 && allbuttoncounter % 2 == 0) { button7counter++; allbuttoncounter++; pictureBox7.Image = Properties.Resources.kästchen_gelb; } else if (button7counter == 0 && allbuttoncounter % 2 != 0) { button7counter++; allbuttoncounter++; pictureBox7.Image = Properties.Resources.kästchen_rot; } else if (button7counter == 1 && allbuttoncounter % 2 == 0) { button7counter++; allbuttoncounter++; pictureBox8.Image = Properties.Resources.kästchen_gelb; } else if (button7counter == 1 && allbuttoncounter % 2 != 0) { button7counter++; allbuttoncounter++; pictureBox8.Image = Properties.Resources.kästchen_rot; } else if (button7counter == 2 && allbuttoncounter % 2 == 0) { button7counter++; allbuttoncounter++; pictureBox15.Image = Properties.Resources.kästchen_gelb; } else if (button7counter == 2 && allbuttoncounter % 2 != 0) { button7counter++; allbuttoncounter++; pictureBox15.Image = Properties.Resources.kästchen_rot; } else if (button7counter == 3 && allbuttoncounter % 2 == 0) { button7counter++; allbuttoncounter++; pictureBox22.Image = Properties.Resources.kästchen_gelb; } else if (button7counter == 3 && allbuttoncounter % 2 != 0) { button7counter++; allbuttoncounter++; pictureBox22.Image = Properties.Resources.kästchen_rot; } else if (button7counter == 4 && allbuttoncounter % 2 == 0) { button7counter++; allbuttoncounter++; pictureBox29.Image = Properties.Resources.kästchen_gelb; } else if (button7counter == 4 && allbuttoncounter % 2 != 0) { button7counter++; allbuttoncounter++; pictureBox29.Image = Properties.Resources.kästchen_rot; } else if (button7counter == 5 && allbuttoncounter % 2 == 0) { button7counter++; allbuttoncounter++; pictureBox36.Image = Properties.Resources.kästchen_gelb; } else if (button7counter == 5 && allbuttoncounter % 2 != 0) { button7counter++; allbuttoncounter++; pictureBox36.Image = Properties.Resources.kästchen_rot; } } } }
×

Wichtige Information

Fachinformatiker.de verwendet Cookies. Mehr dazu in unserer Datenschutzerklärung