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
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
import buttons
|
#import buttons
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = get_args()
|
args = get_args()
|
||||||
|
|
@ -18,14 +18,15 @@ def main():
|
||||||
if not key in buckets:
|
if not key in buckets:
|
||||||
buckets[key] = [False, len(buckets)]
|
buckets[key] = [False, len(buckets)]
|
||||||
buckets[key][0] = False if line[0] == "/" else float(line.split()[-1])
|
buckets[key][0] = False if line[0] == "/" else float(line.split()[-1])
|
||||||
for key in bucket:
|
for key in buckets:
|
||||||
keycode = buttons.keys[bucket[key][1]]
|
#keycode = buttons.keys[bucket[key][1]]
|
||||||
if bucket[key][0]:
|
if buckets[key][0]:
|
||||||
print("down", key, button[key])
|
print("down", key, end=" ") #, button[key])
|
||||||
buttons.down(keycode)
|
#buttons.down(keycode)
|
||||||
else:
|
else:
|
||||||
print("up", key, button[key])
|
print("up", key, end=" ") #, button[key])
|
||||||
buttons.up(keycode)
|
#buttons.up(keycode)
|
||||||
|
print()
|
||||||
|
|
||||||
def get_args():
|
def get_args():
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,13 @@ class Window():
|
||||||
for key in keys:
|
for key in keys:
|
||||||
count = len([True for i in self.w if i[0] == key])
|
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(log((count / cnt) * 1024.0, 2)+.5)
|
||||||
scaled_rate = int((count / cnt) * 1024.0 + .5)
|
#scaled_rate = int((count / cnt) * 1024.0 + .5)
|
||||||
scaled_rates[key] = scaled_rate
|
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
|
return scaled_rates
|
||||||
|
|
||||||
def push(self, k):
|
def push(self, k):
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,4 @@ python3 ./testdata/rand_0_n_weighted_stream.py \
|
||||||
| peek \
|
| peek \
|
||||||
| python3 ./stream_to_state.py \
|
| python3 ./stream_to_state.py \
|
||||||
-d 10000 \
|
-d 10000 \
|
||||||
-m 0.1
|
-m 0.2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue