/// <summary> /// When created the initial status and score of the player are determined /// </summary> /// <param name="shoeService">depending on the implementation (strategy pattern) of the shoe the hand may differ</param> /// <param name="scoreCalculator"></param> /// <param name="name"></param> protected Player(IShoeService shoeService, IScoreCalculator scoreCalculator, string name = "") { _scoreCalculator = scoreCalculator; ShoeService = shoeService; Name = name; Reset(); }
public void ShouldReturnACalculatorBasedOnEnum(ScoreCategory a_scoreCategory, Type a_type) { sut = new ScoreCalculatorFactory(); IScoreCalculator actual = sut.GetScoreCalculator(a_scoreCategory); Assert.True(actual.GetType() == a_type); }
public Runner(ParserBase <TInput> parser, ISolver <TInput, TOutput> solver, PrinterBase <TOutput> printer, ScoreCalculatorBase <TInput, TOutput> calculator = null) { m_Parser = parser; m_Solver = solver; m_Printer = printer; m_Calculator = calculator; }
private void Start() { _gameState.ResetData(); _grid = new TetrisGrid(_gridHeight, _gridWidth); _grid.GridOverflowed += GridOnGridOverflowed; _soundManager = GetComponent <SoundManager>(); _spawner = GetComponent <RandomPrefabsSpawner>(); _inputManager = new InputManagersWrapper(new List <IInputManager>() { GetComponent <InputManager>(), GetComponent <TouchInputManager>() }); _scoreCalculator = new ScoreCalculator(_gameState, _scoreData); _levelManager = new LevelManager(_gameState, 10, _maxLevel); _preview = new GameObject("Preview", new Type[] { typeof(SpriteRenderer) }); _preview.transform.position = _previewPosition; _currentTetromino = CreateTetromino(); InitializeCurrentTetromino(); _nextTetromino = CreateTetromino(); SetUpPreview(); }
public ScoreboardManager(GameDataManager gameData, IScoreCalculator scoreCalculator, ISerializer serializer) { _gameData = gameData; _serializer = serializer; _scoreCalculator = scoreCalculator; Load(); }
/// <summary> /// Initializes a new instance of the <see cref="InGameState"/> class. /// </summary> /// <param name="gameLogic">Object that holds the game logic.</param> /// <param name="gameStatistics">Object that holds the game statistics.</param> /// <param name="fileIo">Object that holds information where the data should be saved.</param> public InGameState(IGameLogic gameLogic, IScoreCalculator gameStatistics, IFileIo fileIo) { this.gameLogic = gameLogic; this.scoreCalculator = gameStatistics; this.fileIo = fileIo; this.message = "Welcome, please make your guess:"; }
public QuizService(UniquizbitDbContext dbContext, IOptions <GradesSettings> optionsAccessor, IScoreCalculator scoreCalculator) { _scoreCalculator = scoreCalculator; _dbContext = dbContext; _gradesSettings = optionsAccessor.Value; }
public ScoreQuery(ISignaler signaler, IScoreCalculator scoreCalculator) { _signaler = signaler; _scoreCalculator = scoreCalculator; _gamesPlayed = 0; _playerCount = 0; _minMaxCache = new MinMaxCache<double>(PlayarStatisistics.InitialScore, PlayarStatisistics.InitialScore); }
public ScoreQuery(ISignaler signaler, IScoreCalculator scoreCalculator) { _signaler = signaler; _scoreCalculator = scoreCalculator; _gamesPlayed = 0; _playerCount = 0; _minMaxCache = new MinMaxCache <double>(PlayarStatisistics.InitialScore, PlayarStatisistics.InitialScore); }
public GameService(ILetterPairGenerator letterPairGenerator, ITimer timer, IScoreCalculator scoreCalculator) { _letterPairGenerator = letterPairGenerator ?? throw new ArgumentNullException(nameof(letterPairGenerator)); _timer = timer ?? throw new ArgumentNullException(nameof(timer)); _scoreCalculator = scoreCalculator ?? throw new ArgumentException(nameof(scoreCalculator)); SubscribeToCustomEvents(); }
public BowlingGame() { _calculator = new ScoreCalculator(); for (int i = 0; i < FramesPerGame - 1; i++) { _frames.Add(new Frame()); } _frames.Add(new LastFrame()); }
public QuestionVM( IDateTime dateTime, IDictionaryEntryPicker dictionaryEntryPicker, IScoreCalculator scoreCalculator) { _dateTime = dateTime; _dictionaryEntryPicker = dictionaryEntryPicker; _scoreCalculator = scoreCalculator; }
public Lobby(IHubContext <LobbyHub> lobbyHub, IWordsProviderService wordsProviderService, IScoreCalculator scoreCalculator, IWordDistanceCalculator wordDistanceCalculator) { _lobbyHub = lobbyHub ?? throw new ArgumentNullException(nameof(lobbyHub)); _wordsProviderService = wordsProviderService ?? throw new ArgumentNullException(nameof(wordsProviderService)); _scoreCalculator = scoreCalculator ?? throw new ArgumentNullException(nameof(scoreCalculator)); _wordDistanceCalculator = wordDistanceCalculator ?? throw new ArgumentNullException(nameof(wordDistanceCalculator)); }
public PlayerYearInfo(string paramPlayer, List <string> paramEventNames, IScoreCalculator paramCalculator) { Player = paramPlayer; _calculator = paramCalculator; foreach (string name in paramEventNames) { _events.Add(new PlayerEventInfo(name)); } }
public ScoreManager(IGridWrapper grid, IBubbleSpawner spawner, IScoreCalculator calculator, IBubbleCollector collector, IBubbleExploder exploder, IGridManager gridManager, ScoreRange scoreRange) { this.grid = grid; this.spawner = spawner; this.calculator = calculator; this.collector = collector; this.exploder = exploder; this.gridManager = gridManager; this.scoreRange = scoreRange; }
public ScoreboardModel(IPredictionData predictionData, IUserData userData, ApplicationDbContext context, IAuthorizationService authorizationService, IScoreCalculator scoreCalculator, IGameConverter gameConverter, UserManager <ApplicationUser> userManager) : base(context, authorizationService, userManager) { _predictionData = predictionData; _userData = userData; _scoreCalculator = scoreCalculator; _gameConverter = gameConverter; }
public Runner(string outputDirectoryName, ParserBase <TInput> parser, SolverBase <TInput, TOutput> solver, PrinterBase <TOutput> printer, ScoreCalculatorBase <TInput, TOutput> calculator = null) { m_Parser = parser; m_Solver = solver; m_Printer = printer; m_Calculator = calculator; var solutionPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))); m_OutputDirectory = Path.Combine(solutionPath, "Output", outputDirectoryName); Directory.CreateDirectory(m_OutputDirectory); }
public ChampionshipManager(TeamCreator teamCreator, IMatchResultGatherer matchResultGatherer, IScoreCalculator scoreCalculator, IRatingCalculator ratingCalculator, IRepository repository) { TeamCreator = teamCreator; MatchResultGatherer = matchResultGatherer; ScoreCalculator = scoreCalculator; RatingCalculator = ratingCalculator; Repository = repository; }
public void AddScore(int score, IScoreCalculator calculator) { var type = calculator.GetType(); if (_scores.ContainsKey(type)) { _scores[type] = score; } else { _scores.Add(type, score); } }
public CommentRepository( IPhotoRepository photoRepository, IDynamoDbCore dynamoDbCore, ISystem system, IScoreCalculator scoreCalculator, ILogWriterFactory logWriterFactory) { if (logWriterFactory is null) { throw new System.ArgumentNullException(nameof(logWriterFactory)); } logWriter = logWriterFactory.CreateLogger <CommentRepository>(); this.photoRepository = photoRepository ?? throw new System.ArgumentNullException(nameof(photoRepository)); this.dynamoDbCore = dynamoDbCore ?? throw new ArgumentNullException(nameof(dynamoDbCore)); this.system = system ?? throw new ArgumentNullException(nameof(system)); this.scoreCalculator = scoreCalculator ?? throw new ArgumentNullException(nameof(scoreCalculator)); tableName = system.Environment.GetVariable(Constants.EnvironmentVariables.DynamoDbTableName); }
private void OnEnable() { m_disposelist = new List <IDisposable>(); m_ScoreCalculator = m_ScoreCalculateObject.GetComponent <IScoreCalculator>(); m_disposelist.Add(m_OnCellDeletedListener.Subscribe((num) => { UpdateScore(num); if (m_UpdateHighScoreOnPlaying) { UpdateHighScore(); } })); m_disposelist.Add(m_PlayStartInitializeListener.Subscribe(PlayStartInitialize)); if (!m_UpdateHighScoreOnPlaying) { m_disposelist.Add(m_UpdateHighScoreListener.Subscribe(UpdateHighScore)); } }
public void InitializeServices() { _cardSpawner = null ?? GetComponent <CardSpawner>(); _sceneHandler = null ?? GetComponent <EndGameUI>(); _hudManager = null ?? GetComponent <HUDManager>(); _gameData = null ?? new GameDataManager(); _pairChecker = null ?? new PairChecker(); _serverCommunication = null ?? new ServerCommunications(); _serializer = null ?? new JsonSerializer(saveFolder); _scoreCalculator = null ?? new ScoreCalculator(); _scoreboardManager = null ?? new ScoreboardManager(_gameData, _scoreCalculator, _serializer); }
public int GetScore() { _scoreCalculator = new ScoreCalculator(); int frameIndex = 0; for (int frame = 0; frame < _numberOfFrames; frame++) { if (isSpare(frameIndex)) { _scoreCalculator.RollWithSpareFrame(rolls[frameIndex], rolls[frameIndex + 1]); frameIndex += 2; } else if (isStrike(frameIndex)) { _scoreCalculator.RollWithStrikeFrame(); frameIndex++; } else { _scoreCalculator.RollWithOpenFrame(rolls[frameIndex], rolls[frameIndex + 1]); frameIndex += 2; } } // check if last frame is strik or spare by if (isStrike(frameIndex - 1)) { _scoreCalculator.BonusRoll(rolls[frameIndex]); _scoreCalculator.BonusRoll(rolls[frameIndex + 1]); } else if (isSpare(frameIndex - 2)) { _scoreCalculator.BonusRoll(rolls[frameIndex]); } return(_scoreCalculator.Score()); }
public HighscoreVM(IRepository repository, IScoreCalculator scoreCalculator) { _repository = repository; _scoreCalculator = scoreCalculator; }
public HomeController(ISessionFactory sessionFactory, IScoreCalculator calculator) { this.sessionFactory = sessionFactory; this.calculator = calculator; }
public void Initialize() { _objectUnderTest = new ScoreCalculator(); }
public ComputerDealer(IShoeService shoeService, IScoreCalculator scoreCalculator) : base(shoeService, scoreCalculator) { }
public HumanPlayer(IShoeService shoeService, IScoreCalculator scoreCalculator, string name = "") : base(shoeService, scoreCalculator, name) { }
public CompetitionSummaryVM(IRepository repository, IScoreCalculator scoreCalculator) { _repository = repository; _scoreCalculator = scoreCalculator; }
public ScoreMultiplier(double multiply, IScoreCalculator scoreCalculator) { m_multiply = multiply; m_scoreCalculator = scoreCalculator; }
protected void PlayerYearData_Selecting(object sender, LinqDataSourceSelectEventArgs e) { if (reference == null) { reference = cbSeason.SelectedItem.Value; } IScoreCalculator calculator = CalculatorFactory.GetScoreCalculator(reference); var events = doc.Element("Fixtures").Elements("Fixture") .Where(ee => (string)ee.Attribute("Season") == reference) .Where(ee => (string)ee.Attribute("PlayerOfTheYear") == "True") .OrderBy(ee => (string)ee.Attribute("Reference")) .Select(ee => new { reference = (string)ee.Attribute("Reference"), location = (string)ee.Attribute("Location"), abbrevation = (string)ee.Attribute("Abbreviation") }); List <string> evs = events.Select(ee => ee.abbrevation).ToList(); List <PlayerYearInfo> PlayerOfTheYearTable = doc1.Element("Members").Elements("Member") .Select( ee => new PlayerYearInfo((string)ee.Attribute("Name"), evs, calculator)).ToList(); int counter = 0; foreach (var ev in events) { counter++; IEnumerable <XElement> results = doc.Element("Fixtures").Elements("Fixture") .Where(ee => (string)ee.Attribute("Reference") == ev.reference) .Descendants("Score") .Where( ff => (string) ff.Ancestors("Result").SingleOrDefault().Attribute("PlayerOfTheYear") == "True") .Select(ee => ee); foreach (XElement score in results) { PlayerYearInfo player = PlayerOfTheYearTable.Where(ee => ee.Player == (string)score.Attribute("Name")) .Select(ee => ee) .SingleOrDefault(); if (player != null) { player.RecordEvent(ev.abbrevation, (int)score.Attribute("Position")); } } } e.Result = PlayerOfTheYearTable.Where(ee => ee.Total > 0).OrderByDescending(ee => ee.Total).Select(ee => ee); }
public ScoreDecorator(IScoreCalculator s) { this.scoreCalculator = s; }
public BowlingGame(IFrameKeeper frameKeeper, IScoreCalculator calculator) { _frameKeeper = frameKeeper; _calculator = calculator; }
public void TestStart() { BestMoverChecker = new BestMoveDepthSearch(); scoreCalculator = new StandardScoreCalculator(); Constants.BonusPoints.Points = new List <(int, int)>(); }
public TournamentsService(DaprClient daprClient, ILogger <TournamentsService> logger, IScoreCalculator scoreCalculator, IConfiguration configuration) : base(daprClient, logger, configuration) { _scoreCalculator = scoreCalculator; }
public SeedController(IRedisRepositoryString redisRepositoryString, IRedisRepositorySortedSet redisRepositorySortedSet, IScoreCalculator scoreCalculator) { _redisRepositoryString = redisRepositoryString; _redisRepositorySortedSet = redisRepositorySortedSet; _scoreCalculator = scoreCalculator; }