Giter Site home page Giter Site logo

stegosaurus's Introduction

Stegosaurus

I'm a magician in addition to being a software developer. I used Clojure to help develop the algorithm behind a magic trick to create my own version of the trick. The original trick (not invented by me) is called "Stegosaurus" and marketed by Penguin Magic. I currently sell my enhancements made by my Clojure developments on The Game Crafter.

Private code for Scott Starkey's "Stegosaurus" project. See a demo of the original trick at https://www.penguinmagic.com/p/6252 The code is used for my Animal Themed deck at https://www.thegamecrafter.com/games/stegosaurus-animal-themed-poker-size

Important sections and info

The original algorithm of the magic trick is a binary code of letters. In the base effect, cards either have letters for the left side of the keyboard or the right side. The list of 32 5-letter words is numbered 0 to 31. The first letter position is worth 16 points, the second letter is worth 8 points, and so on, so that each word has a unique position in the list in binary numbers. So, the word TIGER is equal to 19, because it is T (16 points), I (does not score 8 points), G (does not score 4 points), E (scores 2 points), R (scores 1 point). The letters scoring their binary position are roughly the left side of the QWERTY keyboard. A word like ONION, all on the right side of the keyboard, scores a 0.

The score-word function accepts a word and an optional regex. (If no regex is supplied, it will use the default regex as in the original effect.) It will provide the binary score of the word given.

The all-english-words-sorted function (no parameters) will show each of the scores for all 5-letter words in the dictionary. Call like (all-english-words-sorted).

The def alpha-combo2 is what I used to pare the 2 million combinations of regexes down to 6 possibilities to fill every slot of my animals.txt word list. Warning! This takes hours to realize the full lazy sequence on my old MacBook Pro. If I made this again, I would probably lean on multi-threading to reduce the time. However, something like (first alfpha-combo2) is safe and much faster. Once I determined the 6 usable regexes, I plugged them into a simple loop to give me the proper animal list to use. (See lines 179-190.)

License

Copyright © 2021. Do not reproduce without permission.

stegosaurus's People

Contributors

jekrac avatar yekrats avatar

Watchers

Jeff Kayser avatar  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.