top of page

Create Your First Project

Start adding your projects to your portfolio. Click on "Manage Projects" to get started

Square Push NinjaSe - Software Engineering

Project type

Software Engineering

Date

November 2023

Location

Worcester Polytechnic Institute

This project was an individual assignment for my Software Engineering class at Worcester Polytechnic Institute in which we were supposed to develop a solitaire SquarePush puzzle using a React App coded in JavaScript. This N x N square board contains squares that may have a color and Ninja-se is a character that occupies four empty squares in a 2x2 block of squares. The player can move Ninja-se up, down, left, or right and Ninja-se must always remain fully on the board. When Ninja-se moves, neighboring colors in the same direction are pushed into adjacent empty squares in that direction. The goal of SquarePush is to remove all colors from the board. The only way the player removes a color from the board is to form a 2x2 group of squares whose colors are all the same and request to remove that whole group. There are two special cases that still need to be considered. If Ninja-se pushes a color off the edge of the board, going in the upward direction for example, that color should appear on the other side of the board where the color was pushed, so at the bottom row of the board on the same column, wrapping around. Instead, if Ninja-se tries to push a color into a square that is not empty, both colors should be pushed in that direction and it might happen that a color going off the edge of the board is wrapped around the board and appears on the other side; it can happen as well that Ninja-se pushes a color that goes off the edge of the board, that would wrap around on the other side of the board on a square that has already a color; in this scenario the color on the other side of the board should be pushed as well in the direction that Ninja-se moved.
Until the puzzle is solved, SquarePush records the move count – the total number of moves made – and in addition computes the player’s score. Moving Ninja-se increases the move count by one and removing a 2x2 group of colors that are the same increases the move count by one. The player’s score increases based on the number of colors affected by a player’s move. When removing a 2x2 group of colors that are the same, the score increases by FOUR since four colors are affected.
When Ninja-se moves and colors are pushed around, the score increases once for every color pushed. Once the puzzle is solved, no more moves should be allowed. When a player resets a puzzle to its initial state, both the score and the number of moves is reset to 0, and the board is returned to its initial configuration, with colors in their original location and Ninja-se placed in its original location. Once all colors are removed, the puzzle is solved. A valid initial board consists of NxN squares, where N is either 4, 5, or 6. For a 4x4 board, there can be up to three distinct colors, for a 5x5 board there can be up to five distinct colors used, and for a 6x6 board there can be up to eight distinct colors used. An initial configuration could have empty squares without any color.

CONTACT ME

  • GitHub
  • Black LinkedIn Icon

Thanks for submitting!

Robotics Engineer

Phone:

(508) 365-9842

Email:

© 2023 By Filippo Marcantoni. Powered and secured by Wix

bottom of page