<commit_before>var React = require('react');
var ResourceStore = require('../stores/ResourceStore.js');
var ResourceAmountView = require('./ResourceAmountView.react.js');
var ResourceButton = require('./ResourceButton.react.js');
var GasBucketStore = require('../stores/GasBucketStore.js');
var GasBucketActions = require('../actions/GasBucketActions.js');

function getGameState() {
    return {
        resources: ResourceStore.getAll(),
        gasBucket: GasBucketStore.getAll()
    };
}


var Game = React.createClass({
    getInitialState: function() {
        return getGameState();
    },

    componentDidMount: function() {
        ResourceStore.addChangeListener(this._onChange);
        GasBucketStore.addUseListener(this._onChange);
        this.interval = setInterval(this._useCarbon, 1000);
    },

    componentWillUnmount: function() {
        ResourceStore.removeChangeListener(this._onChange);
        GasBucketStore.removeUseListener(this._onChange);
        clearInterval(this.interval);
    },

    render: function () {
        return <div>
            <div id="gas">
                <div>
                    carbon: {this.state.gasBucket.carbon}
                </div>
                <div>
                    oxygen: {this.state.gasBucket.oxygen}
                </div>
            </div>
            <div id="amountContainer">
                {this.state.resources.map(function(result, i) {
                    return <ResourceAmountView id={i} key={i} />
                })}
            </div>
            <div id="buttonContainer">
                {this.state.resources.map(function(result, i) {
                    return <ResourceButton id={i} key={i} />
                })}
            </div>
            <div id="generatorContainer">
                {this.state.resources.map(function(result, i) {
                    return <generatorButton id={i} key={i} />
                })}
            </div>
        </div>;
    },

    _onChange: function() {
        this.setState(getGameState());
    },<commit_msg>bug fix<commit_after>var React = require('react');
var ResourceStore = require('../stores/ResourceStore.js');
var ResourceAmountView = require('./ResourceAmountView.react.js');
var ResourceButton = require('./ResourceButton.react.js');
var GasBucketStore = require('../stores/GasBucketStore.js');
var GasBucketActions = require('../actions/GasBucketActions.js');

function getGameState() {
    return {
        resources: ResourceStore.getAll(),
        gasBucket: GasBucketStore.getAll()
    };
}


var Game = React.createClass({
    getInitialState: function() {
        return getGameState();
    },

    componentDidMount: function() {
        ResourceStore.addChangeListener(this._onChange);
        GasBucketStore.addUseListener(this._onChange);
        this.interval = setInterval(this._useCarbon, 1000);
    },

    componentWillUnmount: function() {
        ResourceStore.removeChangeListener(this._onChange);
        GasBucketStore.removeUseListener(this._onChange);
        clearInterval(this.interval);
    },

    render: function () {
        return <div>
            <div id="gas">
                <div>
                    carbon: {this.state.gasBucket.carbon}
                </div>
                <div>
                    oxygen: {this.state.gasBucket.oxygen}
                </div>
            </div>
            <div id="amountContainer">
                {this.state.resources.map(function(result, i) {
                    return <ResourceAmountView id={i} key={i} />
                })}
            </div>
            <div id="buttonContainer">
                {this.state.resources.map(function(result, i) {
                    return <ResourceButton id={i} key={i} />
                })}
            </div>
        </div>;
    },

    _onChange: function() {
        this.setState(getGameState());
    },
{'fraction_non_alphanumeric': 0.134590545078791, 'fraction_numerical': 0.0020666494445879618, 'mean_word_length': 1.9992254066615027, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 34, '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': '2945081', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1009, 'n_words': 172}