Example #1
0
    static void Main()
    {
        int withoutPenCount = 0;

        string lineReader = Console.ReadLine(); // In this implementation of program, the first line of input doesn't matter
        //string[] tokens = lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        lineReader = Console.ReadLine(); // Students without pen
        string[] withoutPen = lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        lineReader = Console.ReadLine(); // Students with pen
        // Use List<string>, because it is easier to remove directly element by value
        List<string> withPen = new List<string>(lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));

        for (int i = 0; i < withoutPen.Length; i++)
        {
            string left = (int.Parse(withoutPen[i]) - 1).ToString();
            string right = (int.Parse(withoutPen[i]) + 1).ToString();

            if (withPen.Contains(left))
            {
                withPen.Remove(left);
            }
            else if (withPen.Contains(right))
            {
                withPen.Remove(right);
            }
            else
            {
                withoutPenCount++;
            }
        }

        Console.WriteLine(withoutPenCount);
    }
        public void UpdateImports(SolutionEntityItem item, List<String> imports)
        {
            // Remove imports
            imports.Remove (importCocoaApplication);
            imports.Remove (importConsoleApplication);
            imports.Remove (importCocoaLibrary);

            // Check project nature
            MonobjcProject project = item as MonobjcProject;
            if (project == null) {
                return;
            }

            switch (project.ApplicationType) {
            case MonobjcProjectType.CocoaApplication:
                imports.Add (importCocoaApplication);
                break;
            case MonobjcProjectType.ConsoleApplication:
                imports.Add (importConsoleApplication);
                break;
            case MonobjcProjectType.CocoaLibrary:
                imports.Add (importCocoaLibrary);
                break;
            }
        }
Example #3
0
        public List<List<KingsburgDie>> Find( int targetSum, DiceCollection bag )
        {
            //DiceCollection clone = (DiceCollection)bag.Clone();
            DiceCollection clone = bag;
            List<KingsburgDie> elements = (List<KingsburgDie>)clone;
            mResults = new List<List<KingsburgDie>>();
            RecursiveFind( targetSum, 0, new List<KingsburgDie>(), elements, 0 );

            List<List<KingsburgDie>> copy = new List<List<KingsburgDie>>( mResults );
            foreach( List<KingsburgDie> list in copy )
            {
                if( list.Count == 1 )
                {
                    if( list[0].Type != KingsburgDie.DieTypes.Regular )
                    {
                        mResults.Remove( list );
                    }
                }

                IEnumerable<KingsburgDie> linq = from r in list
                                                 where r.Type == KingsburgDie.DieTypes.MarketNegative || r.Type == KingsburgDie.DieTypes.MarketPositive
                                                 select r;
                List<KingsburgDie> marketDice = new List<KingsburgDie>( linq );
                if( marketDice.Count > 1 )
                {
                    mResults.Remove( list );
                }
            }
            return mResults;
        }
        public static List<FortData> Optimize(FortData[] pokeStops, LatLong latlng, GMapOverlay routeOverlay)
        {
            List<FortData> optimizedRoute = new List<FortData>(pokeStops);

            // NN
            FortData NN = FindNN(optimizedRoute, latlng.Latitude, latlng.Longitude);
            optimizedRoute.Remove(NN);
            optimizedRoute.Insert(0, NN);
            for (int i = 1; i < pokeStops.Length; i++)
            {
                NN = FindNN(optimizedRoute.Skip(i), NN.Latitude, NN.Longitude);
                optimizedRoute.Remove(NN);
                optimizedRoute.Insert(i, NN);
                Visualize(optimizedRoute, routeOverlay);
            }

            // 2-Opt
            bool isOptimized;
            do
            {
                optimizedRoute = Optimize2Opt(optimizedRoute, out isOptimized);
                Visualize(optimizedRoute, routeOverlay);
            }
            while (isOptimized);

            return optimizedRoute;
        }
Example #5
0
    /// <summary>
    /// Gets the connected blocks from the children blocks.
    /// </summary>
    /// <returns>List of the connected blocks.</returns>
    /// <param name="children">List of the total blocks.</param>
    /// <param name="root">Root block of the connected blocks.</param>
    List<Transform> getConnectedBlockFrom(List<Transform> children, Transform root = null)
    {
        List<Transform> result = new List<Transform> ();

        if (root == null) {
            root = children[0];
        }
        children.Remove (root);
        result.Add (root);

        List<Transform> neighbors = getNeighbors (root, children);
        foreach (Transform neighbor in neighbors) {
            children.Remove(neighbor);
            result.Add(neighbor);
        }

        List<List<Transform>> recursiveResults = new List<List<Transform>> ();
        foreach (Transform neighbor in neighbors) {
            recursiveResults.Add(getConnectedBlockFrom(children, neighbor));
        }

        foreach (List<Transform> recursiveResult in recursiveResults) {
            result.AddRange(recursiveResult);
        }

        return result;
    }
