Sobes.tech
Junior — Senior

Development of a simple game "Kill the Mole" in TypeScript

livecode

Task condition

On a square field of size 4 × 4 cells, a mole appears at random intervals in a random cell. The user must click on it with the left mouse button, after which the mole disappears and reappears in another random cell. The game should support starting and stopping via a single button (a toggle button can be used). For visualizing the mole, any convenient symbol can be chosen, such as "@" or any other. To get random coordinates, use the function Math.random(), which returns a number in the range [0, 1).

import React, { useState, useEffect } from "react";
import "./styles.css";

const App: React.FC = () => {
  return (
    <div className="App">
      <h1>⭐️ Crush the mole ⭐️</h1>
    </div>
  );
};

export default App;