Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: A game to pick a favorite from a list
1 point by yashg 13 days ago | hide | past | favorite | 7 comments
Sunday morning programming fun. Created a little game to compare items from a list head-to-head and pick a winner. Inspired from social media short videos where people choose their favourite food, song, holiday destination etc. There are some example lists of cities, movies, actors, fragrances etc to play with and you can create your own list of items and play.

Check it out - https://yash.info/head-to-head.html

I created it mainly to pick a favourite fragrance from my collection of 50+. Not only is a fun project to build but it also allows me to use some of the interesting libraries and code snippets I find.

Programming logic wise there’s nothing fancy happening here, just picking a random element from an array and doing some JS and CSS around that.

New thing that I got to learn was generating a random color of a specific type (pastel, fluorescent, light) by playing with HSL values in a specific range instead of the RGB.

Discovered https://arraythis.com to convert a list to a JS array.

Used SweetAlert https://sweetalert.js.org for alert messages.

Been coding for 20+ years and such little projects still give me the joy of creation plus you always learn/find something that you did not know yesterday.






It seems like once you favor one choice ("Star Wars" in movies, for example) a couple of times, it only lets you compare other movies to Star Wars.

I agree with latexr that for almost every use-case you want this to behave like a bracket that presents a rank of your choices at the end.

Before my boys were born I wrote something similar to help us decide baby names. I put all of my wife's and my choices in a head-to-head arena in a bunch of rounds. They all started out with a base 50 out of 100 score and the winner of each round got bumped up to the loser's cumulative score (if higher) plus some. The loser got bumped down to the winner's score (if lower) minus some.

The game would stop when all names had competed at least 3 times and scores stopped changing much.

I then took my wife's top 10 and my top 10 ran the game again on the smaller combined list. It worked really well, especially helping to resolve the "My favorite is X but yours is Y. You suck" logjam. We could see our favorites overlapped a lot which made it easier to agree on a mutually acceptable choice.


It would be interesting to end up with a ranked list instead of just the top spot.

Yes doable. Can put the unselected choices in another array which is displayed at the end of the game.

My guess is that it's possible to order the first few, but after that I don't care. Top 3 may be fine, and after that perhaps switch to a tier list.

But I guess that this is the type of project where simplicity is a feature for the user, so perhaps only top 1 is better.


> but after that I don't care.

To each their own. But there are more people in the world who have different preferences. Getting the top 1 is useless for my use case because I can just look at the list and pick. But having a way to order the list is useful.


About the first one:

It would be nice (or not) that the app retries the options, like a looser bracket in a elimination championship. In case people is in doubt.

It would be nice that people can share links with custom lists (but prepare to get spam and nasty lists).


Sharing link with custom list is an interesting idea. Need to figure out a way to filter out nasty stuff for sure.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: