You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assignments/battleship_objects/README.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,6 @@ After completing this assignment, you should...
16
16
* Understand when and why methods require parameters
17
17
* Understand mappings between simple real-world concepts and their code representation in classes and methods
18
18
* Understand how a Ruby application can span more than one file on disk
19
-
* Understand simple inheritance
20
19
21
20
### Performance Objectives
22
21
@@ -32,22 +31,21 @@ After completing this assignment, you should be able to effectively...
32
31
33
32
### Deliverables
34
33
35
-
***A Drawing.** Draw your classes, their methods, their instance variables, and their relationships out on a piece of paper. At the conclusion of your work, make sure to give the paper to your instructor.
36
-
***A Repository.**Create your own github repository. Call it `battleship_objects`.
37
-
***A README.**Create a `README.md` file. Describe each of your classes individually in the README. Include a description of each method (behavior) you're giving them. You should start this before writing any code, but it's fine (and good) if you modify it as you code later.
34
+
***A Drawing.** Draw your classes, their methods, their instance variables, and their relationships out on a piece of paper. At the conclusion of your work, make sure to give the paper to your instructor. This is meant to be a creative exercise, so it odes not need to adhere to any particular format. Just use paper as one of your development tools.
35
+
***A Repository.**Fork this repository.
36
+
***A README.**Wipe out this README file and create your own. Describe each of your classes individually in the README. Include a description of each method (behavior) you're giving them. You should start this before writing any code, but it's fine (and good) if you modify it as you code later.
38
37
***Ruby Files Containing Classes.** Create one `.rb` file for each of your classes.
39
38
***One Ruby File Instantiating Objects.** After your classes exist, it will be time to bring them all together. You'll create an additional ruby file called "battleship_objects.rb" and write code in that file that instantiates each of your objects (HINT: this means calling `.new` on each class and passing it the appropriate information).
40
39
41
40
After you fulfill each requirement below, `git add` and `git commit`. After your work is complete, make sure to `git push` to get your changes up to github. Feel free to push more than once along the way, of course.
42
41
43
-
Send the link to your repository to your instructor.
42
+
Make a pull request when you're done.
44
43
45
44
### Requirements
46
45
47
46
* Each class should be in a separate file. If the class is called `Ship`, then the file should be named `ship.rb`.
48
47
* Each of your classes should have an initializer. These initializers SHOULD have code in them to set all the instance variables you provided in your diagram.
49
48
* All other methods you write for your classes will NOT need to have code in them. You'll just be writing "stubs" for those.
50
-
* At least one class should inherit from another class.
51
49
* Consider the following behaviors. They will all need to be executed during a game of Battleship. Each of these behaviors will need to be a method, and you have to place them in the appropriate classes. You DO NOT have to write code inside of them. Just give them reasonable names and put them in the right places:
52
50
* Start a new game
53
51
* Place a ship on the game board
@@ -65,4 +63,4 @@ Meet all requirements given above.
65
63
66
64
## Hard Mode
67
65
68
-
Actually implement one method for each of the classes you've written. Then call it in`battleship.rb` in a meaningful way.
66
+
Actually implement one method for each of the classes you've written. Then call your implemented methods in the overarching`battleship.rb` in a meaningful way.
Copy file name to clipboardExpand all lines: projects/battleship/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,12 +34,14 @@ After completing this assignment, you should be able to effectively...
34
34
***Ruby Files.** You'll need a lot of these, and you'll be creating them from scratch. Again, you should have one per class, plus at least one other to be executed from the command line to run the game.
35
35
***A Playable Game.** When I clone your repository, I should be able to run your program and play through an entire game of Battleship. I should be able to win and to lose.
36
36
37
-
Send the link to your repository to your instructor.
37
+
When you are finished, create a pull request.
38
38
39
39
### Requirements
40
40
41
41
The major requirement of this project is for the TEST SUITE TO PASS. You are coding to the tests, and ideally, you're making them pass one at a time. As discussed in class, I would suggest making the first test pass USING THE SIMPLEST MEANS POSSIBLE. Then move on to the second test, the third test and so on. You should commit after each test passes.
42
42
43
+
Just to be clear, your computer player does not have to be smart. It just has to play until the game is finished.
44
+
43
45
Here's the odd thing. READ THIS. If you're ever going to call `gets.chomp` in your code to prompt the user for his/her input, don't. Put the following code at the top of any file that needs to prompt the user:
44
46
45
47
```
@@ -50,11 +52,9 @@ end
50
52
51
53
This goes BEFORE you start defining your class. I know that looks stupid, and I apologize for it, but the test suite will only run if you ALWAYS ask for user input by calling `get_user_input` rather than `gets.chomp`. Sorry again.
52
54
53
-
Just to be clear, your computer player does not have to be smart. It just has to play until the game is finished.
54
-
55
55
## Normal Mode
56
56
57
-
It's finally time. Your task this weekend, whether or not you choose to accept it, is to write a program that plays the game of Battleship. The user will act as Player 1, and the computer will act as Player 2.
57
+
It's finally time. Your task this weekend, whether or not you choose to accept it, is to write a program that plays the game of Battleship. The user can act as Player 1, and the computer can act as Player 2. However, as you work through the assignment, you'll notice that you're also building it so that two humans could play each other.
58
58
59
59
This assignment will bring together two of the assignments from earlier in the week: your written set of computer-friendly instructions from Day 1, and the draft code of your objects from Day 3. You WON'T be using that draft code as a starting point, because it's likely that the classes you designed won't match what the test suite is expecting. You'll be writing code to make a test suite pass, so it is going to dictate a lot of what you put together.
0 commit comments