Ejemplo n.º 1
0
        public void Add(Attack attack, float damage)
        {
            int index = Attacks.FindIndex(x => x.Attack == attack);

            if (index == -1)
            {
                Attacks.Add(new AttackAndDamage(attack, damage));
            }
            else
            {
                Attacks.Array[index].addDamage(damage);
            }
        }
    public static LinkedList <Uinf> TriangulateGauss(this LinkedList <Uinf> Rows, LinkedList <int> RowsRearrangement, MyLib.MyArrayList <Uinf> RowsTransposedAndGaussInfo)
    {
        int ilen = Rows.Count;

        if (RowsRearrangement.Count < ilen)
        {
            return(Rows.RearrangeRowsFromTriangulation(RowsRearrangement, 0).TriangulateGauss(RowsRearrangement, RowsTransposedAndGaussInfo));
        }
        LinkedListNode <Uinf> NodeRow = Rows.First;

        RowsTransposedAndGaussInfo.Clear(Rows.First.Value.Length);
        int i = 0;

        for (Uinf shifted = new Uinf(1ul, ilen); i < RowsRearrangement.First.Value; NodeRow = NodeRow.Next, shifted <<= 1, i++)
        {
            if ((NodeRow.Value & shifted) == 0ul)
            {
                return(Rows.RearrangeRowsFromTriangulation(RowsRearrangement, i).TriangulateGauss(RowsRearrangement, RowsTransposedAndGaussInfo));
            }
            RowsTransposedAndGaussInfo.Add(new Uinf(ilen));
            //Debug.Log(NodeRow.Value);
            int j = 0;

            for (LinkedListNode <Uinf> NodeRow2 = Rows.First; j < i; NodeRow2 = NodeRow2.Next, j++)
            {
                if ((NodeRow2.Value & shifted) != 0ul)
                {
                    RowsTransposedAndGaussInfo.LastElement.SetBit(j);
                }
            }
            j++;
            for (LinkedListNode <Uinf> NodeRow2 = NodeRow.Next; NodeRow2 != null; NodeRow2 = NodeRow2.Next, j++)
            {
                if ((NodeRow2.Value & shifted) != 0ul)
                {
                    NodeRow2.Value ^= NodeRow.Value;
                    RowsTransposedAndGaussInfo.LastElement.SetBit(j);
                    //Debug.Log((i - 1).ToString() + " " + RowsTransposedAndGaussInfo.LastElement.ToString());
                }
            }
        }
        return(Rows);
    }
Ejemplo n.º 3
0
 public T[] getArray1D()
 {
     MyLib.MyArrayList <T> tempList = new MyLib.MyArrayList <T>(Size);
     DFS((x) => tempList.Add(x.Value));
     return(tempList.Array);
 }