/* Method used to see if the matchTwo list contains a specific pair * Uses linear search */ private bool contains(MatchTwo pair) { foreach (MatchTwo m in matchTwos) { if (m.Equals(pair)) { return(true); } } return(false); }
private void button1_Click(object sender, EventArgs e) { if (!ValidateChildren()) { return; } MatchTwo m = new MatchTwo((listBox1.SelectedIndex + 1) * 2); m.StartPosition = FormStartPosition.CenterScreen; m.ShowDialog(); m.timer1.Stop(); if (m.Score == null) { m.Score = "Unfinished"; } scores.Add(new Score(KojaIgra.MatchTwo, textBox1.Text.ToString(), m.Score)); }
public bool Equals(MatchTwo obj) { return((obj.getCoordPairs()[0].Equals(coordPairs[0]) && obj.getCoordPairs()[1].Equals(coordPairs[1]) || obj.getCoordPairs()[0].Equals(coordPairs[1]) && obj.getCoordPairs()[1].Equals(coordPairs[0])) && obj.getShape().Equals(shape)); }