Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def onValueChange(channel: Channel, sampleIndex, val, prev):
- guesser = []
- word = ''
- gate = False
- letter = ''
- """
- I removed the letter code to avoid the unnecessary parts
- """
- guesser.append(letter)
- if me.time.frame % (60 * 2) == 0:
- check = getMostFrequent(guesser)
- if check != False:
- word += getMostFrequent(guesser)
- print(word)
- guesser = []
- """
- print(letter)
- """
- return
- from functools import reduce
- def getMostFrequent(arr):
- hashmap = {}
- for value in arr:
- hashmap[value] = hashmap.get(value, 0) + 1
- return reduce(
- lambda a, b: a if hashmap[a] > hashmap[b] else b,
- hashmap
- )
Advertisement
Add Comment
Please, Sign In to add comment