Example #6
0
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://sam2012"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    //Test1(web);
                   // GetAllItemsIncludeFolders(web);
                    Test2(web);
                }

                Console.ReadKey();
            }

            List<string> l = new List<string>(){"1","2","3","4"};
            for (int i = 0; i < 3; i++)
            {
                string s = l.FirstOrDefault(k => k == 1.ToString());
                l.Remove(s);
                string s1 = l.FirstOrDefault(k => k == 2.ToString());
                l.Remove(s1);
            }

            foreach (string v in l)
            {
                Console.WriteLine(v);
            }

            Console.ReadKey();
        }
        public static void MenuItemGPGSExportUIPackage()
        {
            List<string> exportList = new List<string>();

            Debug.Log("Exporting plugin.");

            AddToList(exportList, "Assets/GooglePlayGames");
            AddToList(exportList, "Assets/Plugins/Android/libs");
            AddToList(exportList, "Assets/Plugins/Android/MainLibProj");
            AddToList(exportList, "Assets/Plugins/iOS");

            exportList.Remove("Assets/GooglePlayGames/Editor/projsettings.txt");
            exportList.Remove("Assets/GooglePlayGames/Editor/GPGSExportPackageUI.cs");
            exportList.Remove("Assets/Plugins/Android/MainLibProj/AndroidManifest.xml");

            string fileList = "Final list of files to export (click for details)\n\n";
            foreach (string s in exportList) {
                fileList += "+ " + s + "\n";
            }
            Debug.Log(fileList);

            string path = EditorUtility.SaveFilePanel("Save plugin to", "",
                              "GooglePlayGamesPlugin-" + GooglePlayGames.PluginVersion.VersionString +
                              ".unitypackage", "unitypackage");

            if (path == null || path.Trim().Length == 0) {
                Debug.LogWarning("Cancelled plugin export.");
                return;
            }

            Debug.Log("Exporting plugin to " + path);
            File.Delete(path);
            AssetDatabase.ExportPackage(exportList.ToArray(), path);
            EditorUtility.DisplayDialog("Export finished", "Plugin exported to " + path, "OK");
        }
Example #8
0
        private static List<int> Merge(List<int> left, List<int> right)
        {
            List<int> result = new List<int>();

            while(left.Count > 0 || right.Count>0)
            {
                if (left.Count > 0 && right.Count > 0)
                {
                    if (left.First() <= right.First())  //Comparing First two elements to see which is smaller
                    {
                        result.Add(left.First());
                        left.Remove(left.First());      //Rest of the list minus the first element
                    }
                    else
                    {
                        result.Add(right.First());
                        right.Remove(right.First());
                    }
                }
                else if(left.Count>0)
                {
                    result.Add(left.First());
                    left.Remove(left.First());
                }
                else if (right.Count > 0)
                {
                    result.Add(right.First());
                    right.Remove(right.First());
                }
            }
            return result;
        }
        public bool Matches(object one, object two)
        {
            var expected = new List<object>(one.As<IEnumerable>().OfType<object>());
            var actual = new List<object>(two.As<IEnumerable>().OfType<object>());

            foreach (object o in actual.ToArray())
            {
                if (expected.Contains(o))
                {
                    actual.Remove(o);
                    expected.Remove(o);
                }
            }

            foreach (object o in expected.ToArray())
            {
                if (actual.Contains(o))
                {
                    actual.Remove(o);
                    expected.Remove(o);
                }
            }

            return actual.Count == 0 && expected.Count == 0;
        }
Example #10
0
        public static List<TableField> GetFilterFields(bool isB2B)
        {
            List<TableField> filterFields = new List<TableField>();
            if (isB2B)
            {
                filterFields.AddRange(GetTableFields(m_B2BMastersTableName));
                filterFields.AddRange(GetTableFields(m_B2BContactsTableName));
                var temp = filterFields.FirstOrDefault(p => p.TableName.ToLower() == m_B2BContactsTableName.ToLower() && p.FieldName.ToLower() == "公司名称");
                if (temp != null)
                    filterFields.Remove(temp);
            }
            else
            {
                filterFields.AddRange(GetTableFields(m_B2CMastersTableName));
            }

            for (int i = filterFields.Count - 1; i >= 0; i--)
            {
                if (filterFields[i].FieldName.ToLower().IsIn("id", "indate", "lasteditdate"))
                {
                    filterFields.Remove(filterFields[i]);
                }
            }

            return filterFields;
        }
