play with desmos and test.sh until about 2 buttons held per window
parent
7ea0e637da
commit
09ab70d05f
|
|
@ -2,7 +2,7 @@ import argparse
|
|||
import os
|
||||
from time import sleep
|
||||
|
||||
import buttons
|
||||
#import buttons
|
||||
|
||||
def main():
|
||||
args = get_args()
|
||||
|
|
@ -18,14 +18,15 @@ def main():
|
|||
if not key in buckets:
|
||||
buckets[key] = [False, len(buckets)]
|
||||
buckets[key][0] = False if line[0] == "/" else float(line.split()[-1])
|
||||
for key in bucket:
|
||||
keycode = buttons.keys[bucket[key][1]]
|
||||
if bucket[key][0]:
|
||||
print("down", key, button[key])
|
||||
buttons.down(keycode)
|
||||
for key in buckets:
|
||||
#keycode = buttons.keys[bucket[key][1]]
|
||||
if buckets[key][0]:
|
||||
print("down", key, end=" ") #, button[key])
|
||||
#buttons.down(keycode)
|
||||
else:
|
||||
print("up", key, button[key])
|
||||
buttons.up(keycode)
|
||||
print("up", key, end=" ") #, button[key])
|
||||
#buttons.up(keycode)
|
||||
print()
|
||||
|
||||
def get_args():
|
||||
ap = argparse.ArgumentParser()
|
||||
|
|
|
|||
|
|
@ -84,8 +84,13 @@ class Window():
|
|||
for key in keys:
|
||||
count = len([True for i in self.w if i[0] == key])
|
||||
#scaled_rate = int(log((count / cnt) * 1024.0, 2)+.5)
|
||||
scaled_rate = int((count / cnt) * 1024.0 + .5)
|
||||
scaled_rates[key] = scaled_rate
|
||||
#scaled_rate = int((count / cnt) * 1024.0 + .5)
|
||||
x = (count/cnt)
|
||||
x = x * 3
|
||||
x = log(5*x+1, 2)/2
|
||||
x = x / 2
|
||||
#print(f"{count}/{cnt} => {x}")
|
||||
scaled_rates[key] = int(x*self.n+.5)
|
||||
return scaled_rates
|
||||
|
||||
def push(self, k):
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ python3 ./testdata/rand_0_n_weighted_stream.py \
|
|||
| peek \
|
||||
| python3 ./stream_to_state.py \
|
||||
-d 10000 \
|
||||
-m 0.1
|
||||
-m 0.2
|
||||
|
|
|
|||
Loading…
Reference in New Issue