public void DeepCheck() { var res = new StateRes((3, 0, 0, 0), 0); var spells = ImmutableStack <Spell> .Instance .Push(new Spell(1, (2, 0, 0, 0), false, 1)) .Push(new Spell(2, (-1, 1, 0, 0), false, 1)) .Push(new Spell(3, (0, -1, 1, 0), false, 1)) .Push(new Spell(4, (0, 0, -1, 1), false, 1)) .Push(new Spell(5, (3, -1, 0, 0), true, 1)) .Push(new Spell(6, (0, 3, 0, -1), true, 1)) .Push(new Spell(5, (2, 3, -2, 0), true, 1)) .Push(new Spell(7, (0, -3, 0, 2), true, 1)); var orders = new List <Order> { new Order(8, (-2, -2, -2, 0), 16), new Order(9, (-2, 0, 0, -2), 11), new Order(10, (0, -4, 0, 0), 8), new Order(11, (0, -3, 0, -2), 14), new Order(12, (-2, -3, 0, 0), 8), }; var learns = new List <Learn> { new Learn(13, 0, (0, 0, -3, 3), 0), new Learn(14, 0, (0, 2, -2, 1), 1), new Learn(15, 0, (-5, 0, 0, 2), 2), new Learn(16, 0, (2, 2, 0, -1), 3), new Learn(17, 0, (0, -3, 3, 0), 4), new Learn(18, 0, (-1, 0, -1, 1), 5), }; var currentState = new GameState ( res, spells, orders, learns, new HashSet <int>(), new HashSet <int>(), new HashSet <int>(), Path.Instance, false ); var sw = Stopwatch.StartNew(); var action = new Resolver(true).Resolve(currentState, sw); //action.Should().Contain("NOT BAD"); Console.WriteLine(action); }
private void RandomizeEntryMoves(TrainerPoke pk) { switch (Settings.MoveRandType) { case MoveRandType.RandomMoves: // Random pk.Moves = RandMove.GetRandomMoveset(pk.Species); break; case MoveRandType.LevelUpMoves: pk.Moves = Learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level); break; case MoveRandType.HighPowered: pk.Moves = Learn.GetHighPoweredMoves(pk.Species, pk.Form); break; case MoveRandType.MetronomeOnly: // Metronome pk.Moves = new[] { 118, 0, 0, 0 }; break; default: return; } // sanitize moves var moves = pk.Moves; if (RandMove.SanitizeMovesetForBannedMoves(moves, pk.Species)) { pk.Moves = moves; } }
private void LearnHandler() { if (Learn.CanStart) { Learn.Start(); } }
public Page_Learner(Learn learn) { InitializeComponent(); //동기화 this.learn = Page_Monitor.Page_Monitor.databaseSystem.system.learn; }
public void BugTest() { var allSpells = GetAllSpells().ToList(); var baseSpell = ImmutableStack <Spell> .Instance .Push(allSpells[0]) .Push(allSpells[1]) .Push(allSpells[2]) .Push(allSpells[3]); var tomeSpells = new List <Learn> { new Learn(244, 0, (-2, 0, -1, 2), 0), new Learn(245, 0, (-3, 0, 0, 1), 1), new Learn(246, 0, (-4, 0, 2, 0), 2), new Learn(247, 0, (3, -2, 1, 0), 3), new Learn(248, 0, (0, -3, 3, 0), 4), new Learn(249, 0, (0, 0, -3, 3), 5), }; var orders = new List <Order> { OrderReceipts[22], OrderReceipts[29], OrderReceipts[10], OrderReceipts[15], OrderReceipts[3], }; var spellOptimizer = new SpellOptimizer(); var sw = Stopwatch.StartNew(); var learnMap = spellOptimizer.GetSpellMapForLearn(orders, tomeSpells, baseSpell, sw); var spells = baseSpell; var learnRes = Player.TryGetLearnAction(learnMap, tomeSpells, spells, 3, new HashSet <int>()); spells = spells.Push(new Spell(147, ((Learn)learnRes.action).Spell, true, 1)); tomeSpells = tomeSpells.Where(x => x.Id != ((Learn)learnRes.action).Id).ToList(); var learnRes2 = Player.TryGetLearnAction(learnMap, tomeSpells, spells, 3, new HashSet <int>()); spells = spells.Push(new Spell(741, ((Learn)learnRes2.action).Spell, true, 1)); tomeSpells = tomeSpells.Where(x => x.Id != ((Learn)learnRes2.action).Id).ToList(); var learnRes3 = Player.TryGetLearnAction(learnMap, tomeSpells, spells, 3, new HashSet <int>()); }
public Learn GetLearnData() { var client = CreateClient(); var result = client.Execute <Learn>(TempRequests.GetLearn()); Learn instance = result.Data; this.App.Logger.Info($"Request was processed"); return(instance); }
private async void Parse(string csv) { Deck = Parser.Parse(csv); Learn.SetDeck(Deck); StateHasChanged(); var settings = await SettingsStore.Read(); settings.Decks.Add(Deck); SettingsStore.Write(settings); }
public LearnTest() { _dateTime = new DateTimeProviderStub(DateTime.Now); var parser = new CsvParser(); var lines = File.ReadAllText("TestData/Export.csv"); var deck = parser.Parse(lines); _learn = new Learn(_dateTime); _learn.SetDeck(deck); }
//The function that handles the initialization-step of the Learning system. void InitializeAgent() { //Initialize the objects needed in the system's loop and put reference to this class where necessary. perception = gameObject.GetComponentInChildren<Perception>(); perception.agentController = this; perception.InitializePerception(); learn = new Learn(); learn.agentController = this; decisionSystem = new DecisionSystem(); decisionSystem.agentController = this; //Find the actions defined in the Actions child of the agent and put them in a list for referencing. actions = transform.FindChild("Actions").gameObject.GetComponents<BasicAction>().ToList(); // initializes the agentcontroller in each action actions.ForEach(a => a.agentController = this); }
public ActionResult add() { string username = Request.Form["username"]; string cid = Request.Form["cid"]; if (ModelState.IsValid) { CourseDal c = new CourseDal(); Course course = c.courses.Find(cid); StudentDal s = new StudentDal(); Student student = s.Dalstudents.Find(username); if (student == null) { ModelState.AddModelError(string.Empty, "Student Name not exists."); return(View("addStudent")); } if (course == null) { ModelState.AddModelError(string.Empty, "Course cid not exists."); return(View("addStudent")); } LearnDal learn = new LearnDal(); Learn l = new Learn(); l.cid = course.cid; l.Susername = student.username; l.shid = course.shid; learn.learns.Add(l); try { learn.SaveChanges(); } catch (Exception) { ModelState.AddModelError(string.Empty, "this student already not exists."); } } return(View("Homepage")); }
public IActionResult Learn(int id) { ClaimsPrincipal currentUser = this.User; var currentUserID = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value; var project = this._projectsService.GetProject(id); var allSkills = this._skillsService.GetAll() as List <Skill>; var skills = this._skillsService.GetProjectSkills(id); var interest = project.UsersInterested.Find(interseted => interseted.UserId == currentUserID); var interested = interest != null; var accepted = false; if (interested) { accepted = interest.Confirmed; } var learnModel = new Learn(project, skills, allSkills, accepted, interested); return(View(learnModel)); }
public Action GetResource(Learn spell) { var requiredRes = spell.TomeIndex - myInv[0]; // can I get enough res by learning for free? if (Tome[0].TaxCount >= requiredRes) { return new Action { ActionType = "LEARN", ActionId = Tome[0].Id } } ; // can I cast res var spells = Casts.Where(c => c.Delta[0] > 0 && c.Castable && HaveResForCast(c) && HaveInvSpace(c)); if (spells.Count() == 0) { return(null); } else if (spells.Count() == 1) { return new Action { ActionType = "CAST", ActionId = spells.First().Id } } ; else { var bestSpell = spells.OrderByDescending(s => s.Delta[0]).First(); return(new Action { ActionType = "CAST", ActionId = bestSpell.Id }); } } }
public void Run(string[] args) { string[] inputs; int turnCount = 0; // game loop while (true) { turnCount++; Brews = new List <Brew>(); Casts = new List <Cast>(); Tome = new List <Learn>(); int actionCount = int.Parse(Console.ReadLine()); // the number of spells and recipes in play //Console.Error.WriteLine(actionCount); Action actionIdToTake = new Action(); for (int i = 0; i < actionCount; i++) { var lineToRead = Console.ReadLine(); //Console.Error.WriteLine(lineToRead); inputs = lineToRead.Split(' '); // Console.Error.WriteLine($"inputs: {string.Join(" ", inputs)}"); int actionId = int.Parse(inputs[0]); // the unique ID of this spell or recipe string actionType = inputs[1]; // in the first league: BREW; later: CAST, OPPONENT_CAST, LEARN, BREW int delta0 = int.Parse(inputs[2]); // tier-0 ingredient change int delta1 = int.Parse(inputs[3]); // tier-1 ingredient change int delta2 = int.Parse(inputs[4]); // tier-2 ingredient change int delta3 = int.Parse(inputs[5]); // tier-3 ingredient change int price = int.Parse(inputs[6]); // the price in rupees if this is a potion int tomeIndex = int.Parse(inputs[7]); // in the first two leagues: always 0; later: the index in the tome if this is a tome spell, equal to the read-ahead tax int taxCount = int.Parse(inputs[8]); // in the first two leagues: always 0; later: the amount of taxed tier-0 ingredients you gain from learning this spell bool castable = inputs[9] != "0"; // in the first league: always 0; later: 1 if this is a castable player spell bool repeatable = inputs[10] != "0"; // for the first two leagues: always 0; later: 1 if this is a repeatable player spell if (actionType == "BREW") { Brews.Add(new Brew { Id = actionId, Delta = new int[] { delta0 * -1, delta1 * -1, delta2 * -1, delta3 * -1 }, Price = price }); } if (actionType == "CAST") { Casts.Add(new Cast { Id = actionId, Delta = new int[] { delta0, delta1, delta2, delta3 }, Castable = castable }); } if (actionType == "LEARN") { var tomeSpell = new Learn { Id = actionId, Delta = new int[] { delta0, delta1, delta2, delta3 }, TomeIndex = tomeIndex, TaxCount = taxCount, Repetable = repeatable }; Tome.Add(tomeSpell); } } for (int i = 0; i < 2; i++) { var lineToRead = Console.ReadLine(); //Console.Error.WriteLine(lineToRead); inputs = lineToRead.Split(' '); int inv0 = int.Parse(inputs[0]); // tier-0 ingredients in inventory int inv1 = int.Parse(inputs[1]); int inv2 = int.Parse(inputs[2]); int inv3 = int.Parse(inputs[3]); int score = int.Parse(inputs[4]); // amount of rupees if (i == 0) { myInv = new int[] { inv0, inv1, inv2, inv3 } } ; } Brew bestBrew = GetMostProfitableBrew(); Console.Error.WriteLine($"bestBrew: {bestBrew}"); if (CanMakeBrew(bestBrew)) { actionIdToTake = new Action { ActionType = "BREW", ActionId = bestBrew.Id }; } else { // Check if there is something good to learn var spellToLearn = GetGreatSpell(); if (spellToLearn != null) { // can grab it? if (CanPayLearnTax(spellToLearn)) { actionIdToTake = new Action { ActionType = "LEARN", ActionId = spellToLearn.Id }; Console.WriteLine($"{actionIdToTake}"); continue; } // Get res to learn actionIdToTake = GetResource(spellToLearn); if (actionIdToTake != null) { Console.WriteLine($"{actionIdToTake}"); continue; } } // Try to get Res for the best brew var bestBrewAction = GetResource(bestBrew); Console.Error.WriteLine($"bestBrewAction: {bestBrewAction}"); if (bestBrewAction != null) { actionIdToTake = bestBrewAction; } else { actionIdToTake = new Action { ActionType = "REST" }; } } // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); // in the first league: BREW <id> | WAIT; later: BREW <id> | CAST <id> [<times>] | LEARN <id> | REST | WAIT Console.WriteLine($"{actionIdToTake}"); } }
private static bool IsKnownSpell(ImmutableStack <Spell> knownSpells, Learn spellForLearn) { return(knownSpells.Any(x => x.Tiers == spellForLearn.Spell)); }
public void Save() { Learn.Save(); Evolve.Save(); Mega.Save(); }
public void CancelEdits() { Learn.CancelEdits(); Evolve.CancelEdits(); Mega.CancelEdits(); }
public bool CanPayLearnTax(Learn spell, int[] inv) { return(inv[0] >= spell.TomeIndex); }
protected override void OnInit() { _card = Learn.GetNextCard(); }
//private Dictionary<string, int> DictSenderName = new Dictionary<string, int>(); //private Dictionary<string, int> DictSenderEmail = new Dictionary<string, int>(); //private Dictionary<string, int> DictSenderCombo = new Dictionary<string, int>(); //private DictionaryTools dt = new DictionaryTools(); //private List<string> FolderList = new List<string>(); //private int cnt_folder = 0; //private int cnt_mails = 0; //private string userpath; //private string[] badfolders = { "Junk", "Unwanted", "Trash", "Spam", "Posteingang", "Inbox" }; //public void GetFolders(Outlook.Folder folder) //{ // Outlook.Folders childFolders = // folder.Folders; // if (childFolders.Count > 0) // { // foreach (Outlook.Folder childFolder in childFolders) // { // //Console.WriteLine(childFolder.FolderPath); // FolderList.Add(childFolder.FolderPath); // cnt_folder++; // GetFolders(childFolder); // } // } //} //public void LearnFolders(Outlook.Folder folder, Boolean learn, int folderid) //{ // Outlook.Folders childFolders = folder.Folders; // Boolean learning = learn; // if (childFolders.Count > 0) // { // foreach (Outlook.Folder childFolder in childFolders) // { // if (childFolder.FolderPath.Contains(FolderList[folderid])) // { // learning = true; // } // else // { // learning = false; // } // foreach (string badfolder in badfolders) // { // if (childFolder.FolderPath.Contains(badfolder)) // { // learning = false; // } // } // cnt_folder++; // if (learning == true) // { // Console.WriteLine("learning from " + childFolder.FolderPath); // try // { // Items mails = childFolder.Items; // foreach (object mail in mails) // { // try // { // Outlook.MailItem thismail = (mail as Outlook.MailItem); // string senderName = thismail.SenderName; // string senderEmailAddress = thismail.SenderEmailAddress; // string senderCombo = senderName + "/" + senderEmailAddress; // if (DictSenderName.ContainsKey(senderName)) // DictSenderName[senderName] = DictSenderName[senderName] + 1; // else // DictSenderName.Add(senderName, 1); // if (DictSenderEmail.ContainsKey(senderEmailAddress)) // DictSenderEmail[senderEmailAddress] = DictSenderEmail[senderEmailAddress] + 1; // else // DictSenderEmail.Add(senderEmailAddress, 1); // if (DictSenderCombo.ContainsKey(senderCombo)) // DictSenderCombo[senderCombo] = DictSenderCombo[senderCombo] + 1; // else // DictSenderCombo.Add(senderCombo, 1); // cnt_mails++; // } // catch (System.Exception ex) // { // Debug.WriteLine(ex.Message); // } // } // } // catch (System.Exception) // { } // } // else // { // Console.WriteLine("Skipping folder " + childFolder.FolderPath); // } // LearnFolders(childFolder, false, folderid); // } // } // userpath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // dt.Write(DictSenderName, userpath + "\\dict-sender-name.bin"); // dt.Write(DictSenderEmail, userpath + "\\dict-sender-email.bin"); // dt.Write(DictSenderCombo, userpath + "\\dict-sender-combo.bin"); //} static void Main(string[] args) { Outlook.Application outlook = new Outlook.Application(); Outlook.Folder root = outlook.Session.DefaultStore.GetRootFolder() as Outlook.Folder; Learn learn = new Learn(); int folderid = 0; var userpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FinalFrontier"; Console.WriteLine("---AVAILABLE FOLDERS---"); learn.GetFolders(root); for (int i = 0; i < learn.FolderList.Count; i++) { Console.WriteLine(i + ". " + learn.FolderList[i]); } Console.Write("Please enter the number (without trailing .) of the folder you want to learn from recursively: "); try { folderid = short.Parse(Console.ReadLine()); } catch (System.Exception) { Console.WriteLine("could not read the selected folder. exiting..."); return; } Console.WriteLine(); Console.WriteLine("---LEARNING MAIL HISTORY---"); learn.LearnFolders(root, folderid); Console.WriteLine("learned " + " mails recursively from, starting in " + learn.FolderList[folderid] + "."); Console.WriteLine("dictionary files have been written to " + "... keep these files where they are so that FinalFrontier can find them."); DictionaryTools dtLearn = new DictionaryTools(); Console.WriteLine("---VERIFYING---"); var result = new Dictionary <string, int>(); foreach (var file in Directory.GetFiles(userpath)) { if (file.EndsWith("-dict-sender-email.bin") || file.EndsWith("-dict-sender-name.bin") || file.EndsWith("-dict-sender-combo.bin")) { foreach (var values in dtLearn.Read(file)) { if (!result.ContainsKey(values.Key)) { result.Add(values.Key, values.Value); } } Console.WriteLine($"{Path.GetFileName(file)}: " + dtLearn.Read(file).Count() + " entries"); } } //Console.WriteLine("dict-sender-name.bin: " + dtLearn.Read(userpath + "\\dict-sender-name.bin").Count() + " entries"); //Console.WriteLine("dict-sender-email.bin: " + dtLearn.Read(userpath + "\\dict-sender-email.bin").Count() + " entries"); //Console.WriteLine("dict-sender-combo.bin: " + dtLearn.Read(userpath + "\\dict-sender-combo.bin").Count() + " entries"); Console.WriteLine("[hit key to exit]"); Console.ReadKey(); }
public static void extension(this Learn learn) { Console.WriteLine("马上我就要离开重庆"); }
public override void Study() { Console.WriteLine("zhunbei"); Learn.Study(); }
public bool CanPayLearnTax(Learn spell) { return(myInv[0] >= spell.TomeIndex); }
public void Correct() { Learn.SetResult(_card.Front, true); _card = Learn.GetNextCard(); }
public void Wrong() { Learn.SetResult(_card.Front, false); _card = Learn.GetNextCard(); }
public ActionResult Admin(int?page, string Tab = null, string sortingOrder = "RecentlyPosted", string searchText = "") { searchText = searchText.Replace("'", "''"); Serialization serialization = new Serialization(); DashboardWrapper dashboardWrapper = new DashboardWrapper(); Hashtable HashCriteria = new Hashtable(); Hashtable UsersHashCriteria = new Hashtable(); Hashtable ResourcesHashCriteria = new Hashtable(); Hashtable TestimonialsHashCriteria = new Hashtable(); string actualCriteria; actualCriteria = serialization.SerializeBinary((object)HashCriteria); int pageSize = 8; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; if (Tab == "Users") { UserRegistration userRecords = new UserRegistration(); UsersHashCriteria.Add("Name", searchText); UsersHashCriteria.Add("SortingOrder", sortingOrder); actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria); var users = userRecords.GetUserSpecificDetails(actualCriteria); dashboardWrapper.Users = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users))); dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminUsersTab", dashboardWrapper.PagedListUsers)); } else if (Tab == "Resources") { Learn learnBA = new Learn(); ResourcesHashCriteria.Add("SortingOrder", sortingOrder); ResourcesHashCriteria.Add("SearchText", searchText); ResourcesHashCriteria.Add("IsAdminDashboard", "1"); actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria); var resourcesList = learnBA.GetLearnListingDetails(actualCriteria); dashboardWrapper.Resources = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList))); dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminResourcesTab", dashboardWrapper.PagedListResource)); } else if (Tab == "Testimonials") { Testimonial testimonialBA = new Testimonial(); TestimonialsHashCriteria.Add("SortingOrder", sortingOrder); TestimonialsHashCriteria.Add("SearchText", searchText); actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria); dashboardWrapper.Testimonials = testimonialBA.GetAllTestimonial(actualCriteria); dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize); return(PartialView("_AdminTestimonialsTab", dashboardWrapper.PagedListTestimonial)); } else { InvestorListings investorListings = new InvestorListings(); InvestorListingWrapper investorListingWrapper = new InvestorListingWrapper(); investorListingWrapper.SortingOrder = sortingOrder; investorListingWrapper.ListingTypeIds = string.Empty; HashCriteria.Add("ID", investorListingWrapper.ListingTypeIds); HashCriteria.Add("LocationName", investorListingWrapper.LocationName); HashCriteria.Add("SortingOrder", investorListingWrapper.SortingOrder); HashCriteria.Add("Name", searchText); HashCriteria.Add("LoanID", investorListingWrapper.LoanID); HashCriteria.Add("LienPositionID", investorListingWrapper.LienPositionID); HashCriteria.Add("LoanStatusID", investorListingWrapper.LoanStatusID); HashCriteria.Add("State", investorListingWrapper.State); HashCriteria.Add("LoanTypeID", investorListingWrapper.LoanTypeID); HashCriteria.Add("Address", investorListingWrapper.Address); HashCriteria.Add("PropertyTypeID", investorListingWrapper.PropertyTypeID); HashCriteria.Add("MinPrincipalBalance", 0); HashCriteria.Add("MaxPrincipalBalance", 0); HashCriteria.Add("City", investorListingWrapper.City); HashCriteria.Add("MinInterestRate", 0); HashCriteria.Add("MaxInterestRate", 0); HashCriteria.Add("MinAskingPrice", 0); HashCriteria.Add("MaxAskingPrice", 0); HashCriteria.Add("UserID", userID); actualCriteria = serialization.SerializeBinary((object)HashCriteria); var listing = investorListings.GetDealDetails(actualCriteria); dashboardWrapper.InvestorAdminListing = (List <InvestorListingsModel>)(serialization.DeSerializeBinary(Convert.ToString(listing))); dashboardWrapper.PagedListAdminListings = dashboardWrapper.InvestorAdminListing.ToPagedList(pageIndex, pageSize); //Users default load actualCriteria = string.Empty; UserRegistration userRecords = new UserRegistration(); UsersHashCriteria.Add("SortingOrder", sortingOrder); actualCriteria = serialization.SerializeBinary((object)UsersHashCriteria); dashboardWrapper.Users = new List <UserProfileEditModel>(); var users = userRecords.GetUserSpecificDetails(actualCriteria); dashboardWrapper.Users = (List <UserProfileEditModel>)(serialization.DeSerializeBinary(Convert.ToString(users))); dashboardWrapper.PagedListUsers = dashboardWrapper.Users.ToPagedList(pageIndex, pageSize); //Resources default load actualCriteria = string.Empty; Learn learnBA = new Learn(); //For Learn LearnModel learn = new LearnModel(); ResourcesHashCriteria.Add("SortingOrder", sortingOrder); ResourcesHashCriteria.Add("IsAdminDashboard", "1"); actualCriteria = serialization.SerializeBinary((object)ResourcesHashCriteria); var resourcesList = learnBA.GetLearnListingDetails(actualCriteria); dashboardWrapper.Resources = (List <LearnModel>)(serialization.DeSerializeBinary(Convert.ToString(resourcesList))); dashboardWrapper.PagedListResource = dashboardWrapper.Resources.ToPagedList(pageIndex, pageSize); Testimonial testimonialBA = new Testimonial(); TestimonialsHashCriteria.Add("SortingOrder", sortingOrder); TestimonialsHashCriteria.Add("SearchText", searchText); actualCriteria = serialization.SerializeBinary((object)TestimonialsHashCriteria); dashboardWrapper.Testimonials = testimonialBA.GetAllTestimonial(actualCriteria); dashboardWrapper.PagedListTestimonial = dashboardWrapper.Testimonials.ToPagedList(pageIndex, pageSize); if (Tab != null) { return(PartialView("_AdminListingsTab", dashboardWrapper.PagedListAdminListings)); } return(View("AdminDashboard", dashboardWrapper)); } }
public Vector3[] vectorPoints; // These vectors should be normalized. Might be worth adding a task to Start to ensure they are normalized. // Use this for initialization void Awake() { Instance = this; }
public void CanAddTheoryMemberDataProperty(bool bonus, string skill) { var result = Learn.HasCertificateAndReturnBonus(skill); Assert.Equal(bonus, result); }
public void AttendToCourse(ProgrammingCourse course) { /*Instead of just learning and calling: course.StudyFirstChapter() * every lazy student will postpone this job and will add it to "toStudyDelegate" */ toStudyDelegate += course.StudyFirstChapter; }
private void button1_Click(object sender, EventArgs e) { Learn learn = new Learn(); learn.Show(); }
public void Run(string[] args) { string[] inputs; int turnCount = 0; // game loop while (true) { mainSw.Restart(); turnCount++; Brews = new List <Brew>(); Casts = new Dictionary <int, Cast>(); Tome = new List <Learn>(); int actionCount = int.Parse(Console.ReadLine()); // the number of spells and recipes in play //Console.Error.WriteLine(actionCount); Action actionIdToTake = new Action(); for (int i = 0; i < actionCount; i++) { var lineToRead = Console.ReadLine(); //Console.Error.WriteLine(lineToRead); inputs = lineToRead.Split(' '); // Console.Error.WriteLine($"inputs: {string.Join(" ", inputs)}"); int actionId = int.Parse(inputs[0]); // the unique ID of this spell or recipe string actionType = inputs[1]; // in the first league: BREW; later: CAST, OPPONENT_CAST, LEARN, BREW int delta0 = int.Parse(inputs[2]); // tier-0 ingredient change int delta1 = int.Parse(inputs[3]); // tier-1 ingredient change int delta2 = int.Parse(inputs[4]); // tier-2 ingredient change int delta3 = int.Parse(inputs[5]); // tier-3 ingredient change int price = int.Parse(inputs[6]); // the price in rupees if this is a potion int tomeIndex = int.Parse(inputs[7]); // in the first two leagues: always 0; later: the index in the tome if this is a tome spell, equal to the read-ahead tax int taxCount = int.Parse(inputs[8]); // in the first two leagues: always 0; later: the amount of taxed tier-0 ingredients you gain from learning this spell bool castable = inputs[9] != "0"; // in the first league: always 0; later: 1 if this is a castable player spell bool repeatable = inputs[10] != "0"; // for the first two leagues: always 0; later: 1 if this is a repeatable player spell if (actionType == "BREW") { Brews.Add(new Brew { Id = actionId, Delta = new int[] { delta0 * -1, delta1 * -1, delta2 * -1, delta3 * -1 }, Price = price }); } if (actionType == "CAST") { Casts.Add(actionId, new Cast { Id = actionId, Delta = new int[] { delta0, delta1, delta2, delta3 }, Castable = castable }); } if (actionType == "LEARN") { var tomeSpell = new Learn { Id = actionId, Delta = new int[] { delta0, delta1, delta2, delta3 }, TomeIndex = tomeIndex, TaxCount = taxCount, Repetable = repeatable }; Tome.Add(tomeSpell); } } for (int i = 0; i < 2; i++) { var lineToRead = Console.ReadLine(); inputs = lineToRead.Split(' '); int inv0 = int.Parse(inputs[0]); // tier-0 ingredients in inventory int inv1 = int.Parse(inputs[1]); int inv2 = int.Parse(inputs[2]); int inv3 = int.Parse(inputs[3]); int score = int.Parse(inputs[4]); // amount of rupees if (i == 0) { myInv = new int[] { inv0, inv1, inv2, inv3 } } ; } Console.Error.WriteLine($"mainSw after all input: {mainSw.ElapsedMilliseconds}"); // Check if there is something good to learn var spellToLearn = GetGreatSpell(); if (turnCount < 9 && spellToLearn != null) { // can grab it? if (CanPayLearnTax(spellToLearn, myInv)) { actionIdToTake = new Action { ActionType = "LEARN", ActionId = spellToLearn.Id }; Console.WriteLine($"{actionIdToTake}"); continue; } // Get res to learn actionIdToTake = GetResource(spellToLearn, myInv); if (actionIdToTake != null) { Console.WriteLine($"{actionIdToTake}"); continue; } } Brew bestBrew = GetMostProfitableBrew(); var startState = new State { Casts = Casts, Inventory = myInv, Tome = Tome }; var root = new TreeNode <State>(startState); Console.Error.WriteLine($"mainSw before GetBestAction: {mainSw.ElapsedMilliseconds}"); var quickestToBrew = GetBestAction(root, bestBrew); Console.Error.WriteLine($"mainSw after GetBestAction: {mainSw.ElapsedMilliseconds}"); actionIdToTake = quickestToBrew.Last().Value.ActionTaken; Console.Error.WriteLine($"bestBrew: {bestBrew}"); Console.Error.WriteLine($"quickestToBrew.Count {quickestToBrew.Count}"); Console.Error.WriteLine($"{quickestToBrew.Select(q => q.Value.ToString() + $" nodeTally:{q.Tally}" + $"bestTally{q.Parent?.Children.Max(c => c.Tally)}").Aggregate((a, b) => a + "\n" + b)}"); Console.Error.WriteLine($"root.Depth {root.Depth}"); Console.Error.WriteLine($"root.NumberOfChildren {root.NumberOfChildren}"); // Write an action using Console.WriteLine() // To debug: Console.Error.WriteLine("Debug messages..."); // in the first league: BREW <id> | WAIT; later: BREW <id> | CAST <id> [<times>] | LEARN <id> | REST | WAIT Console.Error.WriteLine($"mainSw at end: {mainSw.ElapsedMilliseconds}"); Console.WriteLine($"{actionIdToTake}"); } }