Пример #1
0
 def toStringLimit(self, limit):
     rlt = ""
     # [] Print the end year and total c count
     rlt += "Year: " + str(self.rlt_endYear) + '\n'
     rlt += "Alive: " + str(self.rlt_creatureCount) + '\n'
     # [] Print general creature types and counts.
     count = 0
     for key, value in self.rlt_remainList.items():
         rlt += key + "|" + str(len(value)) + ", "
         count += 1
         if count > limit:
             break
     # [] Create a creature gen summary
     # # 1D: gen category, 2D: gen rank
     mark = ['A', 'B', 'C', 'D', 'E', 'F']
     genDiagram2D = [[0 for x in range(Creature.attribute_rank_count)]
                     for x in range(Creature.attribute_count)]
     for keys, values in self.rlt_remainList.items():
         for c in values:
             # * Get creature gen summary
             for i in range( 0, len(c.gen) ):
                 # * Find the rank and the sequence
                 value = c.gen[i]
                 gen = Creature.generateNameChar( value )
                 rank = mark.index( gen )
                 # * Add the count
                 genDiagram2D[i][rank] += 1
     # [] Print the creature gen summary
     SystemPlus.consolePrint("Creature attribute summary: \n")
     SystemPlus.consolePrint("+\tA\tB\tC\tD\tE\tF\n")
     for i in range(0, Creature.attribute_count):
         SystemPlus.consolePrint("" + str(i) + ": ")
         for j in range(0, Creature.attribute_rank_count):
             SystemPlus.consolePrint("\t")
             if genDiagram2D[i][j] != 0:
                 SystemPlus.consolePrint(genDiagram2D[i][j])
         SystemPlus.consolePrint("\n")
     rlt += '\n'
     rlt += '\n'
     return rlt