private static Core initCore()
        {
            Core.resetCore();
            Core core = Core.getCore();

            Symbole symA = new Symbole("A");
            Symbole symB = new Symbole("B");
            Symbole symD = new Symbole("D");
            Symbole symE = new Symbole("E");
            Symbole symG = new Symbole("G");
            Symbole symH = new Symbole("H");
            Symbole symF = new Symbole("F");
            Symbole symI = new Symbole("I");
            Symbole symJ = new Symbole("J");
            Symbole symL = new Symbole("L");
            Symbole symM = new Symbole("M");
            Symbole symK = new Symbole("K");
            Symbole symO = new Symbole("O");
            Symbole symP = new Symbole("P");
            Symbole symN = new Symbole("N");

            symA.addRelation(new RightNormal(symB));
            symB.addRelation(new RightNormal(new LeftAnd(symD, symE)));
            symF.addRelation(new RightNormal(new LeftAnd(symG, symH)));
            symG.addRelation(new RightNormal(new LeftAnd(symI, symJ)));
            symH.addRelation(new RightNormal(symG));
            symK.addRelation(new RightNormal(new LeftAnd(symL, symM)));
            symL.addRelation(new RightAnd(symN, new LeftAnd(symO, symP)));
            symN.addRelation(new RightAnd(symL, new LeftAnd(symO, symP)));
            symM.addRelation(new RightNormal(symN));
            return(core);
        }
 public void Init(Symbole symbole, ConnectionType connectionType)
 {
     this.symbole        = symbole;
     this.connectionType = connectionType;
     this.connections    = new List <ConnectionCallPoint>();
     this.knobeColor     = Color.green;
 }
 public bool OnMouseOverSymbole(Vector2 mousePosition)
 {
     mousePosition = few.InvGraphToScreenSpace(mousePosition);
     if (symboles != null)
     {
         selectedSymbole = null;
         for (int i = symboles.Count - 1; i > -1; i--)
         {
             var area = symboles[i].NodeSize;
             if (area.Contains(mousePosition))
             {
                 selectedSymbole        = symboles[i];
                 Selection.activeObject = selectedSymbole;
                 //callback(symboles[i]);
                 break;
             }
         }
         if (selectedSymbole)
         {
             MoveSelectedTotop(selectedSymbole);
             return(true);
         }
     }
     return(false);
 }