Example #11
0
 Vector3 getClosestPosition(ref List<GameObject> listObject)
 {
     GameObject closest = listObject[0];
     if(listObject.Count==1){
         if(closest!=null){ // permet d'éviter de le retourner si le jouerur meurt entre temps
             return closest.transform.position;
         }
         else{
             listObject.Remove(closest);
         }
         return Vector3.zero;
     }
     else{
         if(closest!=null){
             float distanceMin = Vector3.Distance(transform.position,closest.transform.position);
             for (int i = 1; i < listObject.Count; i++){
                 if(listObject[i]!= null){
                     float distance = Vector3.Distance(transform.position, listObject[i].transform.position);
                     if(distance <= distanceMin){
                         distanceMin=distance;
                         closest = listObject[i];
                     }
                 }
                 else{
                     listObject.Remove(listObject[i]);
                     return transform.position;
                 }
             }
             return closest.transform.position;
         }
     }
     return transform.position;
 }
Example #12
0
        /// <summary>
        /// Constructor for Read dialog
        /// </summary>
        public ReadDialog(Epi.Windows.MakeView.Forms.MakeViewMainForm frm)
            : base(frm)
        {
            InitializeComponent();
            Construct();
            SourceProjectNames = new Hashtable();

            if (frm.projectExplorer != null)
            {
                if (frm.projectExplorer.currentPage != null)
                {
                    this.sourceProject = frm.projectExplorer.currentPage.view.Project;
                    this.selectedProject = this.sourceProject;
                    this.selectedDataSource = this.selectedProject;
                    //--EI-48
                    //Adds datatable names to viewlist to enable other tables in project
                    List<string> SourceViewnames = this.sourceProject.GetViewNames();
                    SourceNonViewnames = this.sourceProject.GetNonViewTableNames();
                    foreach(string str in SourceViewnames)
                    {
                        View MView = this.sourceProject.GetViewByName(str);
                        DataTable ViewPages = MView.GetMetadata().GetPagesForView(MView.Id);
                        foreach(DataRow dt in ViewPages.Rows)
                        {
                            string ViewdataTable = MView.TableName + dt[ColumnNames.PAGE_ID];
                            Sourcedatatables.Add(ViewdataTable);
                        }
                        if (SourceNonViewnames.Contains(str)) { SourceNonViewnames.Remove(str); }
                    }
                    foreach(string str in Sourcedatatables)
                    {
                        SourceViewnames.Add(str);
                        if (SourceNonViewnames.Contains(str)) { SourceNonViewnames.Remove(str);}
                    }

                   //--

                    foreach (string s in this.sourceProject.GetNonViewTableNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                           if (SourceViewnames.Contains(s))
                             {
                                SourceProjectNames.Add(key, true);
                             }
                        }
                    }
                    foreach (string s in this.sourceProject.GetViewNames())
                    {
                        string key = s.ToUpper().Trim();
                        if (!SourceProjectNames.Contains(key))
                        {
                            SourceProjectNames.Add(key, true);
                        }
                    }

                }
            }
        }
