StringReplace["Mad Hatter", "M"|"H"~~a_~~b_..:>"B"<>a<>"g"]
returns "Bag Bager"
The nice thing is that a string expression can use a RegularExpression as part of the pattern, but it's often not neccesary.
189 karma · joined March 11, 2008
meet.hn/city/us-Chicago
Socials:
- bsky.app/profile/bobbylox.bsky.social
- linkedin.com/in/bobbylox
Interests:
Education, Gaming
---
StringReplace["Mad Hatter", "M"|"H"~~a_~~b_..:>"B"<>a<>"g"]
returns "Bag Bager"
The nice thing is that a string expression can use a RegularExpression as part of the pattern, but it's often not neccesary.
It's cool for many reasons. 1. It's a game, so that's cool. 2. Magic is programming (and vice versa)! I invented a minimal visual programming language for the game. 3. The current cultural context for technology is forbidding to some, so pulling the skill-building out of that context, and into a fantasy world, is more inclusive than most ways of getting started in programming. 4. An author is working on a companion book to go along with the game. 5. I've also promised an online course, 'Python for Codemancers' that will help people who beat the game transfer their skills into a real-world programming language.
https://www.kickstarter.com/projects/bobbylox/codemancer-a-f...