Esempio n. 1
0
        public BlackjackGame(Tables AssignedTable, iCardDealer dealer, double minbet = 2.0)
        {
            this.table  = AssignedTable;
            this.dealer = new BlackjackDealer(dealer.GetAddress().QualifiedAddress, dealer.GetBirthday(), dealer.GetSex());
            this.logID  = Guid.NewGuid().ToString();
            Console.WriteLine(logID);
            this.ID             = table.TableID();
            this.pendingPlayers = new BlockingCollection <CardPlayer>();
            this.commands       = new ConcurrentQueue <string>();
            Type = CardGameType.BJ;

            Logs.RegisterNewTrace(logID, null, "bj");
            Logs.LogTrace("log GUID : " + logID, logID);
            Logs.LogTrace($"T: {Thread.CurrentThread.ManagedThreadId} New blackjack game started", logID);

            st          = new Queue(new Deck().ReturnDeck());
            minBet      = minbet;
            playerGroup = new List <CardPlayer>
            {
                player1,
                player2,
                player3,
                player4
            };
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            BlackjackHand   Hand   = new BlackjackHand();
            BlackjackDealer Dealer = new BlackjackDealer();
            BlackjackPlayer Player = new BlackjackPlayer(Hand, 500, "Player 1");

            BlackjackModel      Model      = new BlackjackModel(Dealer, Player);
            BlackjackController Controller = new BlackjackController(Model);

            //  >>>>>[  To use the straight Console/CLI View
            //          -----
            //          BlackjackConsoleView View = new BlackjackConsoleView(Model, Controller);

            //  >>>>>[  To use the "Fake-Curses" View
            //          -----
            BlackjackCursesView View = new BlackjackCursesView(Model, Controller);

            Model.LinkView(View);
            View.ModelChanged();
        }
Esempio n. 3
0
        public BlackjackModel(BlackjackDealer Dealer, BlackjackPlayer Player)
        {
            //  >>>>>[  For now keeping it simple: One player, one view.
            //          - jds | 2019.01.30
            //          -----
            this.Dealer = Dealer;
            this.Player = Player;

            Dealer.NewHand();
            Player.NewHand();

            //  >>>>>[  Populate the command list. Initially, the only available
            //          command will be "Bet".
            //          -jds | 2019.01.31
            //          -----
            this.Commands.Add("bet", true);
            this.Commands.Add("hit", false);
            this.Commands.Add("stand", false);
            this.Commands.Add("double down", false);
            this.Commands.Add("restart", true);
            this.Commands.Add("surrender", false);
            this.Commands.Add("split", false);
            this.Commands.Add("quit", true);
        }
 public DealerCollectingBets(BlackjackDealer player)
     : base(player)
 {
 }
Esempio n. 5
0
 private void Hit(BlackjackDealer bp)
 {
     bp.AddCards((Card)st.Dequeue());
     bp.CardsValue = CalcCards(bp.ReturnCards());
 }