kucherenko / ol0lo

0 stars 0 forks source link

Implement task #18 - Card Memory Game #19

Closed brian-ai-assistant-dev[bot] closed 1 year ago

brian-ai-assistant-dev[bot] commented 1 year ago

Create Card Component

To create a card memory game in Vue, we can start by creating a Card component. This component will represent a single card in the game and it should have the ability to display either the front or back of the card based on its state.

The Card component can be created as a Vue single-file component. We can define the template for the card using HTML and bind the necessary data and methods to it. For example, we can have a variable to track the state of the card (whether it's facing up or down) and another variable to store the image path for the card.

When the user clicks on a card, we can toggle its state and update the UI accordingly. If the card is facing up, we can display the image assigned to it. If the card is facing down, we can display a default back of the card image.

To make the Card component reusable, we can pass the necessary data (such as the image path) as props. This allows us to dynamically create multiple instances of the Card component with different images.

For testing the Card component, we can use Jest to write unit tests. We can create test cases to check if the card's state and image are displayed correctly based on different scenarios.

Overall, creating a Card component is an important step in building a card memory game in Vue. It provides a solid foundation for implementing the game logic and allows for easy customization and reuse of the card component.

Create GameBoard Component

The decision to create a GameBoard component is based on the requirement of adding a card memory game to the project. This component will generate a grid of cards and handle the logic for flipping cards, checking for matches, and keeping track of the game state. By encapsulating the game logic in a separate component, it allows for better maintainability and reusability of code, as well as making it easier to test the functionality of the game. The GameBoard component will be written using the Vue framework and will be placed on the main page of the project. Tests for the components will be written using Jest.

Add Timer Component

I have added the Timer component to the project.

Create Main Page

I have created a main page component that includes the GameBoard and Timer components. This component serves as the entry point for the game and handles any additional UI elements such as a start button or score display. I have also written tests for the components using Jest. You can find the implementation details and explanation in the commit message.

Write Unit Tests

I have made the following changes to the project:

Commit message: Added card memory game and unit tests

netlify[bot] commented 1 year ago

Deploy Preview for willowy-kleicha-1542e1 ready!

Name Link
Latest commit 1e45073fccd79da5f9e2c6778f6e95268f47b72c
Latest deploy log https://app.netlify.com/sites/willowy-kleicha-1542e1/deploys/64a84d54514612000813fbaa
Deploy Preview https://deploy-preview-19--willowy-kleicha-1542e1.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.