Ejemplo n.º 1
0
        public AIArena()
        {
            stats = new Stats();
            players = new Player[]
            {
                new Player("C1", 0),
                new Player("C2", 1),
                new Player("C3", 2),
                new Player("C4", 3)
            };

            gameManager = new GameManager(players, 1001, new AIBidType[]
            {
                AIBidType.BASIC,
                AIBidType.BASIC,
                AIBidType.BASIC,
                AIBidType.BASIC
            }, new AIGameType[]
            {
                AIGameType.PERFECTMEMORY,
                AIGameType.PERFECTMEMORY,
                AIGameType.PERFECTMEMORY,
                AIGameType.PERFECTMEMORY
            });
        }
Ejemplo n.º 2
0
 public BaseGameViewModel(GameManager gameManager, InfoPanelViewModel infoPanelVM)
 {
     this.gameManager = gameManager;
     this.infoPanelVM = infoPanelVM;
     HandVM = new HandViewModel(this);
     CurrentGameState = GameState.BIDDING;
 }
Ejemplo n.º 3
0
        private GameManager InitialiseTest()
        {
            var players = new Player[]
            {
                new Player("C1", 0),
                new Player("C2", 1),
                new Player("C3", 2),
                new Player("C4", 3)
            };

            var gameManager = new GameManager(players, 13, new AIBidType[]
            {
                AIBidType.BASIC,
                AIBidType.BASIC,
                AIBidType.BASIC,
                AIBidType.BASIC
            }, new AIGameType[]
            {
                AIGameType.MEMORY,
                AIGameType.MEMORY,
                AIGameType.MEMORY,
                AIGameType.MEMORY,
            });

            return gameManager;
        }
Ejemplo n.º 4
0
 public static IBidAI CreateBidAI(Player player, GameManager game, AIBidType type)
 {
     switch (type)
     {
         case AIBidType.BASIC:
             return new BaseBidAI(player, game);
         case AIBidType.CAUTIOUS:
             return new CautiousBidAI(player, game);
         case AIBidType.SIMGAME:
             return new SimulateGameBidAI(player, game);
         case AIBidType.OMNISCIENT:
             return new BidSearchAI(game);
     }
     throw new ApplicationException();
 }
Ejemplo n.º 5
0
 public static IGameAI CreateGameAI(Player player, GameManager game, AIGameType type)
 {
     switch (type)
     {
         case AIGameType.BASIC:
             return new BaseGameAI(player, game);
         case AIGameType.MEMORY:
             return new MemoryAI(player, game);
         case AIGameType.PERFECTMEMORY:
             return new PerfectMemoryAI(player, game);
         case AIGameType.BRUTEFORCE:
             return new BruteForceAI(player, game);
         case AIGameType.OMNISCIENT:
             return new OmniscentSearchAI(game, new StandardReferee());
     }
     throw new ApplicationException();
 }
Ejemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();

            GameManager gameManager = new GameManager();

            var infoPanelVM = new InfoPanelViewModel(gameManager);
            InfoPanel.DataContext = infoPanelVM;


            //round
            model = new BaseGameViewModel(gameManager, infoPanelVM);
            model.GameStateChanged += OnGameStateChanged;

            Whist.DataContext = model;
            BiddingView.DataContext = new BiddingViewModel(model);
            labelC1.DataContext = model;
            labelC2.DataContext = model;
            labelC3.DataContext = model;
            ActionLog.DataContext = infoPanelVM;
        }
Ejemplo n.º 7
0
 public BidSearchAI(GameManager gameManager)
 {
     this.gameManager = gameManager;
 }
Ejemplo n.º 8
0
 public CautiousBidAI(Player player, GameManager game) : base(player, game)
 {
 }
Ejemplo n.º 9
0
        public SimulateGameBidAI(Player player, GameManager game) : base(player, game)
        {

        }
Ejemplo n.º 10
0
 public BruteForceAI(Player player, GameManager game)
 {
     this.player = player;
     this.game = game;
 }
Ejemplo n.º 11
0
        private void PlayRound(GameManager gameManager)
        {
            Round round = gameManager.Round;

            while (round.InBiddingPhase)
            {
                var action = gameManager.GetAI(round.CurrentPlayer).GetAction();
                round.BiddingDoAction(action);
            }
            round.EndBiddingRound();

            while (round.InTrickPhase)
            {
                while (round.TrickInProgress)
                {
                    var card = gameManager.GetAI(round.CurrentPlayer).GetMove();
                    foreach (Player player in gameManager.NonHumanPlayers)
                    {
                        gameManager.GetAI(player).ProcessOtherPlayerCard(round.CurrentPlayer, card);
                    }
                    round.PlayCard(card);
                }
                round.EndTrick();
            }
            round.EndTricksRound();
        }
Ejemplo n.º 12
0
 public BaseBidAI(Player player, GameManager game)
 {
     this.player = player;
     this.game = game;
 }
Ejemplo n.º 13
0
 public PerfectMemoryAI(Player player, GameManager game) : base(player, game)
 {
     ResetMemory();
 }
Ejemplo n.º 14
0
 public static AI CreateAI(Player player, GameManager game, AIBidType bidType, AIGameType gameType)
 {
     return new AI(player, CreateBidAI(player, game, bidType), CreateGameAI(player, game, gameType));
 }
Ejemplo n.º 15
0
 public InfoPanelViewModel(GameManager gameManager)
 {
     this.gameManager = gameManager;
     Player = gameManager.HumanPlayer;
     actionLog = new List<string>();
 }