Beeminder Forum

Pure function to determine next and last ping?

Hi there! I’m working on a web-based version of TagTime, and I while it will default to a time-hashing based algorithm (more details soon), I want to support the original algorithm as an option for compatibility. Is there a way to determine, from a given timestamp, what the next and last ping are? The JS reference implementation has side-effects, and it would simplify implementation if it were side-effect-free. Is there a more efficient way to do this than starting at the beginning of time and stepping through until getting to now. Thanks!

2 Likes

This is super interesting. Can you describe the reference implementation in more detail?

Ooh, I can’t wait to see your version of TagTime!

@narthur: Official Reference Implementation of the TagTime Universal Ping Schedule

(Googling “tagtime reference implementation” turns that up and you can also find that and other handy links at tagtime.com (let me know when I can add your version to that list, @smitop!)

@smitop: As for the question about a stateless function to get the next and last ping without walking forward from the beginning of time, I don’t think so. Now I’m curious what language/framework you’re implementing this in!

1 Like

A while back I made a TagTime-like system in Android Automate. Here’s some pseudo-code that represents the scheduling strategy I used:

begin
start = 6
end = 19
length = end-start
rand = random()
run = rand <= 0.1 && hour >= start && hour < end
if run:
  ping user
wait 5 minutes
goto begin

There are probably good arguments for why this approach is naive, though I couldn’t articulate them, and the strategy worked well enough for what I was doing. I did have a big discussion with some other users here on the forum regarding the nuances of stochastic time tracking and the practical issues I ran into trying to use it.

Also, if you’re interested in looking at my Automate flow, I’m happy to share more information / an export of the flow.