Example #13
0
        internal static void Initialize(CompositionContainer composition)
        {
            List<Language> languages = new List<Language>();
            if (composition != null)
                languages.AddRange(composition.GetExportedValues<Language>());
            else {
                languages.Add(new CSharpLanguage());
                languages.Add(new VB.VBLanguage());
            }

            // Fix order: C#, VB, IL
            var langs2 = new List<Language>();
            var lang = languages.FirstOrDefault(a => a is CSharpLanguage);
            if (lang != null) {
                languages.Remove(lang);
                langs2.Add(lang);
            }
            lang = languages.FirstOrDefault(a => a is VB.VBLanguage);
            if (lang != null) {
                languages.Remove(lang);
                langs2.Add(lang);
            }
            langs2.Add(new ILLanguage(true));
            for (int i = 0; i < langs2.Count; i++)
                languages.Insert(i, langs2[i]);

            #if DEBUG
            languages.AddRange(ILAstLanguage.GetDebugLanguages());
            languages.AddRange(CSharpLanguage.GetDebugLanguages());
            #endif
            allLanguages = languages.AsReadOnly();
        }
 //методът използва два списъка (left, right), които слива в един сортиран списък
 static List<int> Merge(List<int> left, List<int> right)
 {
     List<int> result = new List<int>();    //декларираме списъка, в който ще получим резултата от сливането и сортирането
     while (left.Count > 0 || right.Count > 0)   //докато има елементи в поне един от двата списъка
     {
         if (left.Count > 0 && right.Count > 0)   //ако има елементи и в двата списъка
         {
             if (left[0] <= right[0])    //ако първият елемент от левия списък е по-малък или равен от/на първия елемент от десния списък
             {
                 result.Add(left[0]);  //постави по-малкия елемент от двата на първо място в сортирания списък
                 left.Remove(left[0]);  //премахни по-малкия елемент от списъка, в който е бил досега
             }
             else
             {
                 result.Add(right[0]);  //постави по-малкия елемент от двата на първо място в сортирания списък
                 right.Remove(right[0]);   //премахни по-малкия елемент от списъка, в който е бил досега
             }
         }
         else if (left.Count > 0)    //ако първият списък има елементи
         {
             result.Add(left[0]);  //постави най-левият елемент от този списък на първо място в сортирания списък
             left.Remove(left[0]);    //премахни елемента от списъка, в който е бил досега
         }
         else if (right.Count > 0)  //ако вторият списък има елементи
         {
             result.Add(right[0]);    //постави най-левият елемент от този списък на първо място в сортирания списък
             right.Remove(right[0]);   //премахни елемента от списъка, в който е бил досега
         }
     }
     return result;   //върни като резултат сортирания слят списък
 }
Example #15
0
        public override IEnumerable<RelationalModelChange> PreFilter(IEnumerable<RelationalModelChange> changes)
        {
            List<RelationalModelChange> filtered = new List<RelationalModelChange>(changes);
            foreach (RelationalModelChange change in changes)
            {
                // if a primary key is being added
                if (change is AddPrimaryKeyChange)
                {
                    // check if the table is being added, in which case
                    // the primary key will be embedded in the CREATE TABLE statement
                    if (IsTableAdded(changes, change.Table))
                        filtered.Remove(change);
                }

                // if a primary key is being dropped
                if (change is DropPrimaryKeyChange)
                {
                    // check if the table is being dropped, in which case
                    // the primary key will be dropped automatically
                    if (IsTableDropped(changes, change.Table))
                        filtered.Remove(change);
                }
            }

			return base.PreFilter(filtered);
        }
		public void Store()
		{
			var tbl = new List<string>(Project.References.ReferencedProjectIds);
			var refs = Project.References as DefaultDReferencesCollection;

			foreach (var i in vbox_ProjectDeps)
			{
				var cb = i as CheckButton;
				
				if (cb == null)
					continue;

				var prj = cb.Data["prj"] as DProject;
				if (prj == null)
					continue;

				var id = prj.ItemId;

				if (cb.Active) {
					if (!tbl.Contains (id))
						refs.ProjectDependencies.Add(id);
					else
						tbl.Remove (id);
				} else {
					if (tbl.Contains (id)) {
						refs.ProjectDependencies.Remove (id);
						tbl.Remove (id);
					}
				}
			}

			foreach (var id in tbl)
				refs.ProjectDependencies.Remove (id);
		}
        private IList<IMenuModel> SortByAfter(IList<IMenuModel> menuModels)
        {
            var sorted = new List<IMenuModel>(menuModels);

            foreach (IMenuModel model in menuModels)
            {
                int newIndex =
                    sorted.FindIndex(m => m.Name.Equals(model.After, StringComparison.InvariantCultureIgnoreCase));

                if (newIndex < 0) continue;

                int currentIndex = sorted.IndexOf(model);

                if (currentIndex < newIndex)
                {
                    sorted.Remove(model);
                    sorted.Insert(newIndex, model);
                }
                else
                {
                    sorted.Remove(model);
                    sorted.Insert(newIndex + 1, model);
                }
            }

            return sorted;
        }
