marklreyes / The-Friendship-Algorithm

The Friendship Algorithm as outlined by The Big Bang Theory captured in JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Friendship Algorithm

I'm a big fan of The Big Bang Theory and I couldn't resist playing around with Sheldon's friendship algorithm. It's pretty much one object represented as Sheldon guided by the module pattern (thanks to Addy Osmani).

I encourage you to fork this code and get some zen coding in. Since the logic is "safely" protected by Sheldon, you should be able integrate any boilerplate of your choice for some fun interfaces. Also, feel free to refactor the logic when needed. It could always be better. That said, kudos to Wolowitz for plotting out the loop counter and escape.

Usage

Javascript

Sheldon.ask();

Python

The python version of The Friendship Algorithm (created by @amarrerod) uses a possible friend which answers Shelly's questions with randomly selected options. Therefore, every execution is a chance of getting a new friend.

    python3 algorithm.py

Demo

View Demo

Flowchart

alt text

Watch Video Clip

The Big Bang Theory: Season 2, Episode 13

About

The Friendship Algorithm as outlined by The Big Bang Theory captured in JavaScript.


Languages

Language:JavaScript 54.3%Language:Python 45.7%