In this project, I built the Battleship game by using ruby. The main goal is to put into practice the main concepts of Object Oriented Programming. Particularly, classes and access to their attributes.
- If you want to play it online, visit this repl link to reach and play my Battleship game online.
1- download this repository
2- unpack it (winrar recommended)
3- copy its address e.g.: c:\users\you\downloads\battleship
4- open your terminal commandline (powershell in my case)
5- write "cd" and put the address of the game folder
6- now, to run the game, type 'ruby ./lib/play_battleship.rb'
7- Have fun!
You probably already know how to play Battleship. If you do not know how to play it, please visit this link. It's a really simple game, right? That's what most people think. But if you really wrap your brain around it, you'll discover that the battleship isn't quite as simple as you think!
How to Play it...
-
When you run the game, first enter a number to create a square grid as your board to play the game on.
-
Then begin to enter positions with coordinates separated with a space like
4 7
-
If you hit a ship, the N will become H, if you cannot hit, the N will become X.
-
Try to hit all the hidden ships before you run out of the allowed attacks.
- Ruby - Ruby
๐ค Safa ERDEN
- Github: @SafaErden
- Twitter: @safaerden
- Linkedin: @safaerden
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a โญ๏ธ if you like this project!
This project is free to use as learning purposes. For any external content (e.g. logo, images, ...), please contact me.