Example #18
0
 static Ostov Algoritm(List<List<int>> matrix, List<Top> tops)
 {
     var near = new Dictionary<Top, Top>();
     var w = new List<Top>(tops);
     var distance = new Dictionary<Top, int>();
     var top = tops[0];
     w.Remove(top);
     var ostov = new Ostov(Enumerable.Range(0, tops.Count).Select(x => new LinkedList<int>()).ToList(), 0);
     for (int i = 0; i < tops.Count; i++)
     {
         near.Add(tops[i], top);
         distance.Add(tops[i], matrix[i][0]);
     }
     while (w.Count != 0)
     {
         var v = distance.Where(x => x.Value != 0 && w.Contains(x.Key)).OrderBy(x => x.Value).First();
         var u = near[v.Key];
         ostov.Graph[v.Key.Number].AddLast(u.Number + 1);
         ostov.Graph[u.Number].AddLast(v.Key.Number + 1);
         ostov.Weight += v.Value;
         w.Remove(v.Key);
         foreach (var versh in w)
         {
             if (distance[versh] > matrix[versh.Number][v.Key.Number])
             {
                 near[versh] = v.Key;
                 distance[versh] = matrix[versh.Number][v.Key.Number];
             }
         }
     }
     return ostov;
 }
Example #19
0
        /// <summary>
        /// Static ctor. Scan the directory structure for cell groups and types.
        /// Groups are the names of subdirectories inside .\cells
        /// Cell types are the names of subdirectories inside each group folder
        /// Variants are the .x files found there - 0.x, 1.x, etc.
        /// </summary>
        static GroupTypeVariant()
        {
            string folder = Directory.GetCurrentDirectory() + "\\cells";			// assume all cell groups are found in .\cells
            string[] path = Directory.GetDirectories(folder);						// get the list of subdirectories (cell groups)

            // Get the list of group names
            List<string> group = new List<string>();
            for (int p = 0; p < path.Length; p++)	    							// remove everything except the subfolder name
            {
                group.Add(Path.GetFileName(path[p]));
            }

            // Ignore system cell types
            group.Remove("CellTypes");
            group.Remove("Cameras");

            group.Sort();

            // Initialise the library elements (GroupTypeVariants)
            library = new GroupTypeVariant[group.Count];                            // Create the library of groups
            for (int g = 0; g < group.Count; g++)			    					// for each group, create the cell type information
            {
                library[g] = new GroupTypeVariant(folder,group[g]);
            }
        }
Example #20
0
    move makeMinMaxMove(List<int> vm)
    {
        move bestMove = new move ();
        List<int> validMovesClone = new List<int> ();

        for (int i = 0; i < vm.Count; i++)
        {
            move tempMove = new move();
            tempMove.pos = vm[i];
            // Make a copy of the old valid moves before doing anything
            validMovesClone = vm;
            // Should happen in a split second
            if(GameObject.Find ("GameController").GetComponent<GameController>().getIsXTurn())
            {
                GameObject.Find ("B"+vm.ToString ()).GetComponentInChildren<Text>().text = "X";
                vm.Remove(i);
                if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 0)
                    tempMove.rank = 1;
                else if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 1)
                    tempMove.rank = -1;
                else if (GameObject.Find ("GameController").GetComponent<GameController>().getTotalMoves () + 1 == 9)
                    tempMove.rank = 0;
                else
                {

                    if (vm.Count>0)
                        tempMove.rank = -makeMinMaxMove (vm).rank;
                    else
                        break;
                }

            }
            else
            {
                GameObject.Find ("B"+validMoves[i].ToString()).GetComponentInChildren<Text>().text = "O";
                vm.Remove(i);
                if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 0)
                    tempMove.rank = -1;
                else if(GameObject.Find ("GameController").GetComponent<GameController>().CheckWin() == 1)
                    tempMove.rank = 1;
                else if (GameObject.Find ("GameController").GetComponent<GameController>().getTotalMoves ()+1 == 9)
                    tempMove.rank = 0;
                else
                {
                    if (vm.Count>0)
                        tempMove.rank = -makeMinMaxMove (vm).rank;
                    else
                        break;
                }

            }

            // revert board to original state
            GameObject.Find ("B"+vm.ToString ()).GetComponentInChildren<Text>().text = "";

        }

        Debug.Log (bestMove.pos);
        return bestMove;
    }
    public override bool Move(LinkedList<MainTrack> route, List<MainTrack> usedTracks)
    {
        if (route.Find(this) == null)
        {
            return false;
        }

        if(!IsDown){

               Link1.Value.Place(route.Find(this).Previous.Value.Contains);
                route.Find(this).Previous.Value.Contains = null;
                usedTracks.Remove(route.Find(this).Previous.Value);
                usedTracks.Add(Link1.Value);
                return true;

        }
        else if(IsDown){

                Link2.Value.Place(route.Find(this).Previous.Value.Contains);
                route.Find(this).Previous.Value.Contains = null;
                usedTracks.Remove(route.Find(this).Previous.Value);
                usedTracks.Add(Link2.Value);
                return true;

        }
        return false;
    }
