Timeline for Object-Oriented Chess Game in Ruby
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 3, 2019 at 8:12 | answer | added | Kache | timeline score: 2 | |
Dec 30, 2016 at 19:41 | history | edited | Vogel612 |
edited tags
|
|
Apr 29, 2016 at 1:20 | comment | added | scobo |
@QPaysTaxes Ok that's what I thought you meant. There are no gems other than yaml and colored . It's a command line game, which I realize now I didn't mention this in the description.
|
|
Apr 28, 2016 at 20:52 | comment | added | anon |
@scobo The require statement can be used to load gems in addition to standard additions -- things like yaml and colored , as require d by game.rb . Those are just the easiest to spot. You should list the gems required to run this code.
|
|
Apr 28, 2016 at 19:56 | comment | added | scobo | @QPaysTaxes, I took this approach as an OO newbie (and with feedback from a SO post that I am now trying to find) because I thought it made sense at the time. The idea was that the piece is dumb, and only knows what they are capable of and only return that. In other words, the Knight always says "I can move one space this way and two spaces that way or two spaces this way and one space that way," regardless of the state of the board. The Board is the one that says "No Knight, you can't do that move because there's a piece in the way" or what have you. As far as gems, I'm not sure I understand? | |
Apr 27, 2016 at 5:12 | comment | added | anon | Also, please link the gems you require in the question. It makes reviewing simpler :) | |
Apr 27, 2016 at 5:10 | comment | added | anon |
(wrt Piece ) "They should return their available moves regardless of the current state of the board/game" Why?
|
|
Jan 19, 2016 at 7:27 | comment | added | Drenmi |
"Pieces should be as dumb as possible." I think this decision has interfered with your decomposition, and Board , Game , and Player have, as a result, become "utility drawers" for Piece behaviour. Also, there seems to be a glaring lack of a Move object in the current model.
|
|
Jan 18, 2016 at 20:46 | comment | added | Bam | You should make a git for this, so we can download it. | |
Jan 17, 2016 at 18:14 | comment | added | Jonah |
Don't have time for a full answer now, but one thing sticks out right away: the repetition in defining allowed moves one by one, as you have. Instead, create helper methods like horizontal_move? , vertical_move? , diagonal_move? , and so on. They could take args to determing the number of squares, too. This will not only make the code much shorter, but also much more readable. Eg, you can define a queen's move as "anything horizontal, vertical, or diagonal," which is exactly how we naturally think about it.
|
|
Jan 17, 2016 at 2:56 | history | tweeted | twitter.com/StackCodeReview/status/688555352296656896 | ||
Jan 16, 2016 at 20:01 | history | asked | scobo | CC BY-SA 3.0 |