<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maurits van Riezen</title>
    <description>The latest articles on DEV Community by Maurits van Riezen (@mousetail).</description>
    <link>https://dev.to/mousetail</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F314773%2Ff196eb79-8f31-428a-9f74-7b1b1c921a5a.png</url>
      <title>DEV Community: Maurits van Riezen</title>
      <link>https://dev.to/mousetail</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mousetail"/>
    <language>en</language>
    <item>
      <title>Making code fun again: An introduction to code golf</title>
      <dc:creator>Maurits van Riezen</dc:creator>
      <pubDate>Mon, 17 Nov 2025 20:36:42 +0000</pubDate>
      <link>https://dev.to/mousetail/making-code-fun-again-an-introduction-to-code-golf-166p</link>
      <guid>https://dev.to/mousetail/making-code-fun-again-an-introduction-to-code-golf-166p</guid>
      <description>&lt;p&gt;Most programmers know about platforms like LeetCode, HackerRank, or Codeforces, and likely know the thrill of solving problems under constraints: time limits, memory budgets, edge cases, and algorithmic cleverness. But an elite few know about a different kind of challenge: quirky, creative, and surprisingly addictive:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Code Golf.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are many places to play code golf. You probably have encountered &lt;a href="https://codegolf.stackexchange.com" rel="noopener noreferrer"&gt;Code Golf Stack Exchange&lt;/a&gt; in the sidebar on stack overflow, and the very competitive &lt;a href="https://code.golf" rel="noopener noreferrer"&gt;Code.golf&lt;/a&gt;. There are also smaller platforms like &lt;a href="https://byte-heist.com" rel="noopener noreferrer"&gt;Byte Heist&lt;/a&gt;. (Disclaimer: I am affiliated with Byte Heist)&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Code Golf?
&lt;/h2&gt;

&lt;p&gt;In competitive coding, you usually optimize for speed or correctness.&lt;br&gt;
In Code Golf, you optimize for brevity.&lt;/p&gt;

&lt;p&gt;Your mission:&lt;br&gt;
Solve a programming challenge using as few bytes as possible.&lt;/p&gt;

&lt;p&gt;It's two layers of puzzle: Your solution must work, but you must also contort and re-imagine it until it barely resembles typical production code and exposes the pure mathematics underneath. At its best, it’s a blend of logic, optimization, mathematics, and artistry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Golf Teaches Useful Skills
&lt;/h2&gt;

&lt;p&gt;Even though in Code Golf you don't write code in a style you would use at your work, it still does strengthen several real-world engineering abilities:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Deep Knowledge of Your Language
&lt;/h3&gt;

&lt;p&gt;Golfing encourages you to explore the darkest corners of a language:&lt;/p&gt;

