I took 3 mods to rank CNY snacks...properly



Happy Lunar New Year! TBNG walks you through our needlessly cumbersome methodology to find out the best, the most popular, the most bang-for buck Chinese New Year snack.


My parents have not been back in Singapore for about two years, until recently. This is the trip where they finally started exploring the plethora of Chinese New Year (CNY) goodies that now adorn our shelves in plastic red and deep fried gold. Since then, it has become more of a pastime–nay, an obsession to find the best snack from this unofficial catalogue.


“Your dad and I just sank $60 getting new snacks,” my mum would say now and then, nonchalantly. “Probably last us another half a week.”


To prevent my family’s impending bankruptcy and to ensure there is money left for my education, I believe it to be my filial duty as a son to find out for them, conclusively, what is the best CNY snack, ever.


I’m talking about an election with one winner, where a decent sample of laypersons vote according to an impartial rule, so that I can present to my parents the best, the most popular, the most value-for-money snack this tiny island has to offer.


In particular, I shortlisted 10 snacks to rank after browsing through an unhealthy amount of mindless listicles. They are:

  1. Love Letters, sometimes known as egg rolls,

  2. Kueh Bangkit, a white crumbly flower-shaped shortbread

  3. Open-faced Pineapple Tarts,

  4. Closed Pineapple Tarts, also called Pineapple Balls,

  5. Kuih Loyang, sometimes known as Honeycomb cookies or Kuih Rose

  6. Bak Kwa

  7. Mala Fish Skin

  8. Salted Egg Fish Skin

  9. Prawn Rolls

  10. Arrowhead root chips

And so it began, the poll…

Fig 1: My embarrassing poll on a 10k+ people Telegram Channel. Only 24 of you responded? Seriously?


Enter game theory

It is probably the middle of the semester if you are reading this, and I happen to be taking this module called Strategic Thinking (ECON241) this semester. Oblivious to my nefarious ends, Prof Jingyi has taught me all the ropes, from the axiomatic approach to majority vote, Condorcet consistency and scoring systems and more.


And to said nefarious ends have I applied this knowledge. Upon researching for the candidates, I came across no shortage of tabloids, devoid of proper methodology, listing down page after page of “Here are the 11 best CNY goodies we have chosen” and “8 CNY snacks celebrities love and where to find them”.


Dear 8Days, if your sample size is 1 singer, that should not and cannot come close to an authoritative result.


So here I am on the peak of the Dunning-Kruger curve, attempting to apply what I have just learnt. Allow me to catch you up to speed:

 

Majority rule: convenient, but at what cost?

The most direct way, it appears, is good ol’ fashioned plurality: get all my responses, find what all voters like the best (i.e. their top choice) and find the one snack with the biggest share of them all


Over a selection of 10 snacks, we are looking realistically at a percentage between a possible range of about 11% to 99%. Sure, an 11% victory might be sad, but it’s democracy! If it’s good enough for Greece it’s good enough for my grease.


Oblivious to Prof Ma from the Spreadsheet Modelling mod, my knowledge of Excel has been channeled into absolute frivolity. Thanks to her and the power of PivotTables, we now have an easy way to find out our plurality winner.


Let us give it up to our winner…Love Letters!

Fig. 2: spent 5k on school fees to learn how to use Excel (LOVE LETTERS! LOVE LETTERS! LOVE LETTERS!!... the crowd chants)


Not so fast. Consider the results below: In this microcosm of 5, Love Letters indeed received a majority of ⅖. But ⅗ voters preferred Bak Kwa over Love Letters. This means that if Bak Kwa were not happy and tried to settle matters, hypothetically, at Pioneer Mall sometime around 4pm, Bak Kwa would whoop Love Letters into eggy flakes in a one-on-one.

Adam

Joy

Adele

Aaron

Jared

Love Letters

Love Letters

Bak Kwa

Pineapple tarts (closed)

Pineapple tarts (closed)

Pineapple tarts (closed)

Bak Kwa

Pineapple tarts (closed)

Bak Kwa

Bak Kwa

Bak Kwa

Pineapple tarts (closed)

Love Letters

Love Letters

Love Letters

Kuih Loyang

Pineapple tarts (closed)

Pineapple tarts (closed)

Pineapple tarts (closed)

Pineapple tarts (closed)