Example #22
0
    public void InitializeSelf()
    {
        if(SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Ramen) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Yaki_soba) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Zaru_soba) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Curry_with_rice) &&
           SushiShop.NumberOfCansellItem.Contains((int)GoodDataStore.FoodMenuList.Tempura))
        {
            foreach(var obj in arr_foodsSprite)
                obj.gameObject.SetActiveRecursively(false);
            this.animatedSprite.Play("Play");
            this.transform.position = new Vector3(136, 25, 10);
        }
        else {
            this.animatedSprite.Play("Idle");
            this.transform.position = new Vector3(108, 25, 10);
            foreach(var obj in arr_foodsSprite)
                obj.gameObject.SetActiveRecursively(false);

            int ramen_id = (int)GoodDataStore.FoodMenuList.Ramen;
            int yakizoba_id = (int)GoodDataStore.FoodMenuList.Yaki_soba;
            int zaruzoba_id = (int)GoodDataStore.FoodMenuList.Zaru_soba;
            int curry_id = (int)GoodDataStore.FoodMenuList.Curry_with_rice;
            int tempura_id = (int)GoodDataStore.FoodMenuList.Tempura;
            List<int> temp = new List<int>();
            temp.Add(ramen_id);
            temp.Add(yakizoba_id);
            temp.Add(zaruzoba_id);
            temp.Add(curry_id);
            temp.Add(tempura_id);

            for (int i = 0; i < 3; i++) {
                if(SushiShop.NumberOfCansellItem.Contains(ramen_id) && temp.Contains(ramen_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Ramen.ToString());
                    temp.Remove(ramen_id);
                }
                else if(SushiShop.NumberOfCansellItem.Contains(yakizoba_id) && temp.Contains(yakizoba_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Yaki_soba.ToString());
                    temp.Remove(yakizoba_id);
                }
                else if(SushiShop.NumberOfCansellItem.Contains(zaruzoba_id) && temp.Contains(zaruzoba_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Zaru_soba.ToString());
                    temp.Remove(zaruzoba_id);
                }
                else if (SushiShop.NumberOfCansellItem.Contains(curry_id) && temp.Contains(curry_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Curry_with_rice.ToString());
                    temp.Remove(curry_id);
                }
                else if (SushiShop.NumberOfCansellItem.Contains(tempura_id) && temp.Contains(tempura_id)) {
                    arr_foodsSprite[i].gameObject.active = true;
                    arr_foodsSprite[i].spriteId = arr_foodsSprite[i].GetSpriteIdByName(GoodDataStore.FoodMenuList.Tempura.ToString());
                    temp.Remove(tempura_id);
                }
            }
        }
    }
Example #23
0
    static List<char> ReverseDecimalNumber(List<char> decimalNumberList)
    {
        int pointPosition = 0;

        for (int i = 0; i < decimalNumberList.Count; i++)
        {
            if (decimalNumberList[i] == '.')
            {
                pointPosition = i;
                decimalNumberList.Remove('.');
                break;
            }
            else if (decimalNumberList[i] == ',')
            {
                pointPosition = i;
                decimalNumberList.Remove(',');
                break;
            }
        }

        decimalNumberList.Reverse();
        if (pointPosition != 0)
        {
            decimalNumberList.Insert(pointPosition, '.');
        }
        return decimalNumberList;
    }
        private static List<JointType> SortAndPrepeareToReturn(List<KeyValuePair<JointType, double>> overallResultList)
        {
            overallResultList.Sort(ResultComparer);

            var toReturn = new List<JointType>();
            var array = overallResultList.ToArray();
            for (int i = overallResultList.Count - 1; i >= overallResultList.Count - 7; --i)
            {
                if (array[i].Value != 0)
                {
                    toReturn.Add(array[i].Key);
                }
            }

            try
            {
                toReturn.Remove(JointType.FootLeft);
                toReturn.Remove(JointType.FootRight);
                toReturn.Remove(JointType.WristLeft);
                toReturn.Remove(JointType.WristRight);
            }
            catch { }

            return toReturn;
        }
