Computer Laboratory

Sticker Collections

This tool was developed after I wrote a blog post about sticker collections. The aim is to quickly check whether it is more likely better to swap a number of stickers or just buy more packets, given the number of stickers you still have to collect. It uses the expectation of the number of additional stickers obtained when buying more packets to identify whether it's likely more cost effective to buy or swap.

Although I've tested the code, it's mainly a prototype toy, so please forgive any errors (and also, please let me know!). Be aware that the tool only gives an indication of the best decision to make based on cost alone and the expected number of additional stickers gained as you buy more packets. The optimal solution depends on how many other swaps you can make and the spare stickers you need to make those swaps. Also note that the last point on the graph's x axis may not be correctly spaced when it shows the number of stickers due to a limitation of the version of Chart.js that I'm using and the fact that, by definition, you can't collect more distinct stickers than the total number available.



Compare the cost of swapping stickers vs buying more packets

Expected Stickers

See how much stickers you expect from a certain number of packets

Required Packets

See how many packets are required for a certain number of stickers



ParameterHTTP GETDescription
QuerytypeType of query: swaps, expectation or required
Total stickerstotalThe total number of stickers in the album
Num remainingremainingThe number of stickers left to complete the collection
Num per packetperpackThe number of stickers in each packet you buy
Packet pricepriceThe price of each packet of stickers
Num packetspacksThe number of packets of additional stickers you will buy, to calculate the expected number of distinct new stickers you will get from them
Num new stickersnewThe number of new stickers you want, to calculate the number of packets you'd expect to need to get this number of distinct tickets
Num to swapswapThe number of distinct stickers you've got to swap, to calculate whether it's worth swapping those stickers or buying new ones
Postage pricepostageThe price of posting those stickers you'd consider swapping