Hacker News new | ask | show | jobs
by leonk 1741 days ago
That’s what contactless cards do now, there’s a PAYG cap. When you read about it doesn’t really sound that complex (not sure if it needed a clever bloke with an algorithm, but then what do I know?)

I guess because they couldn’t work out a way for you to purchase a travel card on your contactless card, so this was the only way to allow regular commuters to use their contactless.

Anyway it was the reason I switched over from oyster to contactless. I realised I was getting ripped off as I would always use PAYG and _sometimes_ went over the caps.

1 comments

There's some complexity arising from zones, and travelcards being based on zonal travel. So it's more complex than just capping it, or comparing it to the price of a travelcard, because you have to consider different combinations of travelcard (period and zone) and which journeys to ignore, leaving at PAYG rate.

I don't know what alpha-beta pruning is, and I'm not necessarily asserting it's massively complex, and I don't know anything about/haven't worked in the area beyond as a user - just pointing out it's not as simple as it might at first seem.

A-B pruning is a technique from chess engines.

Basically, you do a breadth-first full recursive solve, but bail out of any branch that is clearly worse than other candidates.