Welcome to Byte Heist
Byte Heist is a site with coding challenges. It’s similar to sites like HackerRank, LeetCode, or Advent of Code, except the scoring system is based on the length of your code.
| Normal Code Challenges | Code Golf |
|---|---|
| Can be fun | Can be fun |
| Train algorithms and data structures | Train programming language internals and edge cases |
| Train architecture and readable code | Train mathematics |
| Very satisfying when you finally solve a challenge | Very satisfying when you finally solve a challenge |
You don’t need to care about your score Optimising your score is optional. Feel free to submit fully commented solutions if you prefer to code that way. Especially restricted source.
How to have the most fun
It can be tempting to try to get to the top of the leaderboard, fail and give up. Trying to compare yourself against the top users is a recipe for frustration.
Instead, try to gradually improve your solutions over time.
I have these tips for having the most fun on the site:
- Start by just solving the challenge. Use full length variable names, indentation, and anything you can do to make it more readable. No point in optimizing if you don’t have an efficient solution at all.
- Think about the problem overnight, or in the next few days and weeks. Code golf mostly works by getting a random idea during your morning commute, not by staring at the problem.
- Don’t be afraid to try “stupid” ideas. Sometimes an algorithm that feels less elegant gets you a better score. Sometimes you change a whole bit of your code for no score change but which allows saving bytes somewhere else.
OK but how do I actually get descent scores?
I will just re-iterate that it’s more about personal enjoyment and learning than scores. However, I will link to some resources which might help you:
General Resources
- Code.golf wiki
- Rosetta Code
- Tips for golfing in <all languages> on Code Golf Stack Exchange
- The Online Encyclopedia of Integer Sequences
Python Specific
- Tips for Golfing in Python on Code Golf Stack Exchange - A lot of tips but many are low quality
- Tips for golfing in Python on code.golf wiki - Handful of applicable tips, some are code.golf specific
- Code Golfing in Python on Geeksforgeeks.org - Beginner friendly resource
- Tips for Golfing in Python on codingame.com - Beginner friendly resource
JavaScript (Deno/Node) Specific
- Tips for Golfing in JavaScript on Code Golf Stack Exchange - A lot of tips but many are low quality
- JavaScript on the code.golf wiki - A handful of descent quality tips, some are code.golf specific
Deno will probably be removed from the site at some point.
C Specific
C being ancient means there is a lot of tips online but very scattered. It pays to do some research.
- Tips for golfing in C on Code Golf Stack Exchange - Many answers, mostly low quality
- C on the code.golf wiki - Byte Heist uses the same TCC compiler as code.golf uses so tips regarding it’s idiosyncrasies should apply here too.
Rust Specific
Golfing in Rust is less popular so there are less resources available, but there is also more opportunity to invent new tricks yourself.
- Tips for golfing in Rust on Code Golf Stack Exchange - For Rust, the tips on Code Golf Stack Exchange seem to actually be descent quality
- Rust on the Code.golf wiki - The top section is code.golf specific but the “Random Tips” are helpful on Byte Heist
- Iterator Trait on Rust Docs - Most Rust golfing comes down to choosing the correct method on the Iterator trait, so knowing all of them is quite helpful.
Kotlin Specific
I do now actually know much about golfing in Kotlin so of someone is willing to fill out this section that would be helpful.
TinyAPL specific
TinyAPL is specifically designed for code golf so the official documentation is quite helpful.
Vyxal specific
Vyxal is specifically designed for code golf so the official documentation is quite helpful.
- Official Vyxal 3 Tour
- Tips for Golfing in Vyxal 3 on Code Golf Stack Exchange
- Official Vyxal 3 Tips and Tricks page
- Wiki Page on code.golf - A few basic tips only
Note Vyxal 2 will probably be removed from the site eventually.