/// <summary> /// Constructor that uses a specific IMoveProvider, used for unit testing /// </summary> /// <param name="name">The player's name</param> /// <param name="label">The player's label</param> /// <param name="mp">The move provider</param> public HumanPlayer(string name, char label, IMoveProvider mp) { // validate the inputs // If name is null or empty, throw an ArgumentNullException // If mp is null, throw an ArgumentNullException Name = name; Label = label; this.mp = mp; }
public HumanPlayer(IMoveProvider moveProvider, string name) { this.moveProvider = moveProvider; StillInPlay = true; IsHuman = true; bank = new Bank(); Hand = new Hand(); Name = name; type = PlayerType.Human; }
/// <summary> /// Constructor that uses a specific IMoveProvider, used for unit testing /// </summary> /// <param name="name">The name of the player</param> /// <param name="side">The side of the board the player sits on</param> /// <param name="color">The color of the player's pieces</param> /// <param name="mp">The move provider</param> public HumanPlayer(string name, BoardSide side, PlayerColor color, IMoveProvider mp) { // validate the inputs // If name is null or empty, throw an ArgumentNullException // If mp is null, throw an ArgumentNullException if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("Please provide a valid name"); } Name = name; Side = side; Color = color; this.mp = mp ?? throw new ArgumentNullException("Please provide a move Provider"); }
/// <summary> /// Constructor used for unit testing /// </summary> /// <param name="board">The board</param> /// <param name="renderer">The board renderer</param> /// <param name="winChecker">The win checker</param> /// <param name="inputprovider">The input provider</param> /// <param name="outputProvider">The output provider</param> public GameManager(IBoard board, IBoardRenderer renderer, IWinChecker winChecker, IInputProvider inputProvider, IOutputProvider outputProvider, IMoveProvider moveProvider) { // validate the inputs this.board = board; this.renderer = renderer; this.winChecker = winChecker; this.inputProvider = inputProvider; this.outputProvider = outputProvider; this.moveProvider = moveProvider; // initialize the players list // set the game state to waiting to start }
public void SetUp() { var instanceIdGenerator = new InstanceIdGenerator(); _htmlParserProvider = new DefaultHtmlParserProvider(); _movementProvider = new DefaultMovementProvider(instanceIdGenerator); _moveProvider = new DefaultMoveProvider(instanceIdGenerator); _pageDownloader = new DefaultPageDownloader(); _webClientProvider = new DefaultWebClientProvider(); _attributeProvider = new DefaultAttributeProvider(instanceIdGenerator); _imageScrapingProvider = new DefaultImageScrapingProvider(); _imageScrapingService = new DefaultImageScrapingService(_imageScrapingProvider); _uniqueDataProvider = new DefaultUniqueDataProvider(instanceIdGenerator); _webServices = new DefaultWebServices(_htmlParserProvider, _webClientProvider, _pageDownloader); _attributeScrapingServices = new DefaultAttributeScrapingServices(_attributeProvider, _webServices); _moveScrapingServices = new DefaultMoveScrapingServices(_moveProvider, _webServices); _movementScrapingServices = new DefaultMovementScrapingServices(_movementProvider, _webServices); _uniqueDataScrapingServices = new DefaultUniqueDataScrapingServices(_uniqueDataProvider, _webServices); _groundMoveScraper = new GroundMoveScraper(_moveScrapingServices); _aerialMoveScraper = new AerialMoveScraper(_moveScrapingServices); _specialMoveScraper = new SpecialMoveScraper(_moveScrapingServices); _throwMovesScraper = new ThrowMoveScraper(_moveScrapingServices); _characterMoveScraper = new DefaultCharacterMoveScraper(new List <IMoveScraper> { _groundMoveScraper, _aerialMoveScraper, _specialMoveScraper, _throwMovesScraper }); var attributeScrapers = new List <IAttributeScraper> { new AirSpeedScraper(_attributeScrapingServices), new AirDodgeScraper(_attributeScrapingServices) }; _movementScraper = new DefaultMovementScraper(_movementScrapingServices); _characterDataScrapingServices = new DefaultCharacterDataScrapingServices(_imageScrapingService, _movementScraper, attributeScrapers, _characterMoveScraper, _uniqueDataScrapingServices, _webServices, instanceIdGenerator); _characterDataScraper = new DefaultCharacterDataScraper(_characterDataScrapingServices); }
public DefaultCharacterDataScraper MakeCharacterDataScraper() { var instanceIdGenerator = new InstanceIdGenerator(); _htmlParserProvider = new DefaultHtmlParserProvider(); _movementProvider = new DefaultMovementProvider(instanceIdGenerator); _moveProvider = new DefaultMoveProvider(instanceIdGenerator); _pageDownloader = new DefaultPageDownloader(); _webClientProvider = new DefaultWebClientProvider(); _attributeProvider = new DefaultAttributeProvider(instanceIdGenerator); _imageScrapingProvider = new DefaultImageScrapingProvider(); _imageScrapingService = new DefaultColorScrapingService(_characterCss); //_imageScrapingProvider); _uniqueDataProvider = new DefaultUniqueDataProvider(instanceIdGenerator); _webServices = new DefaultWebServices(_htmlParserProvider, _webClientProvider, _pageDownloader); _attributeScrapingServices = new DefaultAttributeScrapingServices(_attributeProvider, _webServices); _moveScrapingServices = new DefaultMoveScrapingServices(_moveProvider, _webServices); _movementScrapingServices = new DefaultMovementScrapingServices(_movementProvider, _webServices); _uniqueDataScrapingServices = new DefaultUniqueDataScrapingServices(_uniqueDataProvider, _webServices); _groundMoveScraper = new GroundMoveScraper(_moveScrapingServices); _aerialMoveScraper = new AerialMoveScraper(_moveScrapingServices); _specialMoveScraper = new SpecialMoveScraper(_moveScrapingServices); _throwMoveScraper = new ThrowMoveScraper(_moveScrapingServices); _characterMoveScraper = new DefaultCharacterMoveScraper(new List <IMoveScraper> { _groundMoveScraper, _aerialMoveScraper, _specialMoveScraper, _throwMoveScraper }); var attributeScrapers = AttributeScrapers.AllWithScrapingServices(_attributeScrapingServices, _urlUnderTest); _movementScraper = new DefaultMovementScraper(_movementScrapingServices); _characterDataScrapingServices = new DefaultCharacterDataScrapingServices(_imageScrapingService, _movementScraper, attributeScrapers, _characterMoveScraper, _uniqueDataScrapingServices, _webServices, instanceIdGenerator); return(new DefaultCharacterDataScraper(_characterDataScrapingServices)); }
public MovesController(IMoveProvider provider, IGameDataLoader gameDataLoader, IParsingCellsService parsingService) { this.gameDataLoader = gameDataLoader; this.parsingService = parsingService; moveProvider = provider; }
public DefaultMoveScrapingServices(IMoveProvider moveProvider, IWebServices webServices) { Guard.VerifyObjectNotNull(moveProvider, nameof(moveProvider)); _moveProvider = moveProvider; _webServices = webServices; }