<commit_before>#!/usr/bin/env python3
import sys, os
from random import randint
from adt import Node, Problem
from search import general_search

#[T]wo [T]housand [F]ourty [E]ight problem class
class TTFE(Problem):
  def __init__(self, m):
    operators = [
      self.operator_up,
      self.operator_down,
      self.operator_left,
      self.operator_right
    ]
    super().__init__(
      operators,
      GenGrid(),
      self.create_goal_test(m)
    )

  #returns a function that is the correct goal test according to the chosesn M
  def create_goal_test(self, m):
    def goal_test(grid):
      for row in grid:
        for cell in row:
          if cell == m: return True
      return False
    return goal_test

  def operator_up(self, grid):
    pass
  def operator_down(self, grid):
    pass
  def operator_left(self, grid):
    pass
  def operator_right(self, grid):
    pass

#generates a grid and sets two random cells to 2
def GenGrid(rows=4, cols=4):
  grid = [[0]*cols for x in range(rows)]
  grid[randint(0, rows-1)][randint(0, cols-1)] = 2;
  #FIXME may generate same row and col
  grid[randint(0, rows-1)][randint(0, cols-1)] = 2;
  return grid

if __name__ == "__main__":
  p = TTFE(2048)
  pass<commit_msg>Added doc lines to operator functions<commit_after>#!/usr/bin/env python3
import sys, os
from random import randint
from adt import Node, Problem
from search import general_search

#[T]wo [T]housand [F]ourty [E]ight problem class
class TTFE(Problem):
  def __init__(self, m):
    operators = [
      self.operator_up,
      self.operator_down,
      self.operator_left,
      self.operator_right
    ]
    super().__init__(
      operators,
      GenGrid(),
      self.create_goal_test(m)
    )

  #returns a function that is the correct goal test according to the chosesn M
  def create_goal_test(self, m):
    def goal_test(grid):
      for row in grid:
        for cell in row:
          if cell == m: return True
      return False
    return goal_test

  def operator_up(self, grid):
    """Move up"""
    pass
  def operator_down(self, grid):
    """Move down"""
    pass
  def operator_left(self, grid):
    """Move left"""
    pass
  def operator_right(self, grid):
    """Move right"""
    pass

#generates a grid and sets two random cells to 2
def GenGrid(rows=4, cols=4):
  grid = [[0]*cols for x in range(rows)]
  grid[randint(0, rows-1)][randint(0, cols-1)] = 2;
  #FIXME may generate same row and col
  grid[randint(0, rows-1)][randint(0, cols-1)] = 2;
  return grid

if __name__ == "__main__":
  p = TTFE(2048)
  pass
{'fraction_non_alphanumeric': 0.11011323701679032, 'fraction_numerical': 0.01483795392424834, 'mean_word_length': 3.0796178343949046, 'pattern_counts': {'":': 2, '<': 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': '5458503', 'n_tokens_mistral': 894, 'n_tokens_neox': 873, 'n_words': 276}