This was a complaint raised by a certain Marquis de Condorcet (henceforth Mr C) sometime in 1785. The Condorcet winner satisfied Mr C’s bloodlust by fulfilling the condition that it must best all other candidates in a one on one.


So let’s just find the Condorcet winner, right? Well…

 

What Mr C failed to see

Mr C’s method does not help with three issues: First, it may not produce a winner; second, it doesn’t account for other things; lastly, it’s an absolute pain to calculate a Condorcet winner by myself.


Why wouldn’t it guarantee an outcome? Take my besties again. This time, three of them vote among three snacks and resulted in the following:

Adele

Aaron

Jared

Bak Kwa

Pineapple tart

Kuih Loyang

Pineapple tart

Kuih Loyang

Bak Kwa

Kuih Loyang

Bak Kwa

Pineapple tart

Here we have it that Bak Kwa wins Pineapple tart, Pineapple tart wins Kuih Loyang, but Kuih Loyang in turn wins Bak Kwa… That’s right, everyone is beaten into a bloody pulp in Mr C’s fight club and the real losers are us.


Secondly, Mr C is mean and does not care about our feelings. Clearly Adele’s disapproval of Kuih Loyang is stronger than Aaron, who placed it in second place, so surely we must take that into proper account, lest we devolve into an 8Days listicle.


This was the complaint that a certain Jean-Charles de Borda (henceforth Mr B) raised against Mr C. Mr B believed instead we should rank our snacks: Give first place 1 point, second place 2 points, third place 3, and so on. We then sum up the score of all snacks and give the snack with the lowest sum our Snack Cup Championship Belt.


Lastly, it is an absolute pain to find a Condorcet winner: Someone, probably myself, has to look through all the ballots one by one, comparing two candidates, then do the same again for another pair of snacks, until all 10 snacks are completed.


And it is because of that I realised…it’s Python time.

 

Coding for Mr B and C

I am not sure about you but I do not wish to spend the rest of my life on inaccurate data entry. So, I started to find ways to automate the counting. Luckily, a certain IS111 taught me how to write code and run them. I started by opening three files: function, votersDict and main.


whatTheHell.py

Function was where I put all the calculations in. After some procrastination and some pressure from my editor, I wrote down some pseudocode to motivate myself:

Fig. 3. functions.py pseudocode for all my nerds out there


I then did the actual work of filling it in with nerd magic. Next, I had to put the data into something the computer could understand, so I formatted the data into something usable, then chucked it all into the voterDict file. Luckily, my text editor has sick features that allow me to do this really fast. Any Sublime fans out there?


With the fireworks made, all I need is to set it up into a document where I can launch them off and make it look pretty. These matters I dumped into the file called main. After uploading all the python work into a local API with some tech magic, the programme is ready to tell you the result! I bet you cannot wait.

 

The Grand result:

Fig. 4. Yes, this is how I procrastinate. Make a web app to tell me stuff I already know.


And there we go! Our simple majority winner is Love Letters, Condorcet winner is Arrowhead Root Chips, and our Borda winners are Open Pineapple Tarts and Love Letters.



Ok but like…why?? Who asked?

You would think that with all this data and academic rigour, I would at least solve a problem or two in my life, but alas, as I was clearing up a PowerPoint deck to present to my parents on the only 3 snacks they should spend their money on, I came home to this:

Fig. 5. Gone with the old, in with the new


Before I could present my findings to the relevant stakeholders, they had already abandoned their previous obsession for a newfound fad. Indeed we live in a VUCA world. I mean, CNY hasn’t even begun yet!


If there’s anything to be learnt, I suppose it is that there is no cure for unbridled gluttony. No mods, no data, no analysis can save our financial future. That being said, no knowledge is worthless. I earnestly hope that these insights have brought you some entertainment.


With that, wishing you a prosperous Chinese New Year. May all your mahjong winnings cover for the food.


(…But seriously though, open-faced tarts won closed tarts? You people are Philistines.)

 

Post script:

If you want to see my working you can follow this link.

  1. I know I'm supposed to do the Python read file and for loop thingy to extract the results but yeah...the sample size is too small for that. So nah, not worth the trouble

  2. If you're wondering why your terminal tells you "fLAsK MoDuLE nOt FoUnD" then you might want to install Flask before launching the Python file

Also, just want to shout out to deep fried crab sticks. We all know that's the real winner.