예제 #1
0
        public void TestBasicMoveSearch()
        {
            City atlanta = map.addCity("Atlanta", DiseaseColor.BLUE);
            City chicago = map.addCity("Chicago", DiseaseColor.BLUE);

            City.makeAdjacent(atlanta, newark);
            City.makeAdjacent(atlanta, newyork);
            City.makeAdjacent(newyork, chicago);
            GameState gs = new GameState(atlanta, map);


            SearchEvaluate likesNY      = new LikesCity(newyork);
            SearchEvaluate likesChicago = new LikesCity(chicago);

            Action    action = likesNY.bfs_findbest(gs, 1);
            GameState newGS  = action.execute(gs);

            Assert.AreEqual(newyork, newGS.currentPlayer().position);

            action = likesChicago.bfs_findbest(gs, 1);
            newGS  = action.execute(gs);
            Assert.AreNotEqual(newyork, newGS.currentPlayer().position);

            action = likesChicago.bfs_findbest(gs, 2);
            newGS  = action.execute(gs);
            Assert.AreEqual(newyork, newGS.currentPlayer().position);
        }
예제 #2
0
        public void TestMoveToCard()
        {
            City rio = map.addCity("Rio", DiseaseColor.YELLOW);

            SearchEvaluate likesRio  = new LikesCity(rio);
            Player         pWithCard = gs.currentPlayer().addCard(rio);

            gs = gs.adjustPlayer(pWithCard);
            Action    action = likesRio.bfs_findbest(gs, 1);
            GameState newGS  = action.execute(gs);

            Assert.AreEqual(1, pWithCard.cards.Count);
            Assert.AreEqual(rio, newGS.currentPlayer().position);
            Assert.AreEqual(0, newGS.currentPlayer().cards.Count);
        }
예제 #3
0
        public void TestStationMove()
        {
            City rio = map.addCity("Rio", DiseaseColor.YELLOW);

            SearchEvaluate likesRio = new LikesCity(rio);

            Action    action = likesRio.bfs_findbest(gs, 1);
            GameState newGS  = action.execute(gs);

            Assert.AreEqual(newark, newGS.currentPlayer().position);

            map    = map.addStation(newyork);
            map    = map.addStation(rio);
            gs     = new GameState(newyork, map);
            action = likesRio.bfs_findbest(gs, 1);
            newGS  = action.execute(gs);
            Assert.AreEqual(rio, newGS.currentPlayer().position);
        }
예제 #4
0
        public void TestMoveToCard()
        {
            City rio = map.addCity("Rio", DiseaseColor.YELLOW);

            SearchEvaluate likesRio = new LikesCity(rio);
            Player pWithCard = gs.currentPlayer().addCard(rio);
            gs = gs.adjustPlayer(pWithCard);
            Action action = likesRio.bfs_findbest(gs, 1);
            GameState newGS = action.execute(gs);
            Assert.AreEqual(1, pWithCard.cards.Count);
            Assert.AreEqual(rio, newGS.currentPlayer().position);
            Assert.AreEqual(0, newGS.currentPlayer().cards.Count);

        }
예제 #5
0
        public void TestBasicMoveSearch()
        {
            City atlanta = map.addCity("Atlanta", DiseaseColor.BLUE);
            City chicago = map.addCity("Chicago", DiseaseColor.BLUE);

            City.makeAdjacent(atlanta, newark);
            City.makeAdjacent(atlanta, newyork);
            City.makeAdjacent(newyork, chicago);
            GameState gs = new GameState(atlanta, map);


            SearchEvaluate likesNY = new LikesCity(newyork);
            SearchEvaluate likesChicago = new LikesCity(chicago);

            Action action = likesNY.bfs_findbest(gs, 1);
            GameState newGS = action.execute(gs);
            Assert.AreEqual(newyork, newGS.currentPlayer().position);

            action = likesChicago.bfs_findbest(gs, 1);
            newGS = action.execute(gs);
            Assert.AreNotEqual(newyork, newGS.currentPlayer().position);

            action = likesChicago.bfs_findbest(gs, 2);
            newGS = action.execute(gs);
            Assert.AreEqual(newyork, newGS.currentPlayer().position);


        }
예제 #6
0
        public void TestStationMove()
        {
            City rio = map.addCity("Rio", DiseaseColor.YELLOW);

            SearchEvaluate likesRio = new LikesCity(rio);

            Action action = likesRio.bfs_findbest(gs, 1);
            GameState newGS = action.execute(gs);
            Assert.AreEqual(newark, newGS.currentPlayer().position);

            map = map.addStation(newyork);
            map = map.addStation(rio);
            gs = new GameState(newyork, map);
            action = likesRio.bfs_findbest(gs, 1);
            newGS = action.execute(gs);
            Assert.AreEqual(rio, newGS.currentPlayer().position);


        }