nabu.Usuario.floresDisponibles C# (CSharp) Méthode

floresDisponibles() public méthode

public floresDisponibles ( ) : List
Résultat List
        public List<Flor> floresDisponibles()
        {
            List<Flor> ret = new List<Flor>();
            foreach (Flor f in flores)
                if (f.id == 0)
                    ret.Add(f);
            return ret;
        }

Usage Example

Exemple #1
0
        public void simDiscrepar(Grupo g, Usuario u, Nodo tema)
        {
            //creo hermano o hijo
            List <Nodo> nodes = g.arbol.toList2(tema, new List <Nodo>());
            //si tengo flor en este tema entonces nada
            bool hayFlor = false;

            foreach (Nodo n2 in nodes)
            {
                if (u.getFlor(n2.id) != null)
                {
                    hayFlor = true;
                }
            }
            if (!hayFlor)
            {
                //seleccion nodo al azar dentro del subarbol de n
                Nodo selected = g.arbol.rndElement(nodes);
                if (!selected.consensoAlcanzado)
                {
                    int generacion = int.Parse(selected.nombre);
                    if (u.floresDisponibles().Count > 0)
                    {
                        if (simRND.NextDouble() <= 0.3)
                        {
                            //hijo
                            if (selected.nivel < 5)
                            {
                                simAgregarNodo(g, u, selected, generacion + 1);
                            }
                            else if (selected != tema)
                            {
                                //hermano
                                List <Nodo> path = g.arbol.getPath(selected.id);
                                if (path.Count > 2)
                                {
                                    Nodo padre = path[1];
                                    simAgregarNodo(g, u, padre, generacion + 1);
                                }
                                else if (selected.nivel < 5)
                                {
                                    //hijo
                                    simAgregarNodo(g, u, selected, generacion + 1);
                                }
                            }
                        }
                    }
                }
            }
        }
All Usage Examples Of nabu.Usuario::floresDisponibles