Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Commit

Permalink
Rope support
Browse files Browse the repository at this point in the history
  • Loading branch information
Nhatz HK committed Feb 25, 2018
1 parent ffe8321 commit 50337e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions java/src/main/java/ca/hackermen/caroline/PathFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,24 @@ public boolean validMove (Position init, Position finale) {

if (init.x == finale.x) {

if (init.y > finale.y && init.c == 'H') {
return true;
if (init.y > finale.y) {
if (init.c == 'H') {
return true;
} else {
boolean rope = false;
for (int i = init.y; i > 0 && !rope; --i) {
if (mapMatrice[i][init.x].c == '-' && mapMatrice[i + 1
][init.x].c == ' ') {
rope = true;
}
}

if (rope) {
return true;
} else {
return false;
}
}
} else if (init.y < finale.y && finale.c == 'H')
{
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Runner extends BasicRunner {
* Notez: le niveau de départ sera 1 pour tout
* le monde pendant la compétition :v)
*/
public static final int START_LEVEL = 1;
public static final int START_LEVEL = 4;

public PathFinder pathFinder;
public char[][] mapMatrice;
Expand Down

0 comments on commit 50337e7

Please sign in to comment.