static void Main(string[] args) { var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); Log.Debug("Starting up"); var persistence = new GameStateInMemoryRepository(); IGameStateReader reader = persistence; IGameStateWriter writer = persistence; // Create 5 tables for (var t = 0; t < 5; t++) { writer.WriteGameState(GameState.Empty()); } var app = new SharpMemoServerApp(reader, writer); ICommandFacade commandFacade = app; IQueriesFacade queriesFacade = app; WebHost.CreateDefaultBuilder(args) .UseStartup <Startup>() .ConfigureServices(services => services.AddSingleton <ICommandFacade>(app)) .ConfigureServices(services => services.AddSingleton <IQueriesFacade>(app)) .Build() .Run(); }
public Player(IGameStateReader gameStateReader, IKeyPresser keyPresser) { this.gameStateReader = gameStateReader; this.keyPresser = keyPresser; bestMoveFinder = new BestMoveFinder(1); previousState = null; target = null; stashAllowed = true; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); services.AddServerSideBlazor(); var persistence = new GameStateInMemoryRepository(); IGameStateReader reader = persistence; IGameStateWriter writer = persistence; // Create 5 tables for (var t = 0; t < 5; t++) { writer.WriteGameState(GameState.Empty()); } var app = new SharpMemoServerApp(reader, writer); services.AddSingleton <SharpMemoServerApp>(app); }
public SharpMemoServerApp(IGameStateReader reader, IGameStateWriter writer) { _reader = reader; _writer = writer; }