<commit_before>import React, { Component } from 'react';
import './App.css';

import ReactSVG from 'react-svg'

class App extends Component {
  constructor(props){
    super(props)
    this.alphabet = []
    this.word = []
    this.hint = []
    this.guessesLeft = 8


  }

  newGame() {
    newGameView()
    this.alphabet =
      ["A", "B", "C", "D", "E",
      "F", "G", "H", "I", "J",
      "K", "L", "M", "N", "O",
      "P", "Q", "R", "S", "T",
      "U", "V", "W", "X", "Y", "Z"]
    this.word = ["c", "a", "t"]
    this.hint = [ "_", "_", "_"]
    this.guessesLeft = 8
    setBlanks( "___" )
  }

  userGuess( event ) {
    letter = event.target.value
    if(!this.alphabet.includes(letter.toUpperCase)) {
      // You already guessed that! Do nothing (no penalty).
      Console.log("You already guessed that!")
      return
    }
    else {
      this.guessesLeft--
      if (this.word.includes(letter)) {
        for (i = 0; i < this.word.length; i ++) {
          if ( this.hint[i] === "_" && this.word.charAt(i) === letter)
            this.hint[i] === letter.toUpperCase()
        }
      }
      else {
        // add to hangman
      }
      this.alphabet.splice(this.alphabet.indexOf(letter.toUpperCase()), 1)
    }
    
  }

  render() {
    return (
      <div className="App">
        <div className="header">
          <h2>Hangman Game</h2>
        </div>
        <div className="intro">
          <p>To get started, edit <code>src/App.js</code> and save to reload.</p>
          <p>There are some placeholder elements setup that need implementation.</p>
        </div>
        <div className="main">
          <ReactSVG path="hangman.svg"/>
          <div className="game-controls">
            <button onClick={this.newGame}>New Game</button>
            <div className="remaining-alphabet">{this.alphabet}</div>
            <div className="guess-left">{this.guessesLeft}</div>
            <input type="text" onChange={this.userGuess.bind(this)} placeholder="Guess a letter..."/>
            <div className="puzzle-word">_ _ _ _ _ _   _ _ _ _</div>
          </div>
        </div>
      </div>
    );<commit_msg>Fix some errors in newGame()<commit_after>import React, { Component } from 'react';
import './App.css';

import ReactSVG from 'react-svg'

class App extends Component {
  constructor(props){
    super(props)
    this.alphabet = []
    this.word = []
    this.hint = []
    this.guessesLeft = 8
    this.newGame = this.newGame.bind(this)
  }

  newGame() {
    //newGameView()
    this.alphabet = [
      "A", "B", "C", "D", "E",
      "F", "G", "H", "I", "J",
      "K", "L", "M", "N", "O",
      "P", "Q", "R", "S", "T",
      "U", "V", "W", "X", "Y", "Z" ]
    this.word = ["c", "a", "t"]
    this.hint = [ "_", "_", "_"]
    this.guessesLeft = 8
  }

  userGuess( event ) {
    let letter = event.target.value
    if(!this.alphabet.includes(letter.toUpperCase)) {
      // You already guessed that! Do nothing (no penalty).
      console.log("You already guessed that!")
      return
    }
    else {
      this.guessesLeft--
      if (this.word.includes(letter)) {
        for (let i = 0; i < this.word.length; i ++) {
          if ( this.hint[i] === "_" && this.word.charAt(i) === letter)
            this.hint[i] === letter.toUpperCase()
        }
      }
      else {
        // add to hangman
      }
      this.alphabet.splice(this.alphabet.indexOf(letter.toUpperCase()), 1)
    }
    event.target.value = ""
  }

  render() {
    return (
      <div className="App">
        <div className="header">
          <h2>Hangman Game</h2>
        </div>
        <div className="intro">
          <p>To get started, edit <code>src/App.js</code> and save to reload.</p>
          <p>There are some placeholder elements setup that need implementation.</p>
        </div>
        <div className="main">
          <ReactSVG path="hangman.svg"/>
          <div className="game-controls">
            <button onClick={this.newGame}>New Game</button>
            <div className="remaining-alphabet">{this.alphabet}</div>
            <div className="guess-left">{this.guessesLeft}</div>
            <input type="text" onChange={this.userGuess.bind(this)} placeholder="Guess a letter..."/>
            <div className="puzzle-word">_ _ _ _ _ _   _ _ _ _</div>
          </div>
        </div>
      </div>
    );
{'fraction_non_alphanumeric': 0.18418626094974644, 'fraction_numerical': 0.0027662517289073307, 'mean_word_length': 2.0904558404558404, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 59, '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': '851925', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1454, 'n_words': 316}