Visit the site live Battleship.com
*** Notes I allow the user to cheat by viewing the Enemy / compuuter board if they scroll to the bottom of the page ****
git clone https://github.com/nolansingroy/battleship.git
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
Use React Developer (Chrome Inspector Tool)[https://chromewebstore.google.com/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en]
npx prettier --write src/components/GameBoard/GameBoard.tsx
npm test src/components/GameBoard/GameBoard.test.tsx
... src/components/GameBoard/GameBoardFunctions.test.tsx
![Pasted Graphic 3](https://private-user-images.githubusercontent.com/5677688/290917215-0d61982e-d6b9-42fb-a679-35b086bdd6d8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1NDE5MzYsIm5iZiI6MTcxOTU0MTYzNiwicGF0aCI6Ii81Njc3Njg4LzI5MDkxNzIxNS0wZDYxOTgyZS1kNmI5LTQyZmItYTY3OS0zNWIwODZiZGQ2ZDgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjhUMDIyNzE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODE2MzQ3NmMwMGFhZGU1NzBkYzI1NmIyNWJkYjJjYzE3ZThmYmNhN2FmOTRlMTM1ODY1YTU2NDVmNDExMDhkOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.ZjufRekd58EqT_TBEV-TuQLP1lKXsXEpXLfPHYxNu9Q)
npx jest --coverage
Builds the app for production to the build
folder.\
firebase hosting
![image](https://private-user-images.githubusercontent.com/5677688/290920586-45544dab-fa48-487f-9dd9-e92438efecf5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1NDE5MzYsIm5iZiI6MTcxOTU0MTYzNiwicGF0aCI6Ii81Njc3Njg4LzI5MDkyMDU4Ni00NTU0NGRhYi1mYTQ4LTQ4N2YtOWRkOS1lOTI0MzhlZmVjZjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjhUMDIyNzE2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODRkY2UyNGYxOTIwNzFlNGEyNDMyMjg5NTQzMThlZWJiZjYwMzUyZmMzNzI5MDQ5ZWQwZmU0NjRjYmIzNjRhYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.AwNDfEi8Vv1TlPBKXl3BoMJ3m8MbunkGVAnD2I0e1OM)
** TODO: Create a KABAN github and list backlog features converted to Issues **
- Once a target has been identified, a alorithm to target areas around that position
- Track Hits: When the computer scores a 'hit', record the coordinates of that hit. This is important for the computer to remember where it was successful.
- Prioritize Adjacent Slots: After a hit, the computer should prioritize attacking the adjacent slots in subsequent turns. In Battleship, ships are placed in straight lines, so once you hit a part of a ship, adjacent slots are likely to be part of the same ship.
- Determine Attack Pattern: The computer should intelligently choose which adjacent slot to hit next. It could try horizontally (left or right of the hit) or vertically (above or below the hit) adjacent slots.
- Handle Multiple Hits: If the computer hits multiple parts of a ship, it should continue attacking along the line formed by these hits. For instance, if it hits two adjacent slots vertically, it should continue to attack above or below this line.
- Avoid Repeated Attacks: Ensure the computer doesn't attack a slot it has already attacked, whether it was a hit or miss.
- Fallback to Random Attacks: If the computer finishes attacking a ship (or if the adjacent attacks are all misses), it should revert to random attacks until it scores another hit.