<commit_before>import * as ActionCreators from './state/ActionCreators';
import Store from './state/Store';
import * as Words from './Words';

export async function createNewGameAsync(dispatch) {
  let word = await Words.randomWordAsync();
  return dispatch(ActionCreators.newGame(word));
}

export function wordContainsLetter(word, letter) {
  return word.includes(letter);
}

export function allLettersGuessed(word, guessedLetterSet) {
  // console.log("allLettersGuessed('" + word + "', " + JSON.stringify(guessedLetterSet) + ")");
  for (let i = 0; i < word.length; i++) {
    let c = word.substr(i, 1);
    if (!/[A-Z]/.test(c)) {
      continue;
    }
    // console.log("Checking for letter: '" + c + "'");
    if (!guessedLetterSet[c]) {
      // console.log("Missing letter: '" + c + "'");
      return false;
    }
  }
  return true;
}<commit_msg>Fixing regex to check for win to include numbers<commit_after>import * as ActionCreators from './state/ActionCreators';
import Store from './state/Store';
import * as Words from './Words';

export async function createNewGameAsync(dispatch) {
  let word = await Words.randomWordAsync();
  return dispatch(ActionCreators.newGame(word));
}

export function wordContainsLetter(word, letter) {
  return word.includes(letter);
}

export function allLettersGuessed(word, guessedLetterSet) {
  // console.log("allLettersGuessed('" + word + "', " + JSON.stringify(guessedLetterSet) + ")");
  for (let i = 0; i < word.length; i++) {
    let c = word.substr(i, 1);
    if (!/[A-Z0-9]/.test(c)) {
      continue;
    }
    // console.log("Checking for letter: '" + c + "'");
    if (!guessedLetterSet[c]) {
      // console.log("Missing letter: '" + c + "'");
      return false;
    }
  }
  return true;
}
{'fraction_non_alphanumeric': 0.1660958904109589, 'fraction_numerical': 0.003424657534246575, 'mean_word_length': 3.613157894736842, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6127489', 'n_tokens_mistral': 577, 'n_tokens_neox': 555, 'n_words': 136}