<commit_before>var html = require('choo/html')
var square = require('./square')

function range (limit) {
  var result = []
  var i = 0
  while (i < limit) {
    result.push(i)
    i += 1
  }
  return result
}

module.exports = function (props) {
  var squares = props.game.getStatus().board.squares

  function renderSquare (index) {
    var x = index % 8
    var y = 7 - Math.floor(index / 8)
    return square(squares[8 * y + x])
  }

  return html`
    <div class="board">
      <div class="board__inner">
        ${range(64).map(renderSquare)}
      </div>
    </div>
  `
}<commit_msg>Render board using getBoardSquare util<commit_after>var html = require('choo/html')
var square = require('./square')
var _ = require('../util')

var positions = [8, 7, 6, 5, 4, 3, 2, 1].reduce(function (acc, rank) {
  return acc.concat('abcdefgh'.split('').map(function (file) {
    return { rank: rank, file: file }
  }))
}, [])

module.exports = function (props) {
  function renderSquare (pos) {
    return square(_.getBoardSquare(pos.file, pos.rank, props.game))
  }

  return html`
    <div class="board">
      <div class="board__inner">
        ${positions.map(renderSquare)}
      </div>
    </div>
  `
}
{'fraction_non_alphanumeric': 0.16805324459234608, 'fraction_numerical': 0.013311148086522463, 'mean_word_length': 2.9834437086092715, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, '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': '4967301', 'n_tokens_mistral': 436, 'n_tokens_neox': 413, 'n_words': 104}