internal static void Start(object obj) { var token = (CancellationToken)obj; try { CustomConsole.WriteLine("Starting..." + Environment.NewLine); var max = MaxN ?? BigInteger.Parse("999999999999999999999999999999"); ThreadMaster.Max = TaskMaster.Max = max; if (ShouldOverride) { TaskMaster.StartSieve(BigInteger.Min(max, MaxSieveValue), token); } if (Task) { TaskMaster.Start(token); } else { ThreadMaster.Start(ThreadCount ?? 0, token); } } finally { FileHelper.Dispose(); MainWindow.Finished = true; } }
public ArtemisEngine(GameState gameState, IEngineConfig config, OpeningBook openingBook) { this.gameState = gameState; transpositionTable = new TranspositionTable(config); evConfig = new EvaluationConfig(); evaluator = new PositionEvaluator(gameState, evConfig); Config = config; this.openingBook = openingBook; threadMaster = new ThreadMaster(this, gameState, transpositionTable, config); }
public void UpdateThread(ThreadMaster threadMaster) { ThreadMaster _threadToUpdate = _unitOfWork.GetRepoInstance <ThreadMaster>().GetFirstOrDefault(i => i.ID == threadMaster.ID); _threadToUpdate.Name = threadMaster.Name; _threadToUpdate.Status = threadMaster.Status; _threadToUpdate.TagID = threadMaster.TagID; _threadToUpdate.Description = threadMaster.Description; _threadToUpdate.UpdatedDate = DateTime.Now; }
public HttpResponseMessage AddThread(Thread threadMaster) { try { ThreadMaster thread = DataSync.ThreadSync(threadMaster); _unitOfWork.GetRepoInstance <ThreadMaster>().Add(thread); return(Request.CreateResponse(HttpStatusCode.OK, thread)); } catch (Exception) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while executing AddThread")); } }
public static ThreadMaster ThreadSync(Thread item) { ThreadMaster thread = new ThreadMaster { ID = item.Id, Name = item.Name, Description = item.Description, StatusID = item.StatusID ?? 0, TagID = item.TagID, CreatedDate = item.CreatedDate, UpdatedDate = item.UpdateDate }; return(thread); }
private static void Main() { // INFO: Don't forget to set the working directory to the "out" folder in the run-config!" // Info: DONT USE THIS FILE, USE THE FRONTEND Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); try { Console.WriteLine("Until what number do you want to calculate?"); var max = BigInteger.Parse(Console.ReadLine() ?? "999999999999999999999999999999"); Console.WriteLine("Do you want to override any existing file?"); var input = Console.ReadLine() ?? throw new InvalidInputException(); Console.WriteLine("\nStarting..."); ThreadMaster.Max = max; TaskMaster.Max = max; if (input.ToLowerInvariant().Contains("y") || input.ToLowerInvariant().Equals("true")) { TaskMaster.StartSieve(max <= MaxSieveValue ? max : MaxSieveValue, null); if (Task) { if (max > MaxSieveValue) { TaskMaster.Start(null); } return; } Console.WriteLine("How Many Threads do you want to use?"); input = Console.ReadLine(); var threadCount = string.IsNullOrEmpty(input) ? -1 : int.Parse(input); ThreadMaster.Start(threadCount, null); } else { if (max <= MaxSieveValue) { TaskMaster.StartSieve(max, null); } else if (Task) { TaskMaster.Start(null); } else { Console.WriteLine("How Many Threads do you want to use?"); input = Console.ReadLine(); var threadCount = string.IsNullOrEmpty(input) ? -1 : int.Parse(input); ThreadMaster.Start(threadCount, null); } } } catch (InvalidInputException) { Console.WriteLine("Please enter a real number."); } finally { FileHelper.Dispose(); } }