MCPcopy Create free account
hub / github.com/ActiveState/code / add

Method add

recipes/Python/577365_MineSweep/recipe-577365.py:916–925  ·  view source on GitHub ↗
(self, name, score)

Source from the content-addressed store, hash-verified

914 self.__data = {999: [''] * size}
915
916 def add(self, name, score):
917 assert self.eligible(score)
918 if score in self.__data:
919 self.__data[score].insert(0, name)
920 else:
921 self.__data[score] = [name]
922 if len(self.__data[max(self.__data)]) == 1:
923 del self.__data[max(self.__data)]
924 else:
925 del self.__data[max(self.__data)][-1]
926
927 def eligible(self, score):
928 return score <= max(self.__data)

Callers 10

uniqueFunction · 0.45
sizeofFunction · 0.45
recipe-577957.pyFile · 0.45
objwalkFunction · 0.45
setMethod · 0.45
calculateMethod · 0.45
__finish_gameMethod · 0.45
connectMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

eligibleMethod · 0.95
maxFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected