コード例 #1
0
        //int badCount;
        private void valePrinter(ProjectHandler ph, List<String> indexNumbers, List<PanelSlot> panelSlots, int[] assignments, Boolean useDict)
        {
            //badCount=0;
            List<Int32> nillRuns = new List<int>();
            Boolean inNillRun = false;
            int currentNillRunValue = 0;
            for (int i = 0; i < panelSlots.Count; i++)
            {
                int compater;
                if (useDict)
                {
                    assignedData.TryGetValue(panelSlots[i],out compater);
                    if (compater < 0)
                    {
                        compater = indexNumbers.Count;
                    }
                }
                else{
                    compater = assignments[i];
                }

                if (compater < indexNumbers.Count)
                {

                    int assignmentvalue=AssignmentValue(ph, panelSlots, assignments, i, useDict);
                    if (assignmentvalue==0) //suicide
                    {
                        overAllValue = 0;
                        return;
                        //badCount++;
                    }

                    overAllValue += assignmentvalue;
                    if (inNillRun)
                    {
                        inNillRun = false;
                        nillRuns.Add(currentNillRunValue);
                        currentNillRunValue = 0;
                    }
                }
                else
                {
                    if (inNillRun)
                    {
                        currentNillRunValue++;
                    }
                    else
                    {
                        inNillRun = true;
                        currentNillRunValue = 1;
                    }
                }

            }
            //overAllValue -= (10 * badCount * badCount);

            if (currentNillRunValue != 0)
            {
                nillRuns.Add(currentNillRunValue);
            }
            int allNillCount = 0;
            for (int i = 0; i < nillRuns.Count; i++)
            {
                allNillCount+=nillRuns[i];
            }
        }
コード例 #2
0
 private int AssignmentValue(ProjectHandler ph, List<PanelSlot> panelSlots, int[] assignments, int i, Boolean useDict)
 {
     int index;
     if (useDict)
     {
         assignedData.TryGetValue(panelSlots[i], out index);
         if (index < 0)
         {
             return (0);
         }
     }
     else
     {
         index = assignments[i];
     }
     return ph.EvaluateProjectAgainstPanel(index, panelSlots[i].InternalEvaluators, panelSlots[i].ExternaEvaluators);
 }