You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parameters would be the sizes of large and small steps and the ratio of large steps to small steps with some sane defaults for the initial state of the "billiard ball".
If we want to generalize this package to larger varieties the parameters would be the sizes of steps and an array of proportionalities between them.
0.5° 🌜 — Today at 5:24 PM
my billiard-related Python code, for comparison, is:
defcollisions(alphabet: Sequence[str],
vel: Sequence[Fraction],
start_pos: Sequence[Fraction]) ->Iterator[str]:
dim=len(alphabet)
ifdim==0:
raiseValueError('alphabet should be nonempty')
iflen(vel) !=dim:
raiseValueError('len(vel) should equal len(alphabet)')
iflen(start_pos) !=dim:
raiseValueError('len(start_pos) should equal len(alphabet)')
ifany(v<=0forvinvel):
raiseValueError('vel should contain positive numbers')
ifnotall(0<=x<1forxinstart_pos):
raiseValueError('start_pos should contain numbers 0 <= x < 1')
# we’ll decrement to 0 with unit velocity in each dimensionpos= [(1-x) /vforx, vinzip(start_pos, vel)]
start_pos=pos.copy()
bounds=tuple(1/vforvinvel)
whileTrue:
times= [(x, j) forj, xinenumerate(pos)]
times.sort()
t0=times[0][0] # the first imminent collision timefort, jintimes:
ift==t0:
pos[j] =bounds[j]
# in a tie, different j should go in increasing orderyieldalphabet[j]
else:
pos[j] -=t0ifpos==start_pos:
return# cycle
should be fully general due to start_pos
also usually the first velocity is okay to be equally 1
https://en.xen.wiki/w/Hypercubic_billiard_word
The text was updated successfully, but these errors were encountered: