2 using System
.Collections
.Generic
;
9 private IList
<CardsPlane
> m_cardsPlane
;
10 public int m_dimension
23 // Constructs a CardsGrid with the specified dimension
27 // The dimension of the CardsGrid
28 public CardsGrid(int dimension
)
30 m_dimension
= dimension
;
31 m_cardsPlane
= new List
<CardsPlane
>(dimension
);
35 // Returns the card at the specified position
39 // The x-coordinate of the card to be retreived
41 // The y-coordinate of the card to be retreived
43 // The z-coordinate of the card to be retreived
46 // The card at the specified position
47 public Card
getCard(int x
, int y
, int z
)
49 CardsPlane cardsplane
= m_cardsPlane
[z
];
50 return cardsplane
.getCard(x
, y
);
54 // Sets the card at the specified position
58 // The x-coordinate of the card to be set
60 // The y-coordinate of the card to be set
62 // The z-coordinate of the card to be set
65 public void setCard(int x
, int y
, int z
, Card card
)
67 CardsPlane cardsplane
= m_cardsPlane
[z
];
68 cardsplane
.setCard(x
, y
, card
);
72 // Swaps the specified two planes, if equal nothing is done
76 // The position of the first plane
78 // The position of the second plane
79 public void swap(int firstpos
, int secondpos
)
81 // Don't swap anything if they are equal
82 if (firstpos
== secondpos
)
85 CardsPlane firstplane
= m_cardsPlane
[firstpos
];
86 CardsPlane secondplane
= m_cardsPlane
[secondpos
];
88 m_cardsPlane
[firstpos
] = secondplane
;
89 m_cardsPlane
[secondpos
] = firstplane
;