All works

2025Java game

MathChamp

A console game for wise mathematicians: is this sequence arithmetic, quadratic, cubic or prime? Guess right to climb ten levels.

  • Java
  • Algorithms

Overview

Each round generates a random sequence. Answer correctly to level up and see the sequence's nth-term formula; answer wrong and you drop a level.

Harder sequence types unlock as you climb: quadratic at level 3, cubic at level 5 and primes at level 7. Reach level 10 to win.

See it in action

From one real game, run from the code on GitHub.

  1. MathChamp at level 3: the sequence 1, 10, 27, 52, 85 answered B, a quadratic sequence, 4n² - 3n
    01 A right answer levels you up and shows the nth term.
  2. MathChamp at level 6: a cubic sequence answered as quadratic, dropping to level 5
    02 A wrong one drops you a level.
  3. MathChamp's ending: the game beaten in 0 minutes and 43 seconds
    03 Reach level 10 and it times your win.

Highlights

  • 4 sequence types

    Arithmetic, quadratic, cubic and prime.

  • 10 levels

    New types unlock at levels 3, 5 and 7.

From the source

SequenceType.java
public enum SequenceType {
    ARITHMETIC("Arithmetic", 1), // an + b
    QUADRATIC("Quadratic", 3), // an^2 + bn + c
    CUBIC("Cubic", 5), // an^3 + bn^2 + cn + d
    PRIME("Prime", 7); // sequence of prime numbers

    final String typeName;

    /**
     * Denotes the level of the user that will trigger the appearance of the sequence
     */
    final int startingLevel;

Ready to build something amazing?

I'd love to connect with you!