<commit_before>package de.sebhn.algorithm.excersise4;

/**
 * Created by philo on 26.10.2016.
 */
public class PathNodes {

    public static void main(String[] args) {

    }

}<commit_msg>add possible paths logic<commit_after>package de.sebhn.algorithm.excersise4;

import java.math.BigInteger;

/**
 * Prints all path to a certain n
 */
public class PathNodes {

  public static void main(String[] args) {
    int n = 2;
    BigInteger numberOfPaths = b(n, n, 0, "");
    System.out.println(numberOfPaths);
  }

  private static BigInteger b(int x, int y, int t, String s) {
    if (x < 0 || y < 0) {
      return BigInteger.ZERO;
    } else if (x == 0 && y == 0) {
      System.out.println(" " + s + "."); // print path
      return BigInteger.ONE;
    }

    BigInteger r = BigInteger.ZERO;

    if (y < x) {
      r = r.add(b(x - 1, y, 0, "R" + s)); // right
    }
    if (y <= x) {
      r = r.add(b(x, y - 1, 0, "U" + s)); // up
    }
    if (y >= x) {
      r = r.add(b(x - 1, y - 1, 0, "F" + s)); // upRight
    }
    if (y > x + 1 && t != 2) {
      r = r.add(b(x + 1, y - 1, 1, "L" + s)); // upLeft
    }
    if (y >= x && t != 1) {
      r = r.add(b(x - 1, y + 1, 2, "D" + s)); // downRight
    }

    return r;
  }

}
{'fraction_non_alphanumeric': 0.1876523151909017, 'fraction_numerical': 0.025995125913891144, 'mean_word_length': 1.9403341288782816, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '927890', 'n_tokens_mistral': 523, 'n_tokens_neox': 487, 'n_words': 144}