https://github.com/aayushmau5/battleship
Battleship game made using Elixir & Phoenix framework
https://github.com/aayushmau5/battleship
elixir game phoenix
Last synced: over 1 year ago
JSON representation
Battleship game made using Elixir & Phoenix framework
- Host: GitHub
- URL: https://github.com/aayushmau5/battleship
- Owner: aayushmau5
- License: mit
- Created: 2022-08-13T15:35:20.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T20:05:50.000Z (about 2 years ago)
- Last Synced: 2025-03-15T06:16:35.301Z (over 1 year ago)
- Topics: elixir, game, phoenix
- Language: Elixir
- Homepage: https://battleship.aayushsahu.com/
- Size: 108 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Battleship
Battleship game made using Elixir & Phoenix framework ❤️
You can:
- Play against computer
- Play against another player in real-time
- Create private rooms to play against a particular player
## Deployment
Deployed on [fly.io](https://fly.io) 💪
Live at https://aayush-battleship.fly.dev/ 😎
## Setup
Checkout the setup guide for Phoenix: https://hexdocs.pm/phoenix/installation.html
## Internals
### Approach(logical)
- Start with a 10 x 10 matrix(all 0)
- 4 types of ships based on their length(all different)
- When user places a ship of certain length, we set the length in the given matrix at the desired position
- If a ship is hit, we set -1 at that position, if it is a miss, we assign -2 at that position
- Check the matrix for any natural number(> 0), if there is none, user has won the game
## TODO
- Refactor game logic and main game server
- Add internal workings in readme