Sea Battle game by Django
By selecting a cell as a bomb, only that cell is selected
By selecting a cell as a liner, it moves from the left to the right of the selected row until it hits the ship
By selecting a cell as explosion, the 3x3 area of that cell is selected
By selecting a cell as a radar, a 3x3 area of that cell's contents (empty or ships) will be displayed.
first step clone my project
git clone https://github.com/sorooshm78/sea/
and then run docker-compose
docker-compose up --build
"sea battle game" app will start on 0.0.0.0:8000
enjoy it!
I am using python "3.10.6" version
first step clone my project
git clone https://github.com/sorooshm78/sea/
and go to app directory and then install requirements
pip install -r requirements.txt
this will create all the migrations file (database migrations) now, to apply this migrations run the following command
python manage.py makemigrations
python manage.py migrate
Install Redis on Linux
sudo apt-get update
sudo apt-get install redis
and you change redis configurations in core/settings.py to:
# Cache setting
CACHE_TTL = 15 * 60 # 15 minutes
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
}
}
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
},
},
}
Just go into the code directory and type
python manage.py runserver
"sea battle game" app will start on 127.0.0.1:8000 (Local Address).
enjoy it!
- Add single player
- Add two player (real time)
- Add play by bot