Back to Blog

The Smallest AI Model Won! (Claude Coding Challenge) - ASCII Art Coding Challenge

Sandy LaneSandy Lane

Video: The Smallest AI Model Won! (Claude Coding Challenge) - ASCII Art Coding Challenge by Taught by Celeste AI - AI Coding Coach

Watch full page →

The Smallest AI Model Won! ASCII Art Boxes Around Characters

In this coding challenge, three Claude AI models were tasked with generating Python code that prints ASCII-art boxes around each character in a string. The goal was to produce clean, well-documented, and robust code that handles edge cases like empty strings and includes multiple test cases. Surprisingly, the smallest model, Haiku, delivered the most complete and correct solution, outperforming larger counterparts.

Code

def ascii_art_boxes(text):
  """
  Generate ASCII art boxes around each character in the input string.
  Each character is enclosed in a box made of '+' and '-' for horizontal
  lines and '|' for vertical lines. Handles empty strings gracefully.
  """
  if not text:
    return ""

  # Build top, middle, and bottom lines for all characters
  top = ""
  middle = ""
  bottom = ""

  for char in text:
    top += "+-+ "
    middle += f"|{char}| "
    bottom += "+-+ "

  # Combine lines with newline characters
  return f"{top.rstrip()}\n{middle.rstrip()}\n{bottom.rstrip()}"


# Example usage and test cases
if __name__ == "__main__":
  print(ascii_art_boxes("Hi"))
  # Output:
  # +-+ +-+
  # |H| |i|
  # +-+ +-+

  print(ascii_art_boxes(""))
  # Output: (empty string)

  print(ascii_art_boxes("ABC"))
  # Output:
  # +-+ +-+ +-+
  # |A| |B| |C|
  # +-+ +-+ +-+

Key Points

  • The function builds three separate lines (top, middle, bottom) to form boxes around each character.
  • It gracefully handles empty input by returning an empty string without errors.
  • Using string concatenation and formatted strings keeps the code clear and readable.
  • Including a docstring and multiple test cases demonstrates good coding practices.
  • The smallest AI model produced the most complete and clean solution in this challenge.