Conversation
J0c4
left a comment
There was a problem hiding this comment.
Looks good, please check my comments and let me know your thoughts.
Also, please restore README file that was moved to agustin/ folder (it should stay under langtonant/ folder)
| package org.fundacionjala.at15.katas.langtonant.agustin; | ||
|
|
||
| public class Ant { | ||
| // TODO: Make Ant Class with constructor and methods |
There was a problem hiding this comment.
It is not, I am verifing for old TODO comments in the code. It should be changed in the next commits.
| Grid g; | ||
| boolean isFinished; | ||
|
|
||
| public Ant(int xPos, int yPos, String direction, Grid g) { |
There was a problem hiding this comment.
Try to avoid variable names with one single letter, they are not descriptive enough to understand what kind of value they store
There was a problem hiding this comment.
Ok! refactoring right now. I will take it into consideration in the future.
|
|
||
| // direction | ||
|
|
||
| if (direction.equals("NORTH")) { |
There was a problem hiding this comment.
The logic of this if-else blocks seem to have a group of instructions that are repeated, you should consider to create a method where the things that change are set using variables/parameters
There was a problem hiding this comment.
Yes! I was aware of that. Actually, refactoring this part was one of my TODOs. But it seems that I deleted it for a mistake...
However, refactoring right away! 👍🏼
| public void run() { | ||
| //TODO: while(!isFinished) determine direction, change tile color | ||
|
|
||
| while (xPos >= 0 && yPos >= 0 && xPos < g.getWidth() && yPos < g.getHeight() && !isFinished) { |
There was a problem hiding this comment.
Does this logic take into account a way to specify a number of steps that the ant will take?
There was a problem hiding this comment.
It doesnt! Fixing right now.
| if (isWhite(h,w)) { | ||
| System.out.print("[ ]"); | ||
| } else { | ||
| System.out.print("[x]"); |
There was a problem hiding this comment.
I liked this way of printing the grid 👍🏽
…java & added a step limit in the ant movement
…into agustin/langtonant
J0c4
left a comment
There was a problem hiding this comment.
Very nice updates!
Please check my comment about changes lost, after that I think this PR can be approved
| source = 'src/main/java' | ||
| } | ||
|
|
||
| task runLangtonAntAdrian (dependsOn: 'classes', type: JavaExec) { |
There was a problem hiding this comment.
The tasks for Adrian and Adhemar are being deleted, maybe this happened during conflicts resolution. Please restore those tasks (it can be a new commit) so the code from them is not lost
Same for the java files under their folders that were deleted
There was a problem hiding this comment.
I didn't realize that! Their files were restored as well their tasks.
| + ", " + "Color: " + (grid.isWhite(xPos, yPos) ? "BLACK" : "WHITE")); | ||
| } | ||
|
|
||
| public void moveNorth() { |
|
|
||
| task runLangtonAntAdhemar (dependsOn: 'classes', type: JavaExec) { | ||
| main = 'org.fundacionjala.at15.katas.langtonant.adhemar.Main' | ||
| classpath = sourceSets.main.runtimeClasspath |
There was a problem hiding this comment.
Please also restore this line, it might break Adhemar's task
I like it a lot this kata!
I find very good lectures in the process