<commit_before>
'use strict';

import Immutable, { Map, List } from 'immutable';

import { PLAYER_PASSED } from '../actions/playerstatus';

import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';

import {
  CHALLENGE_START,
  CHALLENGE_NEXT,
  CHALLENGE_SOLVE,
  CODE_CHANGED
} from '../actions/challenge';

import { GAME_CHALLENGE_TYPE_CHANGE } from '../actions/gamesetting';

import { TESTS_FINISHED } from '../actions/test';

import FCCInterviewAlgorithms from '../../../../public/json/challenges-algorithms.json';
import FCCInterviewDataStructures from '../../../../public/json/challenges-data-structures.json';

import Challenges from '../../../../public/json/challenges-combined.json';
import ChallengesArcade from '../../../../public/json/challenges-arcade.json';

const combinedChallenges = Object.keys(Challenges)
  .reduce((arr, key) => arr.concat(Challenges[key].challenges), []);

const challengeTypes = {
  'Data structures': shuffle(FCCInterviewDataStructures.challenges),
  Algorithms: shuffle(FCCInterviewAlgorithms.challenges),
  Mixed: shuffle(combinedChallenges),
  Arcade: shuffle(ChallengesArcade.challenges)
};

const initialState = Map({
  title: '',
  description: List(),
  code: `
    The code will appear here.
    Start to begin!
  `,
  challengeNumber: 0,
  currChallenge: Map(Immutable.fromJS(challengeTypes.Algorithms[0])),
  currChallengeStartedAt: 0,
  nextChallenge: Map(),
  challengeType: 'Algorithms',
  chosenChallenges: challengeTypes.Algorithms,
  passedChallenges: List()
});

function shuffle (array) {
  // Fisher-Yates shuffle
  let i = array.length;
  let r;
  const newArray = array.slice();
<commit_msg>Added appConfig to fetch the default values.<commit_after>
'use strict';

import Immutable, { Map, List } from 'immutable';

import { PLAYER_PASSED } from '../actions/playerstatus';

import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';

import {
  CHALLENGE_START,
  CHALLENGE_NEXT,
  CHALLENGE_SOLVE,
  CODE_CHANGED
} from '../actions/challenge';

import { GAME_CHALLENGE_TYPE_CHANGE } from '../actions/gamesetting';

import { TESTS_FINISHED } from '../actions/test';

import FCCInterviewAlgorithms from '../../../../public/json/challenges-algorithms.json';
import FCCInterviewDataStructures from '../../../../public/json/challenges-data-structures.json';

import Challenges from '../../../../public/json/challenges-combined.json';
import ChallengesArcade from '../../../../public/json/challenges-arcade.json';

import appConfig from '../../../jsons/appconfig.json';

const combinedChallenges = Object.keys(Challenges)
  .reduce((arr, key) => arr.concat(Challenges[key].challenges), []);

const challengeTypes = {
  'Data structures': shuffle(FCCInterviewDataStructures.challenges),
  Algorithms: shuffle(FCCInterviewAlgorithms.challenges),
  Mixed: shuffle(combinedChallenges),
  Arcade: shuffle(ChallengesArcade.challenges)
};

const initialState = Map({
  title: '',
  description: List(),
  code: `
    The code will appear here.
    Start to begin!
  `,
  challengeNumber: 0,
  currChallenge: Map(Immutable.fromJS(challengeTypes.Algorithms[0])),
  currChallengeStartedAt: 0,
  nextChallenge: Map(),
  challengeType: appConfig.options.Challenges.default,
  chosenChallenges: challengeTypes[appConfig.options.Challenges.default],
  passedChallenges: List()
});

function shuffle (array) {
  // Fisher-Yates shuffle
  let i = array.length;
  let r;
  const newArray = array.slice();

{'fraction_non_alphanumeric': 0.14965197215777262, 'fraction_numerical': 0.0017401392111368909, 'mean_word_length': 4.414442700156986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4324719', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1097, 'n_words': 226}