&lt;p&gt;Weird operators, Built-ins you never knew existed (like python's &lt;code&gt;string.translate&lt;/code&gt;), alternate ways to express conditionals (&lt;code&gt;1 == b &amp;lt; 3&lt;/code&gt; is valid python), behavior of data structures (Sets of integers in python tend to sort themselves if they contain small enough numbers)&lt;/p&gt;

&lt;p&gt;You end up learning your language at a more atomic level, digging through the documentation to find obscure side effects you might be able to use. Seeing every bug as a opportunity. Knowing every bug in your programing language is also invaluable when debugging why real production code isn't working properly.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Improved Algorithmic Flexibility
&lt;/h3&gt;

&lt;p&gt;Golfing often forces you to consider many approaches:&lt;/p&gt;

&lt;p&gt;Can you replace sorting with clever arithmetic or bit-wise operations?&lt;/p&gt;

&lt;p&gt;Can you avoid loops with vector operations or recursion or the evil &lt;code&gt;exec("statement;"*n)&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;Can you collapse multiple steps into one expression?&lt;/p&gt;

&lt;p&gt;This kind of mental flexibility pays off when you need clean, elegant solutions in non-golf settings too.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Better Understanding of Trade-Offs
&lt;/h3&gt;

&lt;p&gt;In code golf, you have a lot of questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do I bother to parse and re-format my input or is it faster to work directly on the string form?&lt;/li&gt;
&lt;li&gt;Is it worth the overhead of extracting some useful bit info a separate function&lt;/li&gt;
&lt;li&gt;Is it worth importing some functions from the standard library or is it shorter to implement this myself?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Creative Problem-Solving
&lt;/h3&gt;

&lt;p&gt;Golfing lets you treat programming like a linguistic game, which helps unlock lateral thinking. It encourages you to ask:&lt;/p&gt;

&lt;p&gt;“What’s the absolute strangest way I can solve this correctly?”&lt;/p&gt;

&lt;p&gt;That creativity often translates to innovative real-world solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Golf Is Fun
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. It Turns Programming Into a Game
&lt;/h3&gt;

&lt;p&gt;There’s something undeniably satisfying about shaving off just one more character and watching your ranking jump a few spots.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The Aha! Moments
&lt;/h3&gt;

&lt;p&gt;Every programmer knows this feeling:&lt;br&gt;
You go to sleep stuck on a problem, wake up, and realize what you need to do.&lt;/p&gt;

&lt;p&gt;Code golf is full of these moments. Sometimes I wake up and think:&lt;/p&gt;

&lt;p&gt;“Wait—can't I just use a 2d array?”&lt;/p&gt;

&lt;p&gt;Suddenly your solution shrinks by 20 bytes.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The Community
&lt;/h3&gt;

&lt;p&gt;Code Golf's has a very friendly culture, full of people who care deeply about the details of how computers work, not just the minimum needed to vibe code a basic React app. Most golfers also have a deep love of mathematics leading to casual discussions about Turin machines, OEIS sequences, P vs. NP and similar topics.&lt;/p&gt;

&lt;p&gt;Also they sometimes share golfing tips.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips for New Golfers
&lt;/h2&gt;

&lt;p&gt;You don't need to understand esoteric wizardry to have fun with code golf. Here are some starter habits:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Write a Verbose Solution First
&lt;/h3&gt;

&lt;p&gt;Begin with what you already know.&lt;br&gt;
A clean, readable, fully working solution is the foundation. If the code doesn't work, then it's not going to get any points no matter how short.&lt;/p&gt;

&lt;p&gt;Only when you get a working solution, you can start shorten variables, removing whitespace, and look for redundancies.&lt;/p&gt;

&lt;p&gt;Think “refactor,” but taken to a mischievous extreme.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Sleep On It
&lt;/h3&gt;

&lt;p&gt;Your brain often finds new angles after a break. Fresh eyes see simpler expressions and forgotten shortcuts.&lt;/p&gt;

&lt;p&gt;Sometimes you think you have found a optimal score but weeks later during your morning commute, you suddenly have an insight.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Research, Research, Research
&lt;/h3&gt;

&lt;p&gt;It pays to try many possible algorithms, even ones that seem more complex or verbose at first sight. Sometimes just the act of trying to optimize a worse algorithm gives you insight you can apply to the better ones.&lt;/p&gt;

&lt;p&gt;Half of code golf is research, you can look for these kinds of topics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Alternate representations of (parts of) the problem&lt;/li&gt;
&lt;li&gt;Mathematical identities&lt;/li&gt;
&lt;li&gt;Your languages' standard library &lt;/li&gt;
&lt;li&gt;Language-specific shortcuts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Often, when researching for one golf problem, you encounter a game-changing fact which helps at an entirely different problem. Or something useful for your work and non-golf problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Ask for Tips in the Community
&lt;/h3&gt;

&lt;p&gt;The various site's chats and discords are full of friendly golfers who love to help.&lt;/p&gt;

&lt;p&gt;You’re welcome to ask:&lt;/p&gt;

&lt;p&gt;“Is there a shorter way to parse dates in Rust?”&lt;/p&gt;

&lt;p&gt;“Does JavaScript have a trick for converting strings to arrays?”&lt;/p&gt;

&lt;p&gt;“Is your 402 byte solution using python itertools?”&lt;/p&gt;

&lt;p&gt;Depending on the site, sharing exact solutions is discouraged, but people may share tips. Remember to be polite, no one is obliged to answer your questions and some people prefer to keep their tips to themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Important Notes for New Players
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Golfing Is Optional
&lt;/h3&gt;

&lt;p&gt;On &lt;a href="https://code.golf" rel="noopener noreferrer"&gt;Code.golf&lt;/a&gt; and &lt;a href="https://byte-heist.com" rel="noopener noreferrer"&gt;Byte Heist&lt;/a&gt;, you are not required to submit compressed or unreadable code.&lt;/p&gt;

&lt;p&gt;If you find the challenge difficult enough to even solve, or simply prefer to write well-indented, beautifully structured solutions and don't care about your score, that’s perfectly allowed. Golfing is an extra challenge, not a requirement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codegolf.stackexchange.com" rel="noopener noreferrer"&gt;Code Golf Stack Exchange&lt;/a&gt; does require a "reasonable effort" in shortening your code as golfing there is more of a collaborative effort. &lt;/p&gt;

&lt;h3&gt;
  
  
  Focus on Improving Your Personal Best
&lt;/h3&gt;

&lt;p&gt;Many top golfers have years of experience, language-specific tricks, and encyclopedic knowledge of obscure language features.&lt;/p&gt;

&lt;p&gt;Don’t compare yourself to them.&lt;/p&gt;

&lt;p&gt;Your only competition is your previous score.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give It a Try
&lt;/h2&gt;

&lt;p&gt;If you’re an experienced programmer looking for:&lt;/p&gt;

&lt;p&gt;A new challenge,&lt;/p&gt;

&lt;p&gt;A playful way to sharpen your skills, or&lt;/p&gt;

&lt;p&gt;A friendly community of problem-solvers…&lt;/p&gt;

&lt;p&gt;…then Code Golf might be the sport for you.&lt;/p&gt;

&lt;p&gt;You might come for the puzzles, but you’ll stay for the “aha!” moments, the clever tricks, and the joy of making your code smaller, more cursed, and weirder than you ever thought possible.&lt;/p&gt;

</description>
      <category>codegolf</category>
      <category>challenge</category>
    </item>
    <item>
      <title>I built a game about guessing definitions for words</title>
      <dc:creator>Maurits van Riezen</dc:creator>
      <pubDate>Tue, 28 Jan 2020 15:37:20 +0000</pubDate>
      <link>https://dev.to/mousetail/i-built-a-game-about-guessing-definitions-for-words-4l1l</link>
      <guid>https://dev.to/mousetail/i-built-a-game-about-guessing-definitions-for-words-4l1l</guid>
      <description>&lt;p&gt;I set myself a challenge to build a game in a week. I did not meet that deadline, in total it has been 8 days now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz5faxgjrilr72suj1eh6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz5faxgjrilr72suj1eh6.png" alt="Alt Text" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  The Concept
&lt;/h1&gt;

&lt;p&gt;I got my idea while playing a similar game on pencil and paper with my family. I thought, "this would make an easy online mutliplayer game" and immediately impulsively bought the domain name &lt;a href="https://dictionaryga.me/?ref=devto" rel="noopener noreferrer"&gt;dictionaryga.me&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The concept of the game would be simple: Users can write potential definitions for words, then other users will guess which one is correct. You will gain points both for writing plausible definitions as well as for guessing correctly. You will also gain points for submitting words that few people can guess correctly.&lt;/p&gt;

&lt;h1&gt;
  
  
  More technical concepts
&lt;/h1&gt;

&lt;p&gt;One thing I wanted to do differently was not requiring users to log in. I wanted a secure way to keep track of users and scores that would happen all in the background without the users actually noticing anything.&lt;/p&gt;

&lt;p&gt;The way I accomplish this is by creating a automatic temporary account if a player presses "play" on the home page. This will generate a UUID that will be saved in local storage so the user can always log in again. A user can choose to save their data to a full account later if they want to play on multiple devices or customize their name in the leaderboard.&lt;/p&gt;

&lt;h1&gt;
  
  
  Implementation: Backend
&lt;/h1&gt;

&lt;p&gt;I built the backend in Django because I like their ORM and basic security setup. The database (postgres) will need to keep track of words, definitions, and which definition is correct. This required a circular foreign key relationship that Django actually accepts quite happily.&lt;/p&gt;

&lt;p&gt;One important step is generating a random word. At first, I generated a random word and if it had sufficient definitions I made it a choice otherwise I made it a write. However, I felt it was not that fun to get multiple thought-intense write questions in a row, so in the session I store the number of questions asked so far and modulo that to get the type of question to generate.&lt;/p&gt;

&lt;h1&gt;
  
  
  Implementation: Frontend
&lt;/h1&gt;

&lt;p&gt;Frontend is a simple react app. Since I had little experience in the area, I decided to use as many animations and transitions as possible. Doing animations in react is a bit of a challenge but there are some decent libraries. A different challenge is generating a good deterministic key so the transition does not glitch, though this still goes wrong some time.&lt;/p&gt;

&lt;p&gt;An extra advantage of transitions is that it hides loading time. I can easily load the next word in the time before the last page transitions out. The next page starts transitioning in as soon as it loads. This means that in case of high latency sometimes the timing looks a bit off, but overall I feel like the experience becomes much smoother.&lt;/p&gt;

&lt;h1&gt;
  
  
  Bugs
&lt;/h1&gt;

&lt;p&gt;During my first test it turned out all the correct answers started with a capital while incorrect answers usually started with a lower case letter.&lt;/p&gt;

&lt;p&gt;During my second test lots of duplicate definitions got submitted. I needed to add a good system to prevent submitting a definition if a similar one already existed.&lt;/p&gt;

&lt;p&gt;I had built a system to prefer adding a definition to words that already had a couple, in order to speed up words becoming guessable. However, I found out that over 300 words had only two definitions while only about 30 had 4. Turned out I was filtering by "1 or above" which included all words since there was always the correct answer accounting for 1. I changed it to 2 or above and now words are graduating more rapidly.&lt;/p&gt;

&lt;h1&gt;
  
  
  Play the game
&lt;/h1&gt;

&lt;p&gt;You can play the game here &lt;a href="https://dictionaryga.me/?ref=devto" rel="noopener noreferrer"&gt;dictionaryga.me&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://gitlab.com/mousetail/dictionaryga.me" rel="noopener noreferrer"&gt;gitlab&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>react</category>
      <category>django</category>
    </item>
  </channel>
</rss>
