battleship's People
battleship's Issues
Create restart_game method
Game returns user back to the Main Menu
Create valid_placement? method
Requires 2 arguments one will be the ship and the second will be an array of coordinates where the ship will be located. Needs to check if the length of the array is the same size as the ships length, make sure the array numbers are consecutive, and finally coordinates cannot be diagonal.
Create hit method
This method will decrease one out of health if called upon. Make sure you check if this functionality is set in place.
This issue needs to be addressed first. #3
Create empty? method
This will return a bool depending if there is a ship located here or not.
Create place ship
Seems to me that this is going to take one argument. Which is a ship class and will save it in the ship method.
Please verify if this issue is completed first. #7
Create Valid Sequence
Should validate a sequence of positions.
Create display_info method
check miss or hit
check if sunk?
Create valid_coordinate? method
This requires one argument. This should tell us if the coordinate that we pass it exist in the board.
Create hunt method
This should grab a random cell from the board and attack it.
Create health method
It seems that the health method is always the same as the length. Only one difference, it seems to be mutable so I believe we need to make sure that whenever we update the health method we do not update the length method.
Create the ship method
Seems to me that this will store a ship that is located at this coordinate. If there is nothing located it will return nil.
Create fire_upon
This method should check first that fired_upon? is not true. If is false change fired_upon? to true and make sure that if there is a ship in this coordinate then call the hit method in the ship.
Create main menu method
User is shown the main menu where they can play or quit
Create render method
Requires an optional argument of a bool. The render class should display many options, ” . ” if the cell has not been fired upon. “M” if the cell has been fired upon and it does not contain a ship (the shot was a miss). “H” if the cell has been fired upon and it contains a ship (the shot was a hit). “X” if the cell has been fired upon and its ship has been sunk. And the optional bool argument will be false normally but if someone passes true, make it were all ships will be visible with "S", this will be useful for showing the user where they placed their ships and for debugging.
Create player attack method
This method should do the following
- record the attack
- display_info
- if won return you won
- if hasnt won call ai_turn
Create adjacent cell method
This method will check once the A.I have gotten a hit on a ship, to see if the cells adjacent have a ship.
Create place method
Requires 2 arguments the first is the ships name and an array of coordinates. This will place the ship where they are being specified.
Create logical_strikes method
This method will make the A.I not make a bad move when it comes to finishing off a ship for example if the A.I has hit (A1 and A2) this would make the A.I hit (A3) and not another cell like (B2).
Requires issue #38
Create ai_attack method
Computer chooses a random shot. Computer does not fire on the same spot twice
Create ai_ship_locations method
Computer can place ships randomly in valid locations
Create create_ship method
Allow users to create there own ships(except if the board is in its original state then only allow submarine and carrier ships)
Create player_board method
User board is displayed showing hits, misses, sunken ships, and ships
Player ship prompt
Should display welcome message and then call generate ships. After that loop generate ships so it goes into player input. Calls player ship input. Then player turn.
Create cell method
Must create a hash with the board, it will contain all the cells depending on the size of the board.
Create ai_board method
Computer board is displayed showing hits, misses, and sunken ships
Create coordinate class
This will save the coordinate pass in the initializer. Seems to be that only a reader is necessary.
Create report_shots method
Both computer and player shots are reported as a hit, sink, or miss
Create winner method
Game ends when all the user’s ships are sunk.
Game ends when all the computer’s ships are sunk
Game reports who won
Create Sunk method
This method will programmatically check if the ship has been sunk. Find a way to do this. My guess it has to do with the health method.
This will return a bool, so name the method accordingly.
Create generate_ships method
Going to need 2 argument. quantity => 3, sizes => [2,3,3], creates amount of ships told
Create render method
Requires an optional bool argument. This method should render the board for that we can see the board on display. The bool argument is for when we pass an argument of true it will display all the ships on the board.
Create player_turn method
prompt input and validated immediately
not valid call player_turn again
valid hit
Create fired_upon?
This method checks if this specific coordinate has been hit. Making sure that it does not get hit twice. So make sure to change this bool to true if it has been hit before.
Create player_ship_placement method
actually creating the ship class and saving it in the board
Create update_board method
Board is updated after a turn
Create board_size method
allow user to make the board as big as they want.
Create player_attack method
User can choose a valid coordinate to fire on. Entering invalid coordinate prompts user to enter valid coordinate
User is informed when they have already fired on a coordinate
Create player_ship_location method
User can enter valid sequences to place both ships
Next, the user places their ships. They should receive a short explanation of how to place along with a visual representation of their board (which should be empty.
Entering invalid ship placements prompts user to enter valid placements
If more information is needed look at the project details
Create Reader for name and length
In the Ship class make sure to create the methods name and length to save the in initialized arguments. Please evaluate if also we need a writer if so make sure to create an accessor.
validate_hit?
validates coordinates
player_ship_input
ship is ship class, gets the user input, if valid calls player_ship_placement, if not valid calls player_ship_input(ship).
computer_ship_place
the actual complicated method.
ai has to place ships in a valid location
Create destroy method
Create ai_turn method
record the attack
display_info
if won return you won
if hasn't won call player_turn
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.