public ViewResult Text(WordLookUp lookUp) { // LevelCount level = new LevelCount();; if (ModelState.IsValid) { lookUp.Words = textService.DecomposeIntoWords(lookUp.Text, out level); lookUp.Level = level.MaxLevel; lookUp.LevelCount = level; return(View(lookUp)); } else { lookUp = new WordLookUp { Words = new ArrayList(), Level = 0 }; return(View(lookUp)); } }
public ActionResult GenerateFlashCards(WordLookUp lookUp) { LevelCount Level = new LevelCount(); ArrayList arrayList = textService.DecomposeIntoWords(lookUp.Text, out Level); //Ambiguity ArrayList arrayListToInclude = new ArrayList(); foreach (Word w in arrayList) { if (!w.Character.Contains("Ambiguity detected")) { arrayListToInclude.Add(w); } } IncludedWords includedWords = new IncludedWords { Words = ToList(arrayList) }; Session["IncludedWords"] = includedWords; return(RedirectToAction("Index", "FlashCardRandom")); }
private LevelCount CheckLevelCount(LevelCount count) { if (count.levelcount > s_endianCheck) { count.levelcount = ReverseBytes(count.levelcount); } return(count); }
void levelSelect(LevelCount level) { int enemyCount = levelSet[level]; int timeInterval = timeIntervalSet[enemyCount]; enemySpawner = new EnemySpawner(enemyCount, timeInterval); enemySpawner.spawnEnemies(); collisionManager.resetEnemyList(enemySpawner); GameObject go = GameObject.FindGameObjectWithTag("LevelText"); go.guiText.text = "Level " + (currentLevel + 1).ToString(); }
private void printLevels() { int i = 0; while (LevelCount.ContainsKey(i)) { print("Level " + i + ": " + LevelCount[i]); i++; } }
public void GetDeepestBranchWhenBranchIsNull() { //Arrage var levelCount = new LevelCount(); Branch branch = null; //expected NullReferenceException //Actual Program.GetDeepestBranch(branch, levelCount); }
void Awake() { DontDestroyOnLoad(this); if (Instance == null) { Instance = this; } else { Object.Destroy(this.gameObject); } }
public void GetDeepestBranchWithoutAnyListOfBranches() { //Arrage var levelCount = new LevelCount(); Branch branch = new Branch(); var expectedLevel = 1; //Actual var actualLevel = Program.GetDeepestBranch(branch, levelCount).LevelList.Max(); //Assert Assert.AreEqual(expectedLevel, actualLevel); }
public void GetDeepestBranchWithMoreThanOneLevel() { //Arrage var levelCount = new LevelCount(); Branch branch = new Branch() { #region branches = new List <Branch> { new Branch() { branches = new List <Branch> { new Branch(), new Branch() { branches = new List <Branch> { new Branch() } } } }, new Branch(), new Branch() { branches = new List <Branch> { new Branch() } } } #endregion }; var expectedLevel = 4; //Actual var actualLevel = Program.GetDeepestBranch(branch, levelCount).LevelList.Max(); //Assert Assert.AreEqual(expectedLevel, actualLevel); }
Levels levelNum = new Levels(); //create object of Levels class //https://www.mooict.com/c-tutorial-create-a-full-space-invaders-game-using-visual-studio/ //used this for reference on how to make objects move down screen and for keypresses public Form1() { InitializeComponent(); LevelCount.Hide(); //hides the level count //inverts the colors if over a certain score if (menuObject.specialImage == true) //checks to see if property is true { this.BackColor = Color.Black; playerCube.BackColor = Color.White; scoreCount.BackColor = Color.White; foreach (Control x in this.Controls) //loops through each barrier { if (x is PictureBox && x.Tag == "barriers") { x.BackColor = Color.White; } } } else { //resets the colors back to normal this.BackColor = Color.White; playerCube.BackColor = Color.Black; scoreCount.BackColor = Color.White; foreach (Control x in this.Controls) //loops through each barrier { if (x is PictureBox && x.Tag == "barriers") { x.BackColor = Color.Gray; } } } countdown(); }
private void countLevels(Brain b, int level) { if (b != null) { if (!LevelCount.ContainsKey(level)) { LevelCount.Add(level, 0); CurrentCount.Add(level, 1); } LevelCount[level]++; numberOfBrains++; if (b.Children != null) { foreach (Brain child in b.Children) { countLevels(child, level + 1); } } } }
private void ReadStatistics(MemoryStream ms) { LevelCount count = ReadStuctureFromFile <LevelCount>(ms); count = this.CheckLevelCount(count); int num = ReadCount(ms); ms.Position += num - 1; for (int i = 0; i < count.levelcount; i++) { LevelStats stats = ReadStuctureFromFile <LevelStats>(ms); stats = this.CheckStats(stats); ms.Position += 1L; num = ReadCount(ms) - 1; byte[] buffer = new byte[num]; ms.Read(buffer, 0, buffer.Length); string name = Encoding.ASCII.GetString(buffer).ToLower(); StatsDataSource statsData = CreateStatsDataSource(stats.totalkills, stats.killcount, stats.totalsecrets, stats.secretcount, stats.leveltime, name); this.HandleStatsData(statsData); } }
public virtual XmlNode ToXml(XmlDocument worldDoc) { XmlNode iaNode = worldDoc.CreateElement("ImageAccessor"); XmlNode lztsdNode = worldDoc.CreateElement("LevelZeroTileSizeDegrees"); lztsdNode.AppendChild(worldDoc.CreateTextNode(LevelZeroTileSizeDegrees.ToString())); iaNode.AppendChild(lztsdNode); XmlNode extNode = worldDoc.CreateElement("ImageFileExtension"); extNode.AppendChild(worldDoc.CreateTextNode(ImageExtension)); iaNode.AppendChild(extNode); XmlNode tsizeNode = worldDoc.CreateElement("TextureSizePixels"); tsizeNode.AppendChild(worldDoc.CreateTextNode("512")); iaNode.AppendChild(tsizeNode); XmlNode nlevelsNode = worldDoc.CreateElement("NumberLevels"); nlevelsNode.AppendChild(worldDoc.CreateTextNode(LevelCount.ToString())); iaNode.AppendChild(nlevelsNode); XmlNode formatNode = worldDoc.CreateElement("TextureFormat"); formatNode.AppendChild(worldDoc.CreateTextNode(TextureFormat.ToString())); iaNode.AppendChild(formatNode); // If no ImageTileService... if (m_dataDirectory != null) { XmlNode permDirNode = worldDoc.CreateElement("PermanentDirectory"); permDirNode.AppendChild(worldDoc.CreateTextNode(m_dataDirectory)); iaNode.AppendChild(permDirNode); } return(iaNode); }
public ArrayList DecomposeIntoWords(string text, out LevelCount Level) { LoadIncluded(); //TODO Static ArrayList words = Decompose(text, false, 10); ArrayList reversewords = ReverseDecompose(text, false, 10); reversewords.Reverse(); //TODO Procesar ambos ordenes ArrayList processwords = Process(words, reversewords); ArrayList processwordsreverse = Process(words, reversewords); Level = level; return(processwords); }
IEnumerator GetCount(Action <bool, LevelCount> callback) { string url = @"http://localhost:3000/getLevelsCount/"; UnityWebRequest request = UnityWebRequest.Get(url); yield return(request.SendWebRequest()); if (request.isNetworkError || request.isHttpError) { callback(false, null); Debug.Log(request.error); } if (request.isDone) { var result = request.downloadHandler.text.Replace("[", "").Replace("]", ""); LevelCount data = JsonUtility.FromJson <LevelCount>(result); callback(transform, data); } }
private void ReadStatistics(MemoryStream ms) { LevelCount count = ReadStuctureFromFile <LevelCount>(ms); count = CheckLevelCount(count); int stringLength = ReadCount(ms); ms.Position += stringLength - 1; //This part MAY contain the start episode map, just skip it for (int i = 0; i < count.levelcount; i++) { LevelStats stats = ReadStuctureFromFile <LevelStats>(ms); stats = CheckStats(stats); ms.Position += 1; //skip NEW_NAME (27) stringLength = ReadCount(ms) - 1; byte[] levelNameBytes = new byte[stringLength]; ms.Read(levelNameBytes, 0, levelNameBytes.Length); string levelName = Encoding.ASCII.GetString(levelNameBytes).ToLower(); StatsData statsData = CreateBinaryStatsDataSource(stats.totalkills, stats.killcount, stats.totalsecrets, stats.secretcount, stats.leveltime, levelName); HandleStatsData(statsData); } }
private void gameTime_Tick(object sender, EventArgs e) { if (score < 15) { Level = 1; } if (score == 15) //increases level when score is over certain number { speed = 15; LevelCountLabel.Text = "2"; //Level = 2; levelNum.Level = 2; LevelCount.Text = "Level 2! Speed up!"; levelNum.displayLevelCount(); //call the function to disply the next level title if (levelNum.displayLevelTitle == true) { LevelCount.Show(); } changeBarrierColor(); //calls the function to change all barrier colors for each level } else if (score == 16) { levelNum.hideLevelCount(); //rehide the level count label if (levelNum.displayLevelTitle == false) { LevelCount.Hide(); } } else if (score == 25) { speed = 20; LevelCountLabel.Text = "3"; //Level = 3; levelNum.Level = 3; LevelCount.Text = "Level 3! Speed up!"; levelNum.displayLevelCount(); //call the function to disply the next level title if (levelNum.displayLevelTitle == true) { LevelCount.Show(); } } else if (score == 26) { levelNum.hideLevelCount(); //rehide the level count label if (levelNum.displayLevelTitle == false) { LevelCount.Hide(); } } else if (score == 35) { speed = 25; LevelCountLabel.Text = "4"; levelNum.Level = 4; LevelCount.Text = "Level 4! Keep it up!"; levelNum.displayLevelCount(); //call the function to disply the next level title if (levelNum.displayLevelTitle == true) { LevelCount.Show(); } } else if (score == 36) { levelNum.hideLevelCount(); //rehide the level count label if (levelNum.displayLevelTitle == false) { LevelCount.Hide(); } } else if (score == 45) { speed = 30; LevelCountLabel.Text = "5"; levelNum.Level = 5; LevelCount.Text = "Level 5! Good Luck!"; levelNum.displayLevelCount(); //call the function to disply the next level title if (levelNum.displayLevelTitle == true) { LevelCount.Show(); } } else if (score == 46) { levelNum.hideLevelCount(); //rehide the level count label if (levelNum.displayLevelTitle == false) { LevelCount.Hide(); } } else if (score == 55) { speed = 40; LevelCountLabel.Text = "6"; levelNum.Level = 6; LevelCount.Text = "Level 6! Almost to the end!"; levelNum.displayLevelCount(); //call the function to disply the next level title if (levelNum.displayLevelTitle == true) { LevelCount.Show(); } } else if (score == 56) { levelNum.hideLevelCount(); //rehide the level count label if (levelNum.displayLevelTitle == false) { LevelCount.Hide(); } } else if (score == 65) { speed = 60; LevelCountLabel.Text = "Final Level!"; levelNum.Level = 7; LevelCount.Text = "Final Level! Impossible..."; levelNum.displayLevelCount(); //call the function to disply the next level title if (levelNum.displayLevelTitle == true) { LevelCount.Show(); } } else if (score == 66) { levelNum.hideLevelCount(); //rehide the level count label if (levelNum.displayLevelTitle == false) { LevelCount.Hide(); } } if (hitBarrier == false) //checks to see if player hits barrier first { if (moveLeft) { playerCube.Left -= playerSpeed; //moves left by number that is set in player speed } else if (moveRight) { playerCube.Left += playerSpeed; //moves right by number that is set in player speed } foreach (Control x in this.Controls) //loops through each barrier { if (x is PictureBox && x.Tag == "barriers") { if (x.Bounds.IntersectsWith(playerCube.Bounds)) { hitBarrier = true; //change hitBarrier variable this.Controls.Remove(playerCube); //removes the player from the screen gameOver(); //call the gameOver function //System.Threading.Thread.Sleep(1000); return; } x.Top += speed; if (x.Top > 500) //resets the barriers back to the top { x.Top = 0; x.Left = randomNumber.Next(0, 1400); //randomly position the blocks } } } } }
public void ExecRunAll() { try { SetRunning(true); BuildList.Clear(); RunList.Clear(); if (m_dte.Solution.IsOpen) { LevelCount levelCount = new LevelCount(); foreach (TreeNode projectNode in TestList.Nodes) { TreeNodeTag tag = (TreeNodeTag)projectNode.Tag; ArrayList projectList = GetProjectList(m_dte); foreach (Project project in projectList) { if (project.UniqueName == tag.key) { TestRule rule = TestRule.CheckProject(project); if (rule == null) continue; if (RefreshProject(project, true) == false) continue; ClearNode(projectNode, ICON_TYPE.READY, false); GetLevelCount(projectNode, ref levelCount); Runner newRunner = new Runner(this, project, GetConfigurationName( project.UniqueName )); if( newRunner.EnableBind == true ) BuildList.Add(newRunner); else ClearNode(projectNode, ICON_TYPE.ERROR, false); break; } } } progressBar.MaxValue = levelCount.TestCount; } CheckSave(); ThreadRunSelectedNode = null; if (bUseThread) { RunningThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadFuncRun)); RunningThread.Start(); } else { ThreadFuncRun(); } } catch (System.Exception ex) { int a = 0; } }
public void ExecRunSelected() { if( TestList.SelectedNode == null ) return; TreeNodeTag tag = (TreeNodeTag)TestList.SelectedNode.Tag; if (tag.type == TREENODE_TYPE.FAILURE) return; SetRunning(true); TreeNode projectNode = TestList.SelectedNode; while (projectNode.Parent != null) projectNode = projectNode.Parent; TreeNodeTag projectTag = (TreeNodeTag)projectNode.Tag; BuildList.Clear(); RunList.Clear(); if (m_dte.Solution.IsOpen) { ArrayList projectList = GetProjectList(m_dte); foreach (Project project in projectList) { if (project.UniqueName == projectTag.key) { TestRule rule = TestRule.CheckProject(project); if (rule == null) continue; if (RefreshProject(project, true) == false) continue; ClearNode(TestList.SelectedNode, ICON_TYPE.READY, false); if (tag.type == TREENODE_TYPE.TEST) progressBar.MaxValue = 1; else { LevelCount levelCount = new LevelCount(); GetLevelCount(TestList.SelectedNode, ref levelCount); progressBar.MaxValue = levelCount.TestCount; } Runner newRunner = new Runner(this, project, GetConfigurationName( project.UniqueName )); if (newRunner.EnableBind == true) BuildList.Add(newRunner); else ClearNode(projectNode, ICON_TYPE.ERROR, false); break; } } } CheckSave(); ThreadRunSelectedNode = TestList.SelectedNode; if (bUseThread) { RunningThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadFuncRun)); RunningThread.Start(); } else { ThreadFuncRun(); } }
private void TestList_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { TreeNode node = TestList.GetNodeAt( e.X, e.Y ); if( node == null || node.Bounds.Contains( e.X, e.Y ) == false ) { nodeTooltip.Enabled = false; tooltipNode = null; return; } if( node == tooltipNode ) return; nodeTooltip.Enabled = false; TestRule rule = null; string projectNameCompare = ""; TreeNode projectNode = node; while (projectNode.Parent != null) projectNode = projectNode.Parent; if (m_dte.Solution.IsOpen) { ArrayList projectList = GetProjectList(m_dte); foreach (Project project in projectList) { TreeNodeTag projectTag = (TreeNodeTag)projectNode.Tag; if (project.UniqueName == projectTag.key) { if( ConfigManager.Instance.DisplayFullpath == false ) { projectNameCompare = project.FullName.Substring( 0, project.FullName.LastIndexOf('\\') ); } rule = TestRule.CheckProject(project); if (rule == null) return; break; } } } TreeNodeTag tag = (TreeNodeTag)node.Tag; string strTooltip = tag.GetToolTipText(projectNameCompare); LevelCount levelCount = new LevelCount(); GetLevelCount(node, ref levelCount); strTooltip += levelCount.GetTooltip(node, rule.SuiteType != SUITE_TYPE.NOT_USE); nodeTooltip.Title = node.Text; nodeTooltip.SetBalloonText(TestList, strTooltip); tooltipNode = node; nodeTooltip.SetPosition( TestList, node.Bounds.Left, node.Bounds.Bottom); nodeTooltip.Enabled = true; }
private void GetLevelCount( TreeNode node, ref LevelCount levelCount ) { foreach (TreeNode childNode in node.Nodes) { TreeNodeTag tag = (TreeNodeTag)childNode.Tag; switch (tag.type) { case TREENODE_TYPE.PROJECT: break; case TREENODE_TYPE.SUITE: levelCount.SuiteCount++; break; case TREENODE_TYPE.TEST: levelCount.TestCount++; break; case TREENODE_TYPE.FAILURE: levelCount.FailureCount++; break; } GetLevelCount(childNode, ref levelCount); } }