GithubHelp home page GithubHelp logo

goober's Introduction

goober

My sister posed a game involving emojis. Given a word, represent it with emojis without using the emoji that directly indicates the word. E.g. the solution for "cat" can't include "๐Ÿˆ". Since it's my sister's game, I dubbed it Kaley Encoding.

Rules

The rules are simple and vague enough to allow for creativity and some amusement. There's no single correct solution for every input; I could use the emojis for ears, eyes, and a tongue to represent a dog (my sister claimed it was a horse).

Solution

This program takes a single word as input and outputs a solution. If it can't find a solution, it fails.

This solution compares the input to the names of emojis (e.g. "๐Ÿ•" is cat and "๐Ÿ•" is dog), finds the longest sequence of matching characters, and records the emoji-count pairing. The result is a sequence of emojis where the count indicates how many characters from the name can be read. The count is given by the color of the heart: no heart means one letter, a red heart means two, orange means three, etc. How can we remember what the colors mean? ROY G BIVโ€”where red means two.

I chose hearts because the world could always use a little more love and kindness when communicating.

Examples

$ goober --reference -i cat
Reference:
๐ŸŒต cactus
๐Ÿฆ– t-rex

Result:
๐ŸŒตโค๏ธ๐Ÿฆ–

The encoding for "cat" is a cactus emoji followed by a red heart and a t-rex. The red heart indicates we use two letters from the preceding emoji while no heart following the t-rex means only use one letter. Using the reference, the result is "ca" from cactus and "t" from t-rex. Cat!

This works for nonsensical inputs (NB some emojis appear wide):

$ goober --reference -i asdf
Reference:
๐Ÿง‘โ€๐Ÿš€ astronaut
๐Ÿ—ก๏ธ dagger
๐Ÿญ factory

Result:
๐Ÿง‘โ€๐Ÿš€โค๏ธ๐Ÿ—ก๏ธ๐Ÿญ

As well as more complex inputs:

$ goober --reference -i supercalifragilisticexpialidocious
Reference:
๐Ÿฆธ superhero
๐Ÿ“… calendar
๐ŸงŠ ice
๐Ÿธ frog
๐Ÿงฎ abacus
๐Ÿฆ’ giraffe
โ™Ž libra
๐ŸŸ๏ธ stadium
๐ŸงŠ ice
๐Ÿฉป x-ray
โ›๏ธ pick
๐Ÿ‘ฝ alien
๐Ÿฆค dodo
๐Ÿšฌ cigarette 
๐Ÿ™ octopus
โ˜‚๏ธ umbrella
โ™ sagittarius

Result:
๐Ÿฆธ๐Ÿ’š๐Ÿ“…๐Ÿงก๐ŸงŠ๐Ÿธโค๏ธ๐Ÿงฎ๐Ÿฆ’โค๏ธโ™Žโค๏ธ๐ŸŸ๏ธโค๏ธ๐ŸงŠ๐Ÿงก๐Ÿฉปโ›๏ธโค๏ธ๐Ÿ‘ฝ๐Ÿงก๐Ÿฆคโค๏ธ๐Ÿšฌโค๏ธ๐Ÿ™โ˜‚๏ธโ™

If an emoji can't be found for even a single character, the program will fail:

$ goober --reference -i asdfqwerty
panicked at 'No sequence available'

Future Work

Nope.

goober's People

Contributors

jneufeld avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.