vault backup: 2024-10-01 14:44:56
This commit is contained in:
@@ -19,10 +19,14 @@ Questions:
|
||||
3. Instead of a `(Row, Column)` comment, is there another way we could label the values?
|
||||
4. Is there a way to calculate the coordinates of the surrounding cells without statically constructing a list of offset pairs?
|
||||
5. You iterate through all cells in the board multiple times. Can you extract that logic to reuse wherever needed instead of copying it?
|
||||
6. Can he explain why using GridSize at the property initialization level doesn't work? He couldn't explain it--he needed a const or static integer for `GridSize` instead of a readonly class field. Opted to initialize the property at the top of the constructor.
|
||||
7. Can he simplify the user input questions (like don't show option for placing a flag if no squares are revealed yet--ie, impossible to know where mine is yet), or does he want to allow a user to place flags without knowing
|
||||
8. How can you communicate to the user better about what's going on (found mine or tried to place flag on revealed square, for example)?
|
||||
9. What if someone enters a row or column that does not exist on the board?
|
||||
Looking for an answer that includes passing a function to a method.
|
||||
His answer: method with flag to identify what to do in function.
|
||||
1. Can he explain why using GridSize at the property initialization level doesn't work? He couldn't explain it--he needed a const or static integer for `GridSize` instead of a readonly class field. Opted to initialize the property at the top of the constructor.
|
||||
His answer: use it in the loops with the proper adjustments
|
||||
2. Can he simplify the user input questions (like don't show option for placing a flag if no squares are revealed yet--ie, impossible to know where mine is yet), or does he want to allow a user to place flags without knowing
|
||||
3. How can you communicate to the user better about what's going on (found mine or tried to place flag on revealed square, for example)?
|
||||
His answer: create another while block, while input is not valid, keep asking, showing message
|
||||
4. What if someone enters a row or column that does not exist on the board?
|
||||
|
||||
Nits:
|
||||
1. Property, field and variable naming not consistent
|
||||
@@ -41,9 +45,15 @@ Notes:
|
||||
3. Did not run the program early to see if there were errors
|
||||
4. Found a bug he wrote in column and row check before executing program by thinking about it logically and visualizing the board.
|
||||
5. Has a bug using `.Length` of a multi-dimensional array! Will be x * y and not x as he's hoping. He figured it out without any prompting from me and used `GridSize` in the check instead.
|
||||
6. He had thoughts about the `Board.BoardGame` field--renmaing it. This is a good sign to me, thinking about clearing naming something that's redundant (against the class name).
|
||||
6. He had thoughts about the `Board.BoardGame` field--renaming it. This is a good sign to me, thinking about clearing naming something that's redundant (against the class name).
|
||||
7. Used a `Queue<T>` to do a breadth-first search of neighboring cells.
|
||||
8. Talked through logic of revealing 0-neighboring-mine-count cells well
|
||||
9. Recognized duplicate logic of calculating neighboring cell coordinates and reused it
|
||||
10. Decided to have property to keep track of number of revealed cells instead of recalculating number each time the user plays.
|
||||
|
||||
His thoughts on things to improve code?
|
||||
- Valid input of users
|
||||
- Fix revealing same cell twice
|
||||
- Logic of checking if user won: should work, but not happy with it. Its highly dependent on logic of revealing cells. So it's fragile. Would prefer to more independent process where user won.
|
||||
- Moving logic to BFS outside of class., thinking about single responsibility principle. Searching the board is task of the board, however.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user