예제 #1
0
        public override bool Equals(object obj)
        {
            PSpace ps = obj as PSpace;

            if (ps.Memory.Length != Memory.Length)
            {
                return(false);
            }
            //ignore 0 index (lastresult)
            for (int i = 1; i < Memory.Length; i++)
            {
                if (ps.Memory[i] != Memory[i])
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
 public static List<IPSpace> FillPSpace(Rules rules, List<PmarsWarrior> warriorsDllCopy, IntPtr pspaceDll)
 {
     List<IPSpace> res = new List<IPSpace>(rules.WarriorsCount);
     for (int w = 0; w < rules.WarriorsCount; w++)
     {
         PSpace p = new PSpace(rules.PSpaceSize);
         int psindex = warriorsDllCopy[w].pSpaceIndex;
         IntPtr ptr = Marshal.ReadIntPtr(pspaceDll, pointerSize * psindex);
         for (int idx = 0; idx < rules.PSpaceSize; idx++)
         {
             p.Memory[idx] = Marshal.ReadInt32(ptr, idx * intSize);
         }
         res.Add(p);
     }
     return res;
 }