public Int64 GetEveryFourResult(List<Id> list) { Int64 result = 0; List<Id> newList = new List<Id>(); Id tempId; Id tempIdSecond; Int64 tempResult = 0; newList.Clear(); for (int i = 0; i < list.Count; i++) { if (list[i].IsJoker != true) { newList.Add(list[i]); } } if (newList.Count == 3) // 3 { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { tempId = new Id((Figures)i, (CardColors)j); newList.Add(tempId); tempResult = this.GetFourResult(newList); if (tempResult > result) { result = tempResult; } newList.Remove(tempId); } } } else { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { tempId = new Id((Figures)i, (CardColors)j); newList.Add(tempId); for (int k = 0; k < 4; k++) { for (int l = 0; l < 4; l++) { tempIdSecond = new Id((Figures)k, (CardColors)l); newList.Add(tempIdSecond); tempResult = this.GetFourResult(newList); if (tempResult > result) { result = tempResult; } newList.Remove(tempIdSecond); } } newList.Remove(tempId); } } } return result; }
/// <summary> /// Ładowanie kart z grida z panmięci /// </summary> /// <param name="card"> Karta, którą nalezy załadować</param> /// <param name="x"> Pozycja x karty</param> /// <param name="y"> Pozycja y karty</param> /// <returns> Image that's load from Memory</returns> private Image LoadCardsFromMemory(Id card, int x, int y) { Image image; if (card == null) return null; if (card.Figure != Figures.Joker) { image = this._controlPanel.GetImageByColorAndId(card.Figure, card.Color); } else { image = this._controlPanel.GetJoker(); } Point point = this._controlPanel.GetGridCoordsForMarkRectangle(x + 1, y + 1); if (card.Blocked == false) { this.ManipulationSettings(image); ChangeRectangle(x, y, false); } else { ChangeRectangle(x, y, true); } this.canvas.Children.Add(image); this.SettingCanvasTranslate(image, point); return image; }
/// <summary> /// Ładowanie kart z randomu z pamięci /// </summary> /// <param name="card"> Karta, którą należy załadować</param> /// <param name="x"> Pozycja x tej karty</param> /// <param name="y"> Pozycja y tej karty</param> /// <returns> Image that's load from Memory</returns> private Image LoadRandFromMemory(Id card, int x, int y) { if (card == null) return null; Image image = _controlPanel.GetImageByColorAndId(card.Figure, card.Color); Point point = _controlPanel.GetRandCoordsForMarkRectangle(x + 1, 1); this.ManipulationSettings(image); this.canvas.Children.Add(image); this.SettingCanvasTranslate(image, point); return image; }
public void SetGameBoard(Id[,,] newGameBoard) { this.gameBoard = newGameBoard; }