Example #25
0
 public static Zagrada SpojiZagrade(Zagrada a, Zagrada b, int varijabla, Dictionary<int, List<Zagrada>> veze_var_zagrada,List<Zagrada> Formula,List<int> varijable)
 {
     Zagrada nova = new Zagrada();
     for (int i = 0; i < a.varijable.Count; i++)
     {
         if (a.varijable[i] != varijabla && a.varijable[i] != (-varijabla) && (!nova.varijable.Contains(a.varijable[i]))) nova.varijable.Add(a.varijable[i]);
     }
     for (int i = 0; i < b.varijable.Count; i++)
     {
         if (b.varijable[i] != varijabla && b.varijable[i] != (-varijabla) && (!nova.varijable.Contains(b.varijable[i]))) nova.varijable.Add(b.varijable[i]);
     }
     if (!Tautologija(nova))
     {
         for (int i = 0; i < nova.varijable.Count; i++)
         {
             if (!veze_var_zagrada.ContainsKey(nova.varijable[i])) veze_var_zagrada.Add(nova.varijable[i], new List<Zagrada>());
             veze_var_zagrada[nova.varijable[i]].Add(nova);
         }
     }
     nova.tezina = 1;
     popraviVeze(a, b, veze_var_zagrada, varijable);
     Formula.Remove(a);
     Formula.Remove(b);
     return nova;
 }
Example #26
0
        public SimpleExplorer()
        {
            Explore = Explore.FieldsAndProperties | Explore.PublicAndPrivate;
            ShowTypeInProps = true;
            ShowToStringInProps = false;

            ExplorePropsCriterion = AllowExploreProps;
            ExploreElementsCriterion = AllowExploreElements;
            ShowPropsForStandardCollections = false;

            AcceptFieldCriterion = AllowField;
            AcceptPropCriterion = AllowProp;
            AcceptElementCriterion = AllowElement;
            AcceptNodeCriterion = AllowNode;

            LeafTypes = new List<Type>(typeof(IConvertible).GetMethods().Select(m => m.ReturnType));
            LeafTypes.Remove(typeof(Object));
            LeafTypes.Remove(typeof(TypeCode));
            LeafTypes.Add(typeof(Enum));
            LeafTypes.Add(typeof(Delegate));
            LeafTypes.Add(typeof(Type));
            LeafTypes.Add(typeof(Guid));
            LeafCriterion = o => o == null || this.LeafTypes.Any(bt => bt == o.GetType() || bt.IsAssignableFrom(o.GetType()));

            Logic = FilteredExploreImpl;
        }
Example #27
0
        public bool CanStructureBePlaced(Point location, int size, Unit builder, bool cutCorners)
        {
            List<PathNode> placingStructurePathNodes = new List<PathNode>();
            Circle collisionCircle = new Circle(new Vector2(location.X * Map.TileSize + (size / 2) * Map.TileSize, location.Y * Map.TileSize + (size / 2) * Map.TileSize), size * Map.TileSize);
            //placingStructureCenterPoint = collisionCircle.CenterPoint;

            for (int x = location.X; x < location.X + size; x++)
            {
                for (int y = location.Y; y < location.Y + size; y++)
                {
                    PathNode node = Rts.pathFinder.PathNodes[(int)MathHelper.Clamp(y, 0, Map.Height - 1), (int)MathHelper.Clamp(x, 0, Map.Width - 1)];
                    if (collisionCircle.Intersects(node.Tile))
                    {
                        placingStructurePathNodes.Add(node);
                    }
                }
            }
            // remove corners
            if (cutCorners)
            {
                placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y, location.X]);
                if (location.X + size <= Map.Width - 1)
                    placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y, location.X + size - 1]);
                else
                    return false;
                if (location.Y + size <= Map.Height - 1)
                    placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y + size - 1, location.X]);
                else
                    return false;
                placingStructurePathNodes.Remove(Rts.pathFinder.PathNodes[location.Y + size - 1, location.X + size - 1]);
            }

            foreach (PathNode node in placingStructurePathNodes)
            {
                if (!node.Tile.Walkable || node.Blocked)
                    return false;
                if (node.UnitsContained.Count > 0)
                {
                    if (node.UnitsContained.Count == 1 && node.UnitsContained.ElementAt<Unit>(0) == builder)
                        continue;
                    else
                    {
                        bool allow = true;

                        foreach (Unit unit in node.UnitsContained)
                        {
                            if (unit.Team != builder.Team)
                            {
                                allow = false;
                                break;
                            }
                        }
                        if (!allow)
                            return false;
                    }
                }
            }

            return true;
        }
        public ActionResult GetMenuDetailsForUpdate(string menuID, string FCName, string CName, string DName, string SDate, string NoP)
        {
            FoodCourtAdminDAL agent = new FoodCourtAdminDAL();
            UpdateMenuDetails obj = new UpdateMenuDetails();
            obj.MenuItem = new MenuDetails();

            obj.MenuID = Convert.ToInt32(menuID);
            obj.MenuItem.FoodCourtName = FCName;
            obj.MenuItem.CatererName = CName;
            obj.MenuItem.DishName = DName;
            obj.MenuItem.ServingDate = Convert.ToDateTime(SDate);
            obj.MenuItem.NumberOfPlates =Convert.ToInt32(NoP);

            List<string> tempList = new List<string>();

            tempList = agent.FoodCourts();
            tempList.Remove(FCName);
            ViewBag.list1 = tempList;

            tempList = agent.Caterers();
            tempList.Remove(CName);
            ViewBag.list2 = tempList;

            tempList = agent.Dishes();
            tempList.Remove(CName);
            ViewBag.list3 = tempList;

            return PartialView("_AddMenuPartial", obj);
        }
