Connect.Four.mp4
You can either sign up for an account or click on Guest Login. Logging in as a guest creates an account with a unique Id generated. The Id can be found right after the word “Guest” once you are logged in. You can log in to the same guest account next time using the Id as below :
###### is the unique Id
Email: ######@gmail.com
Password: ######
To try out multi-player mode, go to the link in an Incognito browser and log in with a different account. Using another computer or mobile device to log in with a different account and play against yourself is also an option.
This app was my first project when I started learning to code. I recently refactored the code to fix mistakes I made and improve performance. In single-player mode, you are playing against Peanutbot (AI player). In multiplayer mode, a game starts when two players are connected. The third player connected to multiplayer mode will get an alert that the server is full, but they can play in single-player mode.
- JavaScript
- React
- Socket.io
- Firebase Authentication, Real-time Database and Emulators
- Jest
- Puppeteer
- Bootstrap
I mocked Socket.io and achieved 100% coverage using Jest for the game-related components.
I utilized Puppeteer and Firebase emulators to test authentication-related components. The emulators allow testing without connecting to the actual Firebase server for authentication and retrieving data. I am adding more tests.
It authenticates the user and tracks wins and the number of games you have played.
Played: number of games you played
Won: number of times you won
Round: number of games for the current session
These trackers increment under different game results and scenarios when each player triggers the Replay or Quit button.
Game over:
Played | Won | |
---|---|---|
Win | +1 | +1 |
Lose | +1 | 0 |
Draw | +1 | 0 |
Replay or quit:
Played | Won | Round | |
---|---|---|---|
Before game starts | 0 | 0 | +1 |
During game | +1 / 0 | 0 | +1 |
After game over | see above | see above | +1 / 0 |
The player who triggers replay or quit during a game will have Played incremented while the other player will not.
Triggering replay will increment Round for both players, and quit will not.
Resolved
-
A memory leak occurs at logging in again after logging out. It causes the score to be unable to sync
-
Playing against Peanutbot (AI) in a single-player mode took an average of 2660 to 2670 milliseconds for Peanutbot to execute its move. It has now reduced to an average of 1230 to 1240 milliseconds.
-
Critical runtime in single player mode on a mobile device
-
Authentication components are tested using Puppeteer. Puppeteer uses the build of the application to run the tests. Thus, it does not have source mapping. As a result, the coverage report is not present.
- Multiple sockets - enables more than two persons to play in multiplayer mode
- Chat