View Single Post
ndi's Avatar
Posts: 2,050 | Thanked: 1,425 times | Joined on Dec 2009 @ Bucharest
#44
It's not supposed to be full-proof, but to adjust to each person's cycle, which is not divisible by 24 hours, among other things.

I don't know how the original is coded, but the way I would do it is this (I use 100 days for a cycle for ease of math):

Day 1: Cycle day? yes.
Day 2: Cycle day? yes.
Day 3: Cycle day? yes.
Day 4: Cycle day? no.
Day 5: Cycle day? no.
....
Day 99: Cycle day? no.
Day 100: Cycle day? no.
Day 101: Cycle day? Yes. <<

At this point, I know that this girl has a 100 day cycle, with a 3 day active. All days in which user has said nothing are considered "no".

At this point, I predict that days 101, 102 and 103 will be active, and 104-200 are inactive. 201-301 active, etc. I paint active days in light red, because they are predicted. I paint 1-3 in actual red because they are known.

I keep predicting like this until someone corrects me. Let's say that instead of 501-503, users says 502-504. I know the cycle is still 100, so I'm guessing 602-604. If user corrects me again, and I get 603-605, then the average cycle is sliding towards 101 days.

Internally, I keep a decaying average of cycle length and active days and predict based on that from the last "known" sample.

Let's say user has entered 1 Jan, 2 Jan, 3 Jan, 1 Feb, 2 Feb, 3 Feb.

I look though the database and note:

1, 2, 3 are consecutive. That's Cycle 1, 3 days.
3, 4, 5 are consecutive. That's Cycle 2, 3 days.

Therefore, uint_cycle is 31, uint_length is 3. Start running predictions. First day would actually be 3rd Mar or something.

Cool part is, I can now draw a graph. I know that Jan cycle lasted 31 days and it had a 3 day active period. Such a graph can be used to review past information.

Optionally, the next cycle i based on the last 3. Otherwise, an average of all cycles thus far.

Many an app exist, like this, but this only has a starting day, not an end day. Easier to predict. I picked that to show because of the bar graph in the screenshot. That's a cycle length graph.

I think I had this. But I can't be sure, there are so many clones, I had one with red bars and better-looking calendar.

I know this is a lot of time wasted to do right, but I'm thinking that at a bare minimum, a user could double-click a day in MaeGirls and set it to a different color, like, pink or something. That day gets added to a list, in a number format, maybe a UNIX date or something similar, like days since 2010-01-01 so it's be easy to do math. Double-clicking again removes it.

Once you have a list of dates, just build an average and set the cycle length to that, instead of 28. Ideally, see if cycle length exceeds 35 or so and if it does, auto-split it to become as close to 28 as possible (so user doesn't have to manually check every month when making corrections). But it's entirely optional.

And a bar graph is easy. Get a new window, identical to this, except exchange full height bars for length-of-cycle bars and the days under the graph in months.

It's more complicated for a full implementation, but the simple one isn't that hard to do. Right now, full-day regular clockwork cycle system covers about 1% of all females.
__________________
N900 dead and Nokia no longer replaces them. Thanks for all the fish.

Keep the forums clean: use "Thanks" button instead of the thank you post.