<commit_before>import 'dart:math';

// Obviously wrong if you look at how this counts.

main(List<String> arguments) {
  int minBase = 2;
  int maxBase = 16;
  int minNDigits = 2;
  int maxNDigits = 4;

  for (int base = minBase; base <= maxBase; base++) {
    for (int nDigits = minNDigits; nDigits <= maxNDigits; nDigits++) {
      int minValue = 1;
      //int maxValue = ((pow(base, nDigits)) / 2.0).ceil();
      int maxValue = pow(base, nDigits) - 1;
      for (int value = minValue; value <= maxValue; value++) {
        TedNumber tedNumber = new TedNumber(base, nDigits, value);
        print("Base $base, digits $nDigits: ${tedNumber.toForward()}:${tedNumber.toReversed()}");
      }
    }
  }
  print("Done");
}

// This class holds the number to be used to compare against its (in base) reversed form,
// and methods to reverse and print them.  When printed, they need to be in the
// specified base.
//
// To compare the two numbers, the forward version has to be able to be reversed,
// and the two numbers have to be integers in order to do the division.  The numbers,
// forward and reversed, need to be the specified number of digits, so neither
// of them can start with a 0 digit, which means the series of digits for the
// forward version cannot start or end with a zero.
//
// So, you have to be able to convert an integer to a series or list of digits
// for checking length and for checking for 0 digits.
//
// You also need to print both the forward and reversed numbers, and they need
// to be strings, or easily converted to strings.
//
// I think that digits are most easily stored as an array of integers, as in
// List<int>, or as List<String> where each element is a single digit, like "f"
// in base 16.  Strings themselves are immutable, so you cannot do something like
// forwardString[2] = "1";  You'd have to do multi-step operations where a new
// String would be created.
//
// Therefore a forward and reversed digits will be of type List<String>.  That
// way I can reverse them easily.  Creating a single string can be done with
// a StringBuffer.  So, forward[2] would be "1", or "a".
//
// The number has to be easily incremented, or set, or maybe decremented.
// So, operators "++", "--", and "=", and "==" overloaded would be good.
//
class TedNumber {
  int base;
  int nDigits;
  int value;
  //List<String> digits; // do we want to store this and update it every time the number changes?

  TedNumber(int base, int nDigits, int value) {
    this.base = base;
    this.nDigits = nDigits;
    this.value = value;
    //this.digits = new List<String>.filled(this.nDigits, '0'); // want this?
  }

  // What do we want here, say nDigits is 4, and value is 3?  "0011"? "0011:1100" ?
  // Hey this is for printing the class, not value
  String toString() {
    return toForward();
  }

  // We're storing the digits in a array/list of String values, and I prefer to think
  // of the list as going from left to right starting with position 0.  That is, if
  // the number is 3, in base 2 and there are supposed to be 3 digits, then
  // digits[0] is 0, digits[1] is 1, digits[2] is 1. I'm not sure how this is getting stored.
  // check later.

  List<String> reverse(List<String> digits) {
    return digits.reversed;
  }

  List<String> toDigits() {
    String digitsStringValue = value.toRadixString(base);
    List<String> digits = new List<String>.filled(nDigits, '0');
    if (digitsStringValue.length > nDigits) { // the number in the base is greater than the limit, so return "000" or whatever
      return digits; // not sure this is best
    }
    //List<String> digits = new List<String>.filled(nDigits, '0');
    // What we want to do is take a digits of ["0", "1", "1"] (for 3)
    //for (int ctr = digitsStringValue.length - 1; ctr >= 0; ctr--) {
    int nCharsValueInBase = digitsStringValue.length;
    for (int ctr = 0; ctr < nCharsValueInBase; ctr++) {
      //for (int ctr = 0; ctr < digitsStringValue.length; ctr++) {
      digits[nDigits - nCharsValueInBase + ctr] = digitsStringValue[ctr]; // this looks backwards, as in 3 = [1, 1, 0]
    }
    return digits;
  }

  String digitsToString(List<String> digits) {
    //Probably a better way to do this
    StringBuffer resultString = new StringBuffer();
    for (int ctr = 0; ctr < this.nDigits; ctr++) {
    //for (int ctr = this.nDigits - 1; ctr >= 0; ctr--) {
      String digit = digits.elementAt(ctr);
      resultString.write(digit); // this writes left to right
    }
    return resultString.toString();
  }

  String toForward() {
    List<String> digits = toDigits();
    return digitsToString(digits);

//    return digits.toString();
  }

  String toReversed() {
    List<String> digits = new List<String>.from(toDigits().reversed);
    return digitsToString(digits);
  }
}<commit_msg>Starting to add more functions toward testing.<commit_after>import 'dart:math';

// Obviously wrong if you look at how this counts.

main(List<String> arguments) {
  int minBase = 10;
  int maxBase = 10;
  int minNDigits = 2;
  int maxNDigits = 2;

  for (int base = minBase; base <= maxBase; base++) {
    for (int nDigits = minNDigits; nDigits <= maxNDigits; nDigits++) {
      int minValue = 1;
      //int maxValue = ((pow(base, nDigits)) / 2.0).ceil();
      int maxValue = pow(base, nDigits) - 1;
      TedNumber tedNumber = new TedNumber(base, nDigits, minValue);
      for (int value = minValue; value <= maxValue; value++) {
        // TedNumber tedNumber = new TedNumber(base, nDigits, value);
        print("Base $base, digits $nDigits: ${tedNumber.toForward()}:${tedNumber.toReversed()}");
        tedNumber.increment();
      }
    }
  }
  print("Done");
}

// This class holds the number to be used to compare against its (in base) reversed form,
// and methods to reverse and print them.  When printed, they need to be in the
// specified base.
//
// To compare the two numbers, the forward version has to be able to be reversed,
// and the two numbers have to be integers in order to do the division.  The numbers,
// forward and reversed, need to be the specified number of digits, so neither
// of them can start with a 0 digit, which means the series of digits for the
// forward version cannot start or end with a zero.
//
// So, you have to be able to convert an integer to a series or list of digits
// for checking length and for checking for 0 digits.
//
// You also need to print both the forward and reversed numbers, and they need
// to be strings, or easily converted to strings.
//
// I think that digits are most easily stored as an array of integers, as in
// List<int>, or as List<String> where each element is a single digit, like "f"
// in base 16.  Strings themselves are immutable, so you cannot do something like
// forwardString[2] = "1";  You'd have to do multi-step operations where a new
// String would be created.
//
// Therefore a forward and reversed digits will be of type List<String>.  That
// way I can reverse them easily.  Creating a single string can be done with
// a StringBuffer.  So, forward[2] would be "1", or "a".
//
// The number has to be easily incremented, or set, or maybe decremented.
// So, operators "++", "--", and "=", and "==" overloaded would be good.
//
class TedNumber {
  int base;
  int nDigits;
  int value;
  //List<String> digits; // do we want to store this and update it every time the number changes?

  TedNumber(int base, int nDigits, int value) {
    this.base = base;
    this.nDigits = nDigits;
    this.value = value;
    //this.digits = new List<String>.filled(this.nDigits, '0'); // want this?
  }

  // What do we want here, say nDigits is 4, and value is 3?  "0011"? "0011:1100" ?
  // Hey this is for printing the class, not value
  String toString() {
    return toForward();
  }

//  operator +(int more) {
//    value += more;
//  }

  increment() {
    value++;
  }
  // We're storing the digits in a array/list of String values, and I prefer to think
  // of the list as going from left to right starting with position 0.  That is, if
  // the number is 3, in base 2 and there are supposed to be 3 digits, then
  // digits[0] is 0, digits[1] is 1, digits[2] is 1. I'm not sure how this is getting stored.
  // check later.

  List<String> reverse(List<String> digits) {
    return digits.reversed;
  }

  List<String> toDigits() { // change to valueToDigits()
    String digitsStringValue = value.toRadixString(base);
    List<String> digits = new List<String>.filled(nDigits, '0');
    if (digitsStringValue.length > nDigits) { // the number in the base is greater than the limit, so return "000" or whatever
      return digits; // not sure this is best
    }
    //List<String> digits = new List<String>.filled(nDigits, '0');
    // What we want to do is take a digits of ["0", "1", "1"] (for 3)
    //for (int ctr = digitsStringValue.length - 1; ctr >= 0; ctr--) {
    int nCharsValueInBase = digitsStringValue.length;
    for (int ctr = 0; ctr < nCharsValueInBase; ctr++) {
      //for (int ctr = 0; ctr < digitsStringValue.length; ctr++) {
      digits[nDigits - nCharsValueInBase + ctr] = digitsStringValue[ctr]; // this looks backwards, as in 3 = [1, 1, 0]
    }
    return digits;
  }

  String digitsToString(List<String> digits) { // converts digits to a string of all nDigits, so can be leading 0's
    //Probably a better way to do this
    StringBuffer resultString = new StringBuffer();
    for (int ctr = 0; ctr < this.nDigits; ctr++) {
    //for (int ctr = this.nDigits - 1; ctr >= 0; ctr--) {
      String digit = digits.elementAt(ctr);
      resultString.write(digit); // this writes left to right
    }
    String something = resultString.toString();
    return something;
  }

  String toForward() {
    List<String> digits = toDigits();
    String something = digitsToString(digits);
    return something; // this is a string representation of digits, forced to be nDigits in size, and can have leading 0's.

//    return digits.toString();
  }

  String toReversed() {
    List<String> digits = new List<String>.from(toDigits().reversed);
    String something = digitsToString(digits);
    return something;
  }
}
{'fraction_non_alphanumeric': 0.11676528599605522, 'fraction_numerical': 0.01252465483234714, 'mean_word_length': 3.003553099091986, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 43, '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': '6364519', 'n_tokens_mistral': 3301, 'n_tokens_neox': 3087, 'n_words': 1317}