Ejemplo n.º 1
0
 public Game(IDeckFactory factory, GameID id)
 {
     ID          = id;
     DeckFactory = factory;
     DrawPile    = factory.CreateDefaultDrawableDeck();
     DiscardPile = factory.CreateDefaultPlayableDeck();
 }
Ejemplo n.º 2
0
        private Game InitGame(IEnumerable<Player> players, IDeckFactory deckFactory)
        {
            if (RandomizePlayers)
                players = shufflingAlgorithm.Shuffle(players);

            return new Game(deckFactory, players);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Runs the simulation with a given setup data set.
        /// </summary>
        /// <param name="setup">Data set to be used</param>
        /// <returns></returns>
        public static SimulationResults RunSimulation(SetupData setup)
        {
            //Private configurations
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            cardpoolAsTrackable = CastToTrackable(setup.Cardpool);
            SetupGameSessionRequirements();

            //Injected configurations
            SetupPrinter(setup);
            IDeckFactory deckFactory = GetFactory(setup);
            List <Deck>  decks       = deckFactory.GenerateDecks(setup.DeckSize, setup.MaxDuplicates, setup.Cardpool);

            for (int i = 0; i < decks.Count; i++)
            {
                string toPrint = "Deck[" + i + "] : ";
                foreach (var card in decks[i].cards)
                {
                    toPrint += card.GetNameType() + " ";
                }
                Console.WriteLine(toPrint);
            }

            //Running game sessions
            GameSession session = new GameSession(p1, p2);

            session.PlayGames(setup.GamesEachDeckMustPlayMultiplier, decks, p1Setup, p2Setup, setup.StartCards);

            //Assembling results
            stopWatch.Stop();
            return(new SimulationResults(decks, setup.Cardpool, stopWatch.ElapsedMilliseconds));
        }
Ejemplo n.º 4
0
        public StartGameCommand(IDeckFactory deckFactory, IShufflingAlgorithm shufflingAlgorithm)
        {
            this.deckFactory = deckFactory;
            this.shufflingAlgorithm = shufflingAlgorithm;

            LocalEndpoint = new IPEndPoint(IPAddress.Loopback, 1234);
            RandomizePlayers = true;
            ValidateDeck = true;
        }
Ejemplo n.º 5
0
 protected BaseDeck(IDeckFactory factory, IEnumerable <Card> cards)
 {
     Factory = factory;
     if (cards != null)
     {
         foreach (var card in cards)
         {
             Cards.Push(card);
         }
     }
 }
Ejemplo n.º 6
0
 public ShitheadGameEngine(
     CardsDbContext dbContext,
     IDeckFactory deckFactory,
     IShitheadPileLogic shitheadPileLogic,
     IRealtimeService realtimeService)
 {
     _dbContext         = dbContext;
     _deckFactory       = deckFactory;
     _shitheadPileLogic = shitheadPileLogic;
     _realtimeService   = realtimeService;
 }
Ejemplo n.º 7
0
 public Game(
     IDeckFactory deckFactory,
     IRuleSetFactory ruleSetFactory,
     IGameSettingsFactory gameSettingsFactory)
 {
     Deck         = deckFactory.Get();
     Rules        = ruleSetFactory.Get();
     Settings     = gameSettingsFactory.Get();
     _players     = new List <Player>();
     _discardPile = new List <ICard>();
     GameBoard    = new GameBoard();
 }
Ejemplo n.º 8
0
 protected void Init()
 {
     player       = new Player("You");
     player.Chips = 500;
     player.Hand.Clear();
     standardDeckFactory = new StandardDeckFactory();
     emptyDeckFactory    = new EmptyDeckFactory();
     deck = standardDeckFactory.CreateDeck();
     deck.Shuffle();
     discard = emptyDeckFactory.CreateDeck();
     dealer  = new Player("Dealer");
     dealer.Hand.Clear();
 }
Ejemplo n.º 9
0
        public CardGameFactory(CardGameCommands commands, IPlayerCollectionFactory playerCollectionFactory, IDeckFactory deckFactory, IScorerFactory scorerFactory, IVictoryCheckerFactory victoryCheckerFactory)
        {
            Guard.AgainstNullDataContainer(commands, nameof(commands));
            Guard.AgainstNull(playerCollectionFactory, nameof(playerCollectionFactory));
            Guard.AgainstNull(deckFactory, nameof(deckFactory));
            Guard.AgainstNull(scorerFactory, nameof(scorerFactory));
            Guard.AgainstNull(victoryCheckerFactory, nameof(victoryCheckerFactory));

            this.commands = commands;
            this.playerCollectionFactory = playerCollectionFactory;
            this.deckFactory             = deckFactory;
            this.victoryCheckerFactory   = victoryCheckerFactory;
            this.scorerFactory           = scorerFactory;
        }
Ejemplo n.º 10
0
    public void Construct(IDeckFactory deckFactory, IFractionsData fractions,
                          IUserData userDecks, FractionsMenu fractionMenu)
    {
        (this.deckFactory, this.fractions, this.userDecks, this.fractionMenu)
            = (deckFactory, fractions, userDecks, fractionMenu);

        startBattelButton.onClick.AddListener(OnStartBattel);

        if (this.userDecks.CurrentDeck != null)
        {
            fractions.CurrentFraction = fractions.GetFraction(this.userDecks.CurrentDeck.Fraction);
        }

        if (fractions.CurrentFraction.Name == "neutral")
        {
            fractions.CurrentFraction = fractions.Fractions[0];
        }

        fractionMenu.transform.SetParent(transform, false);
        fractionMenu.SetActiveBattons(fractions.Fractions.Where(x => x.Name != "neutral").ToList()).SetListener(SelectFraction);
        fractionMenu.SetSelecedButton(fractions.CurrentFraction);
    }
Ejemplo n.º 11
0
 public BriscolaGame(IDeckFactory deckFactory, IPlayerFactory playerFactory)
 {
     _deckFactory   = deckFactory;
     _playerFactory = playerFactory;
     _subscribers   = new List <IPlayer>();
 }
Ejemplo n.º 12
0
 public DrawableDeck(IDeckFactory factory, IEnumerable <Card> cards) : base(factory, cards)
 {
 }
Ejemplo n.º 13
0
 public HandFactory(IDeckFactory deckFactory, List <int> shuffleSeeds)
 {
     _deckFactory  = deckFactory;
     _shuffleSeeds = shuffleSeeds;
     _rng          = new Random(shuffleSeeds[0]);
 }
Ejemplo n.º 14
0
 public RoundFactory(IDeckFactory deckFactory)
 {
     _deckFactory = deckFactory;
 }
Ejemplo n.º 15
0
 public void FixtureSetUp()
 {
     _cardFactory = new StandardCardFactory();
     _deckFactory = new StandardDeckFactory();
 }
Ejemplo n.º 16
0
 public GameFactory(IDeckFactory deckFactory)
 {
     _deckFactory = deckFactory;
 }
Ejemplo n.º 17
0
 public CardLocationFactory(IDeckFactory deckFactory)
 {
     chancePickupAction         = new PickupCardAction(deckFactory.CreateChanceDeck());
     communityChestPickupAction = new PickupCardAction(deckFactory.CreateCommunityChestDeck());
 }
Ejemplo n.º 18
0
        public GameState(IDeckFactory deckFactory, IEnumerable<Player> players)
        {
            this.deckFactory = deckFactory;
            this.players = players.ToArray();

            Table = new Table();
            states = this.players.ToDictionary(p => p, p => new State());
            readOnlyStates = states.ToDictionary(kvp => kvp.Key, kvp => (IPlayerState)kvp.Value).AsReadOnly();

            deck = deckFactory.CreateDeck();
        }
Ejemplo n.º 19
0
 public void InjectMetod(IDeckFactory deckFactory, IFractionsData fractions, CollectionMenu menu,
                         IUserData userDecks, IDeckEditorPanel editorDeck, FractionsMenu fractionMenu) =>
 (this.deckFactory, this.fractions, this.menu, this.userDecks, this.editorDeck, this.fractionMenu)