# Exact math, fast enough to feel instant

> A video poker trainer that solves all 2,598,960 five-card deals ahead of time, folds them into 134,459 classes, answers in under a millisecond, and checks its returns against figures published outside the project.

Source: https://claphamdigital.com/work/video-poker-edge/

Clapham Digital · Case study

Video Poker Edge works out the exact expected value of all 32 possible holds on every hand, and answers in under a millisecond.

---

## What it is

A strategy trainer for video poker. Instead of rules of thumb, it calculates the exact expected value of every one of the 32 ways to hold five cards. It’s on the [App Store](https://apps.apple.com/us/app/video-poker-edge/id6757831448) and [Google Play](https://play.google.com/store/apps/details?id=com.videopokeredge.app&hl=en_US); the [app page](https://claphamdigital.com/apps/video-poker-edge) has more.

---

## The hard part

- **Exact is slow.** Working out one hold by brute force means simulating every possible draw, up to 1,533,939 combinations per hold. Correct, and far too slow for a trainer that has to answer the instant you tap.
- **So do the slow part once.** I solved every one of the 2,598,960 possible five-card deals ahead of time and folded them into 134,459 strategically distinct hands. At runtime the app looks the answer up instead of computing it, in under a millisecond.
- **Checked against the outside world.** A table that agrees with itself proves nothing. So the returns get compared with figures published elsewhere, Wizard of Odds among them. For 9/6 Jacks or Better the published return is 99.543904%, and the calculation agrees with it to six decimal places.

---

## What it means for your project

Slow software is usually doing work on every request that could have been done once. I get the answer right first, then make it fast, and check both against something independent. The same approach works on a slow report, a slow search or a slow checkout.

Related: [audits and speed](https://claphamdigital.com/website-performance/) and [custom software](https://claphamdigital.com/web-developer-columbus/).

---

Have something that needs building, fixing or checking? Email [hello@claphamdigital.com](mailto:hello@claphamdigital.com) or call [(614) 835-7163](tel:+16148357163).

[All case studies →](https://claphamdigital.com/work/)
[Blog →](https://claphamdigital.com/blog/)