示例#4
0
    public Boolean ShowLine()
    {
        Random  randomGenerator = new Random();
        int     randomInt       = randomGenerator.Next(Enum.GetNames(typeof(Symbole)).Length);
        Symbole firstObject     = (Symbole)randomInt;

        randomInt = randomGenerator.Next(Enum.GetNames(typeof(Symbole)).Length);
        Symbole secondObject = (Symbole)randomInt;

        randomInt = randomGenerator.Next(Enum.GetNames(typeof(Symbole)).Length);
        Symbole thirdObject = (Symbole)randomInt;

        string firstObjectString  = addSpacesToTextForAligment(firstObject.ToString());
        string secondObjectString = addSpacesToTextForAligment(secondObject.ToString());
        string thirdObjectString  = addSpacesToTextForAligment(thirdObject.ToString());

        Console.WriteLine(String.Format("|{0,11}|{1,11}|{2,11}|", firstObjectString, secondObjectString, thirdObjectString));
        if (firstObject == secondObject && secondObject == thirdObject)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#5
0
        private bool UserAction(Symbole symbole)
        {
            Console.Clear();
            RenderBoard(moves);
            if (symbole == Symbole.Draw)
            {
                Console.Write("\nmatch drawn. ");
            }
            else
            {
                Console.Write("\nPlayer '{0}' wins. ", symbole == Symbole.Circle ? 'O' : 'X');
            }
            Console.Write("play again? [Y/N]: ");
            ConsoleKeyInfo keyinfo = Console.ReadKey();

            if (keyinfo.Key == ConsoleKey.Y)
            {
                ResetGame();
                return(false);
            }
            else if (keyinfo.Key == ConsoleKey.N)
            {
                return(true);
            }
            else
            {
                return(UserAction(symbole));
            }
        }
 public void OnClickRemoveAllNode()
 {
     if (selections != null && selections.Count > 0)
     {
         selections.Clear();
     }
     selectedSymbole         = null;
     selectedInputPoint      = null;
     selectedOutputPoint     = null;
     selectedInputCallPoint  = null;
     selectedOutputCallPoint = null;
     if (RemovedCP != null)
     {
         foreach (var remove in RemovedCP)
         {
             AssetDatabase.RemoveObjectFromAsset(remove);
         }
     }
     if (RemovedCCP != null)
     {
         foreach (var remove in RemovedCCP)
         {
             AssetDatabase.RemoveObjectFromAsset(remove);
         }
     }
     if (RemovedS != null)
     {
         foreach (var remove in RemovedS)
         {
             Debug.Log(remove.name);
             if (remove.shouldCall && remove.Call)
             {
                 AssetDatabase.RemoveObjectFromAsset(remove.Call);
             }
             AssetDatabase.RemoveObjectFromAsset(remove);
         }
     }
     AssetDatabase.SaveAssets();
     AssetDatabase.Refresh();
     RemovedCP  = points;
     RemovedCCP = callPoints;
     RemovedS   = symboles;
     if (symboles != null)
     {
         symboles = null;
     }
     if (points != null)
     {
         points = null;
     }
     if (callPoints != null)
     {
         callPoints = null;
     }
     Selection.activeObject = null;
 }
 public bool RemoveConnection(Symbole symbole)
 {
     if (this.symbole == symbole)
     {
         return(true);
     }
     connections.Remove(symbole.Call);
     connections.Remove(symbole.Receive);
     return(false);
 }
示例#8
0
        public static void jouerUneCase(Morpion grille, Tour PositionDeLacase)
        {
            MaCase CaseAjouer = grille.Cases[PositionDeLacase.i, PositionDeLacase.j];


            if (AffecterSymbole(CaseAjouer, grille.SymboleDujoueurCourant) == true)
            {
                Symbole symboleDuProchainJoueur = grille.SymboleDujoueurCourant == Symbole.Croix ? Symbole.Rond : Symbole.Croix;
                grille.SymboleDujoueurCourant = symboleDuProchainJoueur;
            }
        }
 public void Init(Symbole symbole, FieldInfo field, PointAttribute attribute)
 {
     this.symbole          = symbole;
     this.name             = field.Name;
     this.field            = field;
     this.connectionType   = attribute.connectionType;
     this.valueProp        = attribute.valueProp;
     this.knobeColor       = attribute.color;
     Connections           = new List <ConnectionPoint>();
     OutputStyle           = new GUIStyle();
     OutputStyle.alignment = TextAnchor.MiddleRight;
 }
        private static Core initCore()
        {
            Core.resetCore();
            Core core = Core.getCore();

            Symbole symA = new Symbole("A");
            Symbole symB = new Symbole("B");
            Symbole symC = new Symbole("C");

            symC.addRelation(new RightInvert(new LeftOr(symA, symB)));
            return(core);
        }
示例#11
0
        private static Core initCore()
        {
            Core.resetCore();
            Core core = Core.getCore();

            Symbole symA = new Symbole("A");
            Symbole symB = new Symbole("B");
            Symbole symC = new Symbole("C");
            Symbole symD = new Symbole("D");

            symD.addRelation(new RightNormal(new LeftAnd(symA, new LeftAnd(symB, symC))));
            return(core);
        }
示例#12
0
        private static Core initCore()
        {
            Core.resetCore();
            Core core = Core.getCore();

            Symbole symA = new Symbole("A");
            Symbole symB = new Symbole("B");
            Symbole symC = new Symbole("C");

            symC.addRelation(new RightXor(symB, symA));
            symB.addRelation(new RightXor(symC, symA));

            return(core);
        }
示例#13
0
 public Morpion(int lig, Symbole choix)
 {
     this.Cases = new MaCase[lig, lig];
     this.SymboleDujoueurCourant = choix;
     for (int u = 0; u < lig; u++)
     {
         for (int v = 0; v < lig; v++)
         {
             MaCase macase = new MaCase();
             macase.Symbolecourant = null;
             this.Cases[u, v]      = macase;
         }
     }
 }
 public bool RemoveConnection(Symbole symbole)
 {
     if (this.symbole == symbole)
     {
         return(true);
     }
     if (symbole.fieldPoints != null && symbole.fieldPoints.Count > 0)
     {
         foreach (var point in symbole.fieldPoints)
         {
             Connections.Remove(point);
         }
     }
     return(false);
 }
示例#15
0
        public static bool AffecterSymbole(MaCase caseCourante, Symbole symboleAtribuer)
        {
            bool TesteSiVide = true;

            if (caseCourante.Symbolecourant == null)
            {
                caseCourante.Symbolecourant = symboleAtribuer;
            }
            else
            {
                TesteSiVide = false;
            }


            return(TesteSiVide);
        }
示例#16
0
 private void RechercheParLigne(char c, int lig, int col)
 {
     if (nbHypothese > 1)
     {
         for (int i = 0; i < size; i++)
         {
             if (i != col)
             {
                 if (Symbole.IndexOf(TabGrille[lig, i]) != -1 && !tabVérifNombre[Symbole.IndexOf(TabGrille[lig, i])])
                 {
                     setVrai(Symbole.IndexOf(TabGrille[lig, i]));
                 }
             }
         }
     }
 }
示例#17
0
        private void CréerLesCases(char[,] Tab)
        {
            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    if (Symbole.IndexOf(Tab[i, j]) != -1)
                    {
                        nbHypothese   = 1;
                        Hypotheses    = new char[nbHypothese];
                        Hypotheses[0] = Tab[i, j];

                        tabCase[i, j] = new Case(Tab[i, j], nbHypothese, Hypotheses);
                    }
                    else
                    {
                        //MessageBox.Show("Il manque qlq fonctionnalité au Grille.cs");

                        InitialiserTabVérifNombre();
                        nbHypothese = size;
                        RechercheParLigne(Tab[i, j], i, j);

                        RechercheParColonne(Tab[i, j], i, j);

                        RechercheParRegion(Tab[i, j], i, j);

                        Hypotheses = new char[nbHypothese];

                        int compte = 0;

                        for (int p = 0; p < size; p++)
                        {
                            if (!tabVérifNombre[p])
                            {
                                Hypotheses[compte] = Symbole[p];
                                compte++;
                            }
                        }

                        tabCase[i, j] = new Case(Tab[i, j], nbHypothese, Hypotheses);
                    }
                }
            }
        }
 private void OnClickRemoveNode()
 {
     if (selections != null && selections.Count > 0)
     {
         selections.Clear();
     }
     if (points != null && points.Count > 0)
     {
         var PRemoveables = points.Where(x => x.RemoveConnection(selectedSymbole)).ToList();
         foreach (var removable in PRemoveables)
         {
             AssetDatabase.RemoveObjectFromAsset(removable);
             points.Remove(removable);
         }
     }
     if (callPoints != null && points.Count > 0)
     {
         var CPRemoveables = callPoints.Where(x => x.RemoveConnection(selectedSymbole)).ToList();
         foreach (var removable in CPRemoveables)
         {
             AssetDatabase.RemoveObjectFromAsset(removable);
             callPoints.Remove(removable);
         }
     }
     if (selectedSymbole.shouldCall && selectedSymbole.Call)
     {
         AssetDatabase.RemoveObjectFromAsset(selectedSymbole.Call);
     }
     if (selectedSymbole.shouldReceive && selectedSymbole.Receive)
     {
         AssetDatabase.RemoveObjectFromAsset(selectedSymbole.Receive);
     }
     if (graph.ContainCall(selectedSymbole.name))
     {
         graph.RemoveCall(graph.CallsValue[graph.CallsName.IndexOf(selectedSymbole.name)]);
         graph.RemoveCall(selectedSymbole.name);
     }
     AssetDatabase.RemoveObjectFromAsset(selectedSymbole);
     symboles.Remove(selectedSymbole);
     selectedSymbole = null;
     AssetDatabase.SaveAssets();
 }
