A React application that uses a Finite State Machine (FSM) to calculate the remainder when a binary number is divided by 3.
This project requires Node.js version v20.11.1 as specified in .nvmrc and package.json.
If you have nvm installed, you can easily switch to the correct Node.js version by running:
nvm use- Ensure you have the correct Node.js version (v20.11.1)
- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to the local server URL (typically http://localhost:5173/)
npm run dev: Start the development servernpm run build: Build the project for productionnpm run preview: Preview the production build locallynpm test: Run tests with Vitestnpm run coverage: Run tests with coverage reportingnpm run lint: Check code for style issuesnpm run lint:fix: Automatically fix linting issues
- Validate binary number inputs
- Calculate the remainder when divided by 3 using a Finite State Machine
- Display the decimal equivalent of the binary input
- Modern React implementation with hooks
- Responsive design
The application uses a two-layer state machine approach:
TinyStateMachine- A generic FSM implementationModuloThreeFSM- A specific implementation that calculates modulo 3 of binary numbers
The FSM works by tracking the remainder as it processes each digit of the binary number from left to right.
This project uses the modern JSX transform introduced in React 17+. This means:
- No need to import React in files that only use JSX
- The TypeScript configuration uses
"jsx": "react-jsx"to enable this feature - ESLint is configured to support this syntax
The project includes comprehensive test coverage using:
- Vitest for test running and assertions
- React Testing Library for component testing
- Jest DOM for DOM testing utilities
ESLint is configured with:
- TypeScript support via
@typescript-eslint - React specific rules via
eslint-plugin-react - Modern config format using
eslint.config.js
Created by @zeddotes