<commit_before>'use strict'
import React from 'react'
import { connect } from 'react-redux'
import { Router, Link, browserHistory } from 'react-router'
import { inputGuess } from '../reducers/guess'
import { isValidGuess, response } from '../../helperfunctions'

/* ------------- COMPONENT --------------- */

class Games extends React.Component {
  constructor(props) {
    super(props)
    this.state ={
      guesses: [{value: '', response: ''}],
      input: '',
      currentIndex: 0
    }
    this.handleChange = this.handleChange.bind(this)
    this.handleSubmit = this.handleSubmit.bind(this)
  }

  handleChange(e) {
    var guesses = this.state.guesses
    guesses[this.state.currentIndex].value = e.target.value
    this.setState({
      input: e.target.value,
      guesses: guesses
    }
    )
  }

  handleSubmit(e) {
    e ? e.preventDefault() : null
    var isValid = isValidGuess(this.state.input)
    if (isValid[0]) {
      var responseMessage =response(this.state.input, this.props.game.secret)
      var guesses = this.state.guesses
      guesses[this.state.currentIndex].response = responseMessage
      if (responseMessage === 'YOU WON!') {
        var numAttempts = this.state.currentIndex + 1
        window.location.reload()
        window.alert(`CONGRATULATIONS!!! YOU FOUND IT IN ${numAttempts} ATTEMPTS`)
      } else {
        guesses.push({
          value: '',
          response: ''
        })
      }
      this.setState({
        guesses: guesses,
        input: '',
        currentIndex: this.state.currentIndex+1
      })
    } else {
      this.setState({ input: '' })
      window.alert(isValid[1])<commit_msg>final as sunday night<commit_after>'use strict'
import React from 'react'
import { connect } from 'react-redux'
import { Router, Link, browserHistory } from 'react-router'
import { inputGuess } from '../reducers/guess'
import { isValidGuess, response } from '../../helperfunctions'

/* ------------- COMPONENT --------------- */

class Games extends React.Component {
  constructor(props) {
    super(props)
    this.state ={
      guesses: [{value: '', response: ''}],
      input: '',
      currentIndex: 0
    }
    this.handleChange = this.handleChange.bind(this)
    this.handleSubmit = this.handleSubmit.bind(this)
  }

  handleChange(e) {
    var guesses = this.state.guesses
    guesses[this.state.currentIndex].value = e.target.value
    this.setState({
      input: e.target.value,
      guesses: guesses
    }
    )
  }

  handleSubmit(e) {
    e ? e.preventDefault() : null
    var isValid = isValidGuess(this.state.input)
    var guesses
    if (isValid[0]) {
      var responseMessage =response(this.state.input, this.props.game.secret)
      guesses = this.state.guesses
      guesses[this.state.currentIndex].response = responseMessage
      if (responseMessage === 'YOU WON!') {
        var numAttempts = this.state.currentIndex + 1
        window.location.reload()
        window.alert(`CONGRATULATIONS!!! YOU FOUND IT IN ${numAttempts} ATTEMPTS`)
      } else {
        guesses.push({
          value: '',
          response: ''
        })
      }
      this.setState({
        guesses: guesses,
        input: '',
        currentIndex: this.state.currentIndex+1
      })
    } else {
      guesses = this.state.guesses
      guesses[this.state.currentIndex].value = ''
      this.setState({ input: '', guesses: guesses })
      window.alert(isValid[1])
{'fraction_non_alphanumeric': 0.14761765565624085, 'fraction_numerical': 0.0029231218941829875, 'mean_word_length': 2.442655935613682, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5796960', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1041, 'n_words': 212}