示例#19
0
        private void RechercheParRegion(char c, int lig, int col)
        {
            if (nbHypothese > 1)
            {
                int  tailleCarré = (int)Math.Sqrt(size);
                bool CarréEstValide = false;
                int  divC, divL, modC, modL;

                divC = col / tailleCarré;
                modC = col % tailleCarré;
                divL = lig / tailleCarré;
                modL = lig % tailleCarré;

                for (int i = divL * tailleCarré; i < divL * tailleCarré + tailleCarré; i++)
                {
                    if (i != col)
                    {
                        for (int j = divC * tailleCarré; j < divC * tailleCarré + tailleCarré; j++)
                        {
                            if (j != col)
                            {
                                if (Symbole.IndexOf(TabGrille[i, j]) != -1 && !tabVérifNombre[Symbole.IndexOf(TabGrille[i, j])])
                                {
                                    setVrai(Symbole.IndexOf(TabGrille[i, j]));
                                    CarréEstValide = true;
                                }
                                else
                                {
                                    CarréEstValide = false;
                                    break;
                                }
                                if (!CarréEstValide)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
示例#20
0
    public bool OnNodeSelected(Symbole symbole)
    {
        var e = Event.current;

        switch (e.type)
        {
        case EventType.MouseDown:
            if (e.button == 0)
            {
                if (symbole.NodeSize.Contains(few.InvGraphToScreenSpace(e.mousePosition)) && e.mousePosition.y > 18 && !symboleManager.selectedOutputPoint)
                {
                    isDragged   = true;
                    GUI.changed = true;
                }
                else
                {
                    symboleManager.selectedSymbole = null;
                    GUI.changed = true;
                    return(false);
                }
            }
            break;

        case EventType.MouseUp:
            isDragged = false;
            break;

        case EventType.MouseDrag:
            if (e.button == 0 && isDragged)
            {
                symbole.NodeSize = symboleManager.DragSymbole(symbole.NodeSize);
                e.Use();
            }
            break;
        }
        if (symbole.NodeSize.Contains(few.InvGraphToScreenSpace(e.mousePosition)) && e.mousePosition.y > 18 && !symboleManager.selectedOutputPoint)
        {
            return(true);
        }
        return(false);
    }
    public bool RemoveSymbole(Vector2 mousePosition)
    {
        if (symboles != null)
        {
            for (int i = symboles.Count - 1; i > -1; i--)
            {
                var area = symboles[i].NodeSize;
                if (area.Contains(few.InvGraphToScreenSpace(mousePosition)))
                {
                    selectedSymbole = symboles[i];
                    GenericMenu genericMenu = new GenericMenu();
                    genericMenu.AddItem(new GUIContent("Remove node"), false, () => { Selection.activeObject = null; OnClickRemoveNode(); });
                    genericMenu.ShowAsContext();

                    return(true);
                    //callback(symboles[i]);
                }
            }
        }
        return(false);
    }
 public void OnClickRestoreAllNodes()
 {
     selectedSymbole         = null;
     selectedInputPoint      = null;
     selectedOutputPoint     = null;
     selectedInputCallPoint  = null;
     selectedOutputCallPoint = null;
     points     = RemovedCP;
     callPoints = RemovedCCP;
     symboles   = RemovedS;
     if (RemovedS != null)
     {
         RemovedS = null;
     }
     if (RemovedCP != null)
     {
         RemovedCP = null;
     }
     if (RemovedCCP != null)
     {
         RemovedCCP = null;
     }
     Selection.activeObject = null;
 }
 private void MoveSelectedTotop(Symbole symbole)
 {
     if (symbole != symboles.LastOrDefault())
     {
         symboles.Remove(symbole);
         symboles.Add(symbole);
         GUI.changed = true;
     }
     new System.Threading.Thread(() =>
     {
         int i = 0;
         foreach (var s in symboles)
         {
             if (s.GetType().GetCustomAttribute(typeof(MethodSymboleAttribute)) != null)
             {
                 graph.ChangeIndex(s.GetType().Name, i);
             }
             i++;
         }
     })
     {
         IsBackground = true
     }.Start();
 }
示例#24
0
        public static void Test() //A + !B => C
        {
            Console.WriteLine("Expression: A + !B => C");
            Core core = Core.getCore();

            Symbole symA = new Symbole("A");
            Symbole symB = new Symbole("B");
            Symbole symC = new Symbole("C");

            symC.addRelation(new RightNormal(new LeftAnd(symA, new LeftInvert(symB))));

            Console.WriteLine("Test: A=" + core.getValueOf("A") + ", B=" + core.getValueOf("B") + " Res=" + core.getValueOf("C"));
            global::ExpertSystem.Test.writeResult(core.getValueOf("C"), Result.FALSE);

            core.setTrue("A");
            Console.WriteLine("Test: A=" + core.getValueOf("A") + ", B=" + core.getValueOf("B") + " Res=" + core.getValueOf("C"));
            global::ExpertSystem.Test.writeResult(core.getValueOf("C"), Result.TRUE);

            core.setTrue("B");
            Console.WriteLine("Test: A=" + core.getValueOf("A") + ", B=" + core.getValueOf("B") + " Res=" + core.getValueOf("C"));
            global::ExpertSystem.Test.writeResult(core.getValueOf("C"), Result.FALSE);

            Core.resetCore();
        }
 public void SetSelection(Symbole symbole)
 {
     selectedSymbole = symbole;
 }
示例#26
0
 public RightXor(Symbole rightSymbole, ProgramObject leftObject)
 {
     this.rightSymbole = rightSymbole;
     this.leftObject   = leftObject;
 }