Example #29
0
        public async Task SubscribedWebHooksShouldBeCalledPostDeployment()
        {
            string testName = "SubscribedWebHooksShouldBeCalledPostDeployment";
            var expectedHookAddresses = new List<string>();
            string hook1 = "hookCalled/1";
            string hook2 = "hookCalled/2";

            using (new LatencyLogger(testName))
            {
                await ApplicationManager.RunAsync("HookSite" + testName, async hookAppManager =>
                {
                    using (var hookAppRepository = Git.Clone("NodeWebHookTest"))
                    {
                        string hookAddress1 = hookAppManager.SiteUrl + hook1;
                        string hookAddress2 = hookAppManager.SiteUrl + hook2;

                        WebHook webHookAdded1 = await SubscribeWebHook(hookAppManager, hookAddress1, 1);

                        GitDeployApp(hookAppManager, hookAppRepository);

                        expectedHookAddresses.Add(hook1);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);

                        WebHook webHookAdded2 = await SubscribeWebHook(hookAppManager, hookAddress2, 2);

                        TestTracer.Trace("Redeploy to allow web hooks to be called");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);

                        expectedHookAddresses.Add(hook2);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);

                        TestTracer.Trace("Make sure web hooks are called for failed deployments");
                        await hookAppManager.SettingsManager.SetValue("COMMAND", "thisIsAnErrorCommand");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Failed.ToString());

                        await hookAppManager.SettingsManager.Delete("COMMAND");

                        TestTracer.Trace("Unsubscribe first hook");
                        await UnsubscribeWebHook(hookAppManager, webHookAdded1.Id, 1);

                        TestTracer.Trace("Redeploy to allow web hook to be called");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);

                        expectedHookAddresses.Remove(hook1);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);

                        TestTracer.Trace("Unsubscribe second hook");
                        await UnsubscribeWebHook(hookAppManager, webHookAdded2.Id, 0);

                        TestTracer.Trace("Redeploy to verify no web hook was called");
                        await hookAppManager.DeploymentManager.DeployAsync(hookAppRepository.CurrentId);

                        TestTracer.Trace("Verify web hook was not called");
                        expectedHookAddresses.Remove(hook2);
                        await VerifyWebHooksCall(expectedHookAddresses, hookAppManager, DeployStatus.Success.ToString(), hookAppRepository.CurrentId);
                    }
                });
            }
        }
        public StandardPlayerHelper(IPlayerControl control)
            : base(control)
        {
            int playerCount = Game.Players.Count;
            switch(playerCount)
            {
            case 4:
                unknownRoles = new List<Role> { Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 5:
                unknownRoles = new List<Role> { Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 6:
                unknownRoles = new List<Role> { Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 7:
                unknownRoles = new List<Role> { Role.Deputy, Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Outlaw, Role.Renegade };
                break;
            case 8:
                unknownRoles = new List<Role> { Role.Deputy, Role.Deputy, Role.Outlaw, Role.Outlaw, Role.Outlaw, Role.Renegade, Role.Renegade };
                break;
            default:
                throw new InvalidOperationException();
            }

            entries = new Dictionary<int, PlayerEntry>(playerCount);
            foreach(IPublicPlayerView p in Game.Players)
            {
                entries.Add(p.ID, new PlayerEntry(this, p));
                unknownRoles.Remove(entries[p.ID].EstimatedRole);
            }
            IPrivatePlayerView thisPlayer = ThisPlayer;
            if(entries[thisPlayer.ID].EstimatedRole == Role.Unknown)
                unknownRoles.Remove(entries[thisPlayer.ID].EstimatedRole = thisPlayer.Role);
        }