Example #1
0
        public RoundResult CalculateWinnerDll(List<Hand> hands, List<Card> board)
        {
            //PInvoke.SetDllDirectory(
            RoundResult result = new RoundResult();

            var reqArr = new int[25];
            for (int i = 0; i < hands.Count; i++)
                for (int j = 0; j < hands[i].Cards.Count; j++)
                    reqArr[2 * i + j] = hands[i].Cards[j].Id;
            for (int i = hands.Count * 2; i < 20; i++)
                reqArr[i] = -1;
            for (int i = 0; i < board.Count; i++)
                reqArr[20 + i] = board[i].Id;

            var success = CalculateWinner(reqArr);

            long highScore = (long)reqArr[23] * 10000 + reqArr[24];
            var winnerNumbers = new List<int>(10);
            for(int i = 0; reqArr[i] != -1 && i < 10; i++)
                winnerNumbers.Add(reqArr[i]);

            return new RoundResult() { WinningScore = highScore, WinningPlayerNumbers = winnerNumbers };
        }
Example #2
0
File: Game.cs Project: nurdyguy/MDU
 private void PrintRound(Hand h0, Hand h1, List<Card> board, RoundResult result)
 {
     Debug.WriteLine("----------------------------");
     PrintCards(h0.Cards);
     PrintCards(h1.Cards);
     PrintCards(board);
     Debug.WriteLine("Score: " + result.WinningScore);
     string str = "";
     for (var i = 0; i < result.WinningPlayerNumbers.Count; i++)
         str += " Player " + result.WinningPlayerNumbers[i].ToString();
     Debug.WriteLine(str);
     Debug.WriteLine("----------------------------");
 }