public SlimSwapAnalyzer(Knowledge knowledge, Dictionary <int, Board> boardLookup, Dictionary <Board, int> boardIDLookup, bool useShrubs = false) { _knowledge = knowledge; _boardLookup = boardLookup; _boardIDLookup = boardIDLookup; _useShrubs = useShrubs; }
/// <summary> /// Deserialize sub response data from byte array. /// </summary> /// <param name="byteArray">The byte array which contains sub response data.</param> /// <param name="currentIndex">The index special where to start.</param> protected override void DeserializeSubResponseDataFromByteArray(byte[] byteArray, ref int currentIndex) { int index = currentIndex; int headerLength = 0; StreamObjectHeaderStart header; if ((headerLength = StreamObjectHeaderStart.TryParse(byteArray, index, out header)) == 0) { throw new ResponseParseErrorException(index, "Failed to parse the QueryChangesData stream object header", null); } if (header.Type != StreamObjectTypeHeaderStart.QueryChangesResponse) { throw new ResponseParseErrorException(index, "Failed to extract the QueryChangesData stream object header type, unexpected value " + header.Type, null); } index += headerLength; this.QueryChangesResponseStart = header as StreamObjectHeaderStart32bit; int currentTmpIndex = index; this.StorageIndexExtendedGUID = BasicObject.Parse<ExGuid>(byteArray, ref index); this.PartialResult = (byteArray[index] & 0x1) == 0x1 ? true : false; this.ReservedQueryChanges = (byte)(byteArray[index] >> 1); index += 1; if (index - currentTmpIndex != header.Length) { throw new ResponseParseErrorException(-1, "QueryChangesData object over-parse error", null); } this.Knowledge = StreamObject.GetCurrent<Knowledge>(byteArray, ref index); currentIndex = index; }
public void Start(Knowledge knowledge) { Console.WriteLine("Language Processor - F.C. 2021"); Console.WriteLine("Type 'quit' to terminate"); Console.WriteLine("Type 'help' to show the help"); Console.WriteLine(); var quit = false; while (!quit) { Console.Write("command> "); switch (Console.ReadLine()?.ToLower()) { case "quit": quit = true; break; case "help": HandleHelp(); break; case { } input: HandleInput(input, knowledge); break; } } }
public Task <bool> Handle(RegisterNewKnowledgeCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(Task.FromResult(false)); } var model = new Knowledge() { PeopleId = request.PeopleId, EntityState = EntityStateOptions.Active, KnowledgeDesigner = request.KnowledgeDesigner, KnowledgeDeveloper = request.KnowledgeDeveloper, UrlLinkCRUD = request.UrlLinkCRUD, Other = request.Other }; //TODO Validar se não existe! knowledgeRepository.Add(model); if (Commit()) { bus.RaiseEvent(new KnowledgeRegisteredEvent(model.Id, "user")); } return(Task.FromResult(true)); }
private void Update() { if (loading) { return; } if (Input.GetKeyDown("n")) { globalMap.ShowOnGUI(); } if (Input.GetKeyDown("p")) { Knowledge.GetCurrent().OpenResearchTab(); UIController.current.gameObject.SetActive(false); } if (testMode) { if (Input.GetKeyDown("o")) { TestMethod(); } if (Input.GetKeyDown("m")) { if (colonyController != null) { colonyController.AddEnergyCrystals(1000f); colonyController.storage.AddResource(ResourceType.Fuel, 1000f); var k = Knowledge.GetCurrent(); for (int i = 0; i < 50; i++) { k.AddPuzzlePart(Knowledge.GREENCOLOR_CODE); k.AddPuzzlePart(Knowledge.BLUECOLOR_CODE); k.AddPuzzlePart(Knowledge.REDCOLOR_CODE); } k.AddResearchPoints(Knowledge.ResearchRoute.Foundation, 1000); } } } if (Input.GetKeyDown("x")) { // //mainChunk.RenderDataFullRecalculation(); // //var n = mainChunk.GetNature(); //n.FirstSet(10000f); /* * var plist = mainChunk.surfaces; * int count = 0; * foreach (var fp in plist) * { * if (fp.extension != null) count++; * } * Debug.Log(count); */ } //if (Input.GetKeyDown("z")) Debug.Log(mainChunk.DEBUG_GetStructuresCount()); gameSpeed = _gameSpeed; }
/// <summary> /// 新增教材体系 /// </summary> /// <param name="knowledge">新增的教材体系信息</param> /// <returns></returns> public int AddKnowledge(Knowledge knowledge) { int id = dal.AddKnowledge(knowledge); objLogBll.WriteLog("新增教材体系“" + knowledge.KnowledgeName + "”基本信息"); return(id); }
public static int WriteGood(string countnow, string userid, Knowledge knowledge) { Good model = new Good { UserID = userid, TypeID = knowledge.TypeId, LngId = knowledge.LngId, CategoryID = knowledge.CategoryName, FullText = 0 }; int num = 0; //switch ( //todo) //{ // case SystemEnum.SolrReturnInfoType.Existed: // OpenWindows.Prompt(MESSAGE.GoodExisted); // return num; // case SystemEnum.SolrReturnInfoType.Success: // num = 1; // if (!string.IsNullOrEmpty(countnow)) // { // num = int.Parse(countnow) + 1; // } // OpenWindows.Good(); // return num; //} OpenWindows.Prompt(MESSAGE.GoodError); return(num); }
public void Initialize() { _cognitiveArchitecture = new CognitiveArchitecture { KnowledgeAndBeliefs = { HasBelief = true, HasKnowledge = true }, MessageContent = { CanReceiveBeliefs = true, CanReceiveKnowledge = true }, InternalCharacteristics = { CanLearn = true, CanForget = true, CanInfluenceOrBeInfluence = true } }; _knowledge = new Knowledge(Network, MainOrganization.Models, "1", 1); var modelEntity = new BeliefModelEntity { On = true }; _beliefsModel = new BeliefsModel(_agentId, modelEntity, _cognitiveArchitecture, Network, MainOrganization.Models.Generator); _belief = new Belief(Network, 1, RandomGenerator.RandomUniform, BeliefWeightLevel.RandomWeight); _beliefBitsNonNeutral = _belief.InitializeBits(MainOrganization.Models.Generator, BeliefLevel.NeitherAgreeNorDisagree); _beliefBitsNeutral = _belief.InitializeBits(MainOrganization.Models.Generator, BeliefLevel.NoBelief); _actorBelief = new ActorBelief(Network.ActorBelief, _agentId, _belief.EntityId, BeliefLevel.NeitherAgreeNorDisagree); _taskBits.SetMandatory(new byte[] { 0 }); _taskBits.SetRequired(new byte[] { 0 }); }
public void gotokdp(Knowledge model) { if (model.TypeId == 3) { new PDF { Id = model.Id, TypeId = model.TypeId }.Show(); } else { this.returnsearch = new BACAClient.Model.ReturnSearch(); if (this.IsReturn) { SystemEnum.ISRETURN yES = SystemEnum.ISRETURN.YES; this.returnsearch.IsReturn = yES.ToString(); } else { this.returnsearch.IsReturn = SystemEnum.ISRETURN.NO.ToString(); } this.returnsearch.TypeId = this.TypeId; this.returnsearch.PageIndex = this.pageIndex; this.returnsearch.SourceId = 0; this.returnsearch.KeyWord = this.keyword.Text; this.returnsearch.Category = this.GetCategoryID(true); this.returnsearch.Pages = new PageSwitch().TypeRetrieve; this.returnsearch.Key = ((ComboxItem)this.Type.SelectedItem).Text; CacheHelper.SetReturnSearch(this.returnsearch); CacheHelper.SetCache(new CacheParameterName().HistoryIndex, string.Empty); CacheHelper.SetCache(this.cache.Id, model.Id.ToString()); base.ParentWindow.PageSwitch(new PageSwitch().kdp); } }
public HallSector(string id, int gridX, int gridY, Hallway parentHallway, Knowledge knowledge, AreaType areaType, string textureId) : this(id, gridX, gridY, parentHallway) { Knowledge = knowledge; Type = areaType; TextureId = textureId; }
// PUT: /Knowledges/5 /// <summary> /// Support for updating Knowledges /// </summary> public async Task <IActionResult> Put([FromODataUri] int key, [FromBody] Knowledge update) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (key != update.Id) { return(BadRequest()); } _context.Entry(update).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_context.Knowledge.Any(p => p.Id == key)) { return(NotFound()); } else { throw; } } return(Updated(update)); }
public async Task <Knowledge> CreateDefinitionAsync(Knowledge knowledge) { var internalKnowledge = knowledge.Map(); await Collection.InsertOneAsync(internalKnowledge); return(internalKnowledge.Map()); }
public static BasicObjectProgram Generator(WorldController controller) { var id = ObjectId.NewGuid(); var metadata = new MetaData(null, null, 0, 0); var resources = new Resources(100); var eigenvalue = new Eigenvalue(); var transform = new Transform(); var parameter = new Parameter(metadata, eigenvalue, transform, resources); var maskedParam = new MaskedParameter(parameter, MaskedParameter.Mask.EIGENVALUE | MaskedParameter.Mask.TRANSFORM); var knowledge = new Knowledge(id, maskedParam); controller.credentialTable.Add(id, Credential.HashPassword(id.ToString(), Credential.HashAlgorithm.NOOP)); var data = new BasicObjectProgram(); data.controller = controller; data.knowledge = knowledge; controller.objectList.Add(id, parameter); var objectIdPair = new ObjectIdPair(); objectIdPair.Add(id, id); controller.maskedObjectList.Add(objectIdPair, maskedParam); return(data); }
public Task <Knowledge> GetByIdAsync(int id) { return(Task.Run(() => { Knowledge knowledge = db.Knowledges.Find(id); return knowledge; })); }
// GET: Knowledges/Edit/5 public ActionResult DeveloperEdit(int?id) { var model = new CandidatesModel(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Candidates candidates = db.Candidates.Find(id); OccupationArea occupationArea = db.OccupationArea.Find(id); InformationBank informationBank = db.InformationBank.Find(id); Knowledge knowledge = db.Knowledge.Find(id); model.Candidates = candidates; model.OccupationArea = occupationArea; model.InformationBank = informationBank; model.Knowledge = knowledge; if (model == null) { return(HttpNotFound()); } return(View(model)); }
public void Add_Knowledge() { ListBox process_ListBox = ControlExtensions.FindControl<ListBox>(this, "process_ListBox"); if (process_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定Process!"; return; } Process process = (Process)process_ListBox.SelectedItem; ListBox attribute_ListBox = ControlExtensions.FindControl<ListBox>(this, "attribute_ListBox"); if (attribute_ListBox.SelectedItem == null) { ResourceManager.mainWindowVM.Tips = "需要选定Attribute!"; return; } Attribute attribute = (Attribute)attribute_ListBox.SelectedItem; ObservableCollection<Knowledge> knowledges = ((InitialKnowledge_EW_VM)DataContext).InitialKnowledge.Knowledges; // 判重 foreach (Knowledge know in knowledges) { if (know.Process == process && know.Attribute == attribute) { ResourceManager.mainWindowVM.Tips = "无效的操作。该单知识已经存在"; return; } } Knowledge knowledge = new Knowledge(process, attribute); knowledges.Add(knowledge); ResourceManager.mainWindowVM.Tips = "添加了Knowledge:" + knowledge; }
partial void AfterUpdateData(Knowledge e, ref ActionResult ar) { ar = this.Json(new AjaxOperationResult { Data = this.ToJson(e), Successful = true }); }
public void AddSkill(Knowledge k) { // add to list skillList.Add(k); // sort list skillList.Sort((x, y) => x.GetID().CompareTo(y.GetID())); }
public ActionResult Details(Guid id) { Knowledge item = _iKnowledgeService.GetById(id); ViewBag.UserId = _iUserInfo.UserId; return(View(item)); }
public RaiderBot(Knowledge knowledge) : base(knowledge) { float zeroThreatDistance = 1 + (World.Map.Width / 4); TileMap.TileType heroOrFree = TileMap.TileType.Hero | TileMap.TileType.Free; World.Chart("threat", World.TypeFilter(TileMap.TileType.Hero, World.Hero.ID), World.DefaultCost); World.Chart("mines", World.TypeFilter(TileMap.TileType.GoldMine, World.Hero.ID), World.CostByChart("threat", zeroThreatDistance, 50)); World.Chart("taverns", World.TypeFilter(TileMap.TileType.Tavern), World.CostByChart("threat", zeroThreatDistance, 50)); World.Chart("beer_dist", World.TypeFilter(TileMap.TileType.Tavern), node => (node.Type & heroOrFree) > 0 ? 1 : -1); World.Chart("free_space", World.TypeFilter(~heroOrFree), FreeSpaceChartCosts); World.Chart("escape_routes", SeedSafeSpaces, World.CostByChart("threat", zeroThreatDistance, 20)); Add(new StayAction(this) { Weight = 0f }); Add(new DrinkingAction(this) { Weight = 2.0f }); Add(new MiningAction(this)); Add(new CombatAction(this)); Add(new EscapeAction(this) { Weight = 1.0f }); }
private object ToJson(Knowledge e) { return new { Id = e.Id, Subject = e.Subject, Content = e.Content, KnowledgeType = e.KnowledgeType }; }
public void Decide(List<Rule> ruleList, Knowledge knowledge) { foreach (Rule r in ruleList) { if (knowledge.GetContainer().ContainsKey(r.GetPlayerTrait())) { float temp = knowledge.GetContainer()[r.GetPlayerTrait()]; if (temp > r.GetValueFrom() && temp <= r.GetValueTo()) { r.ActivateAction(EventArgs.Empty); } } } }
public Knowledge Clone() { Knowledge clone = new Knowledge(); clone.isNull.AddRange(isNull); return clone; }
public NewKnowledgeEvent(Knowledge k) { NewKnowledge = k; }
partial void AddRowToGridModel(LigerGridModel m, Knowledge e) { m.Rows.Add(this.ToJson(e)); }
public override bool Update(Knowledge knowledge) { // Overwrite the type with the assigned type knowledge.isNull[symbol] = isNull; return true; }
public void Delete(Knowledge entity) { this.DbContext.Knowledges.DeleteObject(entity); }
public void Add(Knowledge entity) { this.DbContext.Knowledges.AddObject(entity); }
public void Update(Knowledge entity) { var e = this.FindById(entity.Id); if (e != null) { e.Subject = entity.Subject; e.Content = entity.Content; e.KnowledgeType = entity.KnowledgeType; } //if (this.FindById(entity.Id) != null) { // this.DbContext.Knowledges.Attach(entity); // this.DbContext.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Modified); //} }
public override bool Update(Knowledge knowledge) { // Overwrite the type with the assigned type knowledge.isNull[leftSymbol] = knowledge.isNull.GetOrDefault(rightSymbol, IsNull.Maybe); return true; }
public void UnionWith(Knowledge other) { HashSet<Symbol> symbols = new HashSet<Symbol>(); symbols.AddRange(isNull.Keys); symbols.AddRange(other.isNull.Keys); foreach (Symbol symbol in symbols) { isNull[symbol] = isNull.GetOrDefault(symbol, IsNull.Unknown) | other.isNull.GetOrDefault(symbol, IsNull.Unknown); } }
private void Visit(FlowNode node, Knowledge knowledge) { // Memoize the results so we don't do more work than necessary. This is // also required to handle loops without hanging. Result result = new Result(node, knowledge); if (results.Contains(result)) { return; } results.Add(result); // Add to the knowledge flowing through this path, but stop if flow stops knowledge = knowledge.Clone(); if (!node.Update(knowledge)) { return; } // Merge that knowledge into the total knowledge for this node if (node.knowledge != null) { node.knowledge.UnionWith(knowledge); } else { node.knowledge = knowledge.Clone(); } // Propagate flow to next links foreach (FlowNode next in node.next) { Visit(next, knowledge); } }
public virtual bool Update(Knowledge knowledge) { return true; }
public override bool Update(Knowledge knowledge) { // Always indicate no flow return false; }
public Result(FlowNode node, Knowledge knowledge) { this.node = node; this.knowledge = knowledge; }
public GuiObject BuildBenchUpgradeWindow(Table t, Knowledge k) { GuiObject window = new GuiObject(new Rect(0, 0, 300, 500), "LeftPane", "Upgrade Bench"); var playerPosition = Static.Man.transform.position; window.Draw += (g) => { GUI.Box(g.rect, g.text); int boxY = 30, inc = 0; Debug.Log (Vector3.Distance(playerPosition,Static.Man.transform.position)); if (Vector3.Distance(playerPosition,Static.Man.transform.position)>2){ NewWindowTask=CloseWindow; NewWindow=window; return; } foreach (Bench b_ in k.benches) { var b = b_; inc = 0; int[] inv = man.GetComponent<Inventory>().GetAmounts(b.buildcost); int boxH = 30 + inv.Length * 25; GUI.Box(new Rect(5, boxY, 290, boxH), ""); GUI.Label(new Rect(10, 5 + boxY, 200, 25), b.customname); GUI.Label(new Rect(10, boxY + boxH - 25, 150, boxH - 30), b.description); int i = 0; bool canbuild = true; foreach(ItemCount rc in b.buildcost) { SetColor(() => {return inv[i] >= rc.amount;}); if (inv[i] < rc.amount) {canbuild = false;} GUI.Label(new Rect(210, 5 + boxY + inc, 150, 25), inv[i] + "/" + rc.amount + " " + rc.item.GetName()); inc += 20; i++; } SetColor(); GUI.enabled = canbuild; if (GUI.Button(new Rect(240, boxY + boxH - 30, 45, 25), "Build")) { queue.Enqueue(control.SimpleAction( (d) => { t.bench = b; foreach (var rc in b.buildcost) { man.GetComponent<Inventory>().AddToInventory(rc.item, -rc.amount); } OpenWindow(BuildBenchWindow(b)); d.state = ActionState.Done; })); } GUI.enabled = true; boxY += boxH + 5; } }; return window; }
public override bool Update(Knowledge knowledge) { // Narrow to more specific knowledge IsNull intersection = isNull & knowledge.isNull.GetOrDefault(symbol, IsNull.Maybe); knowledge.isNull[symbol] = intersection; // A contradiction means flow out of this node is impossible return (intersection != IsNull.Unknown); }