Member-only story

Breaking down wordle in vanilla JS 🟩🟨⬛

Gaurav Behere
4 min readFeb 11, 2022

--

Let us build our own wordle

Source Code: https://github.com/gauravbehere/wordle

Demo: https://gauravbehere.github.io/wordle/

Features we are building

  • Unique puzzle every day.
  • Players can choose to play a random puzzle.
  • Users can share the score. (For now, we are copying text to the clipboard,
    ideally, we should prompt the share feature if the browser supports it).

Building Blocks

  • Wordlist (used for puzzle answers).
  • Set of valid words (to check if the entered word is a valid word).
  • UI Component — Board 6*5, to enter the words.
  • UI Component — Keypad.
  • UI placeholders — floating messages, popup to show answer or prompt for a random mode.

Implementation

Building keypad & the game board on start.

  • Clean up the HTML for the keypad & the board. Setup a new board & the keypad.
  • Set game trackers like user’s state (current column, current row), words entered so far, scorecard, etc to initial state.
  • Check if it is a normal mode (day’s puzzle) or…

--

--

Gaurav Behere
Gaurav Behere

Written by Gaurav Behere

Full-stack engineer, drummer, running on JS, Python & Music. “Frameworks & Libraries come & go, JS stays ❤” https://www.linkedin.com/in/gauravbehere/

Responses (2)