I was looking for something to build and came across the Clash of Clans developer API.
I didn't have a particular problem I wanted to solve. I just started looking through the API and wondering what I could build with the data it exposes.
That eventually turned into WarOracle.
The basic idea is to simulate a Clash of Clans war and see how it could play out.
For a clan, I look at the current war, players, Town Hall levels, heroes/equipment and previous attack history. From that, I build an estimate of how individual attacks might perform.
Then I run the remaining war through Monte Carlo simulations and aggregate the results.
It gives things like:
- win/loss/draw probability
- expected final stars
- possible final score range
- distribution of simulated outcomes
One part that took more thought than I expected was ongoing wars.
If a war is already halfway through, I can't just simulate the whole thing from scratch. The attacks that already happened are known outcomes, so I treat them as fixed and only simulate the attacks that are still available.
I also experimented with using the same data to generate attacker/target assignments. I'm not completely convinced that part is useful yet.
The backend is Spring Boot/Java and the frontend is React. The simulation engine is multithreaded, and I'm currently experimenting with how much player-specific history should influence the outcome versus using general historical data.
The project is here:
I'm mainly putting this out because I'm curious about two things:
Does this actually seem useful to a Clash player?
If you've built simulation/probabilistic systems before, how would you approach modeling something like this when the available data is limited and pretty noisy?
I'm still figuring out whether I built something people actually need or just an interesting experiment with an API.


Top comments (0)