Guest User

Untitled

a guest
Oct 12th, 2026
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. def onValueChange(channel: Channel, sampleIndex, val, prev):
  2.  
  3. guesser = []
  4. word = ''
  5. gate = False
  6.  
  7. letter = ''
  8.  
  9.  
  10. """
  11. I removed the letter code to avoid the unnecessary parts
  12. """
  13.  
  14. guesser.append(letter)
  15.  
  16. if me.time.frame % (60 * 2) == 0:
  17. check = getMostFrequent(guesser)
  18.  
  19. if check != False:
  20. word += getMostFrequent(guesser)
  21.  
  22. print(word)
  23.  
  24. guesser = []
  25.  
  26.  
  27. """
  28. print(letter)
  29. """
  30.  
  31. return
  32.  
  33. from functools import reduce
  34.  
  35.  
  36. def getMostFrequent(arr):
  37. hashmap = {}
  38.  
  39. for value in arr:
  40. hashmap[value] = hashmap.get(value, 0) + 1
  41.  
  42. return reduce(
  43. lambda a, b: a if hashmap[a] > hashmap[b] else b,
  44. hashmap
  45. )
  46.  
Advertisement
Add Comment
Please, Sign In to add comment