Skip to content

A web-based chess game coded using TypeScript and React.js

Notifications You must be signed in to change notification settings

ChrisDev18/Chess-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess written in TypeScript

A basic chess game written using TypeScript.

Screenshot 2024-01-05 at 00 19 13

A UI written in React

The User Interface is written using functional React components. There are components for:

Each component has respective styling under the file component_name-style.css. Both Components and Stylesheets can be viewed in the components folder.

Note: index.tsx, which connects the React app to the browser DOM, is held in the src folder

Game logic written with TS objects

Originally, the logic was coded using Classes and Objects. These have now been reworked using Interfaces and JavaScript Objects as these work better with React's immutable state system.

Behind the UI is a hierarchy of objects based off interfaces which hold data and control the logic of the chess game. There are Interfaces for:

  • Game - Controls the flow of the game - this is the highest-level interface
  • Player - Acts as a controller for any moves made.
  • Chessboard - Holds the array of chessboard squares
  • Square - Holds information about each square (which piece is on it, has it been selected, etc.).

These can be viewed in the models folder.

As well as the pieces (which all implement Piece):

Pieces can be viewed in the models/pieces folder.

Starting the Development Server

In the project directory, you can run:

npm start

which runs the app in the development mode.
Open http://localhost:3000 to view it in a browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

About

A web-based chess game coded using TypeScript and React.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published