Beispiel #1
0
 public Set(Card c1, Card c2, Card c3)
 {
     cards = new List<Card>();
     cards.Add(c1);
     cards.Add(c2);
     cards.Add(c3);
 }
Beispiel #2
0
 /// <summary>
 /// Returns true if three cards make up a set
 /// </summary>
 /// <param name="card 1"></param>
 /// <param name="card 2"></param>
 /// <param name="card 3"></param>
 /// <returns></returns>
 public bool IsASet(Card c1, Card c2, Card c3)
 {
     bool isASet = false;
     if ((c1.hasSameColor(c2, c3) || c1.hasDifferentColors(c2, c3)) &&
         (c1.hasSameShading(c2, c3) || c1.hasDifferentShadings(c2, c3)) &&
         (c1.hasSameShape(c2, c3) || c1.hasDifferentShapes(c2, c3)) &&
         (c1.hasSameNumber(c2, c3) || c1.hasDifferentNumbers(c2, c3)))
     {
         isASet = true;
     }
     return isASet;
 }
Beispiel #3
0
 /// <summary>
 /// Adds a card to the board
 /// </summary>
 /// <param name="card"></param>
 internal void AddCard(Card card)
 {
     cards.Add(card);
 }
Beispiel #4
0
 internal bool hasSameShape(Card c2, Card c3)
 {
     return c2.shape == this.shape && c3.shape == this.shape;
 }
Beispiel #5
0
 internal bool hasSameNumber(Card c2, Card c3)
 {
     return c2.number == this.number && c3.number == this.number;
 }
Beispiel #6
0
 internal bool hasSameShading(Card c2, Card c3)
 {
     return c2.shading == this.shading && c3.shading == this.shading;
 }
Beispiel #7
0
 internal bool hasSameColor(Card c2, Card c3)
 {
     return c2.color == this.color && c3.color == this.color;
 }
Beispiel #8
0
 internal bool hasDifferentShapes(Card c2, Card c3)
 {
     return c2.shape != this.shape && c3.shape != this.shape && c2.shape != c3.shape;
 }
Beispiel #9
0
 internal bool hasDifferentShadings(Card c2, Card c3)
 {
     return c2.shading != this.shading && c3.shading != this.shading && c2.shading != c3.shading;
 }
Beispiel #10
0
 internal bool hasDifferentNumbers(Card c2, Card c3)
 {
     return c2.number != this.number && c3.number != this.number && c2.number != c3.number;
 }
Beispiel #11
0
 internal bool hasDifferentColors(Card c2, Card c3)
 {
     return c2.color != this.color && c3.color != this.color && c2.color != c3.color;
 }