<commit_before>import Hex from './models/Hex';

class GridGenerator {

  static getGenerator(name) {
    if (GridGenerator.hasOwnProperty(name))
      return GridGenerator[name];

    return null;
  }
<commit_msg>Added spiral and ring to the patterns available<commit_after>import Hex from './models/Hex';
import HexUtils from './HexUtils'

class GridGenerator {

  static getGenerator(name) {
    if (GridGenerator.hasOwnProperty(name))
      return GridGenerator[name];

    return null;
  }

  static ring (center, mapRadius) {
    let hexas = [];
    let hex = HexUtils.add(center, HexUtils.multiply(HexUtils.direction(4), mapRadius));
    for (let i = 0; i < 6; i++) {
      for (let j = 0; j < mapRadius; j++) {
        hexas.push(hex)
        hex = HexUtils.neighbour(hex, i)
      }
    }
    return hexas
  }

  static spiral(center, mapRadius){
    let results = [center]
    for (let k = 1; k <= mapRadius; k++) {
      const temp = this.ring(center, k)
      results = results.concat(temp)
    }
    return results
  }

{'fraction_non_alphanumeric': 0.12415130940834142, 'fraction_numerical': 0.004849660523763337, 'mean_word_length': 2.8943396226415095, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, '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': '1638561', 'n_tokens_mistral': 340, 'n_tokens_neox': 323, 'n_words': 91}