# Path: misc/io.py
# def write(filename, string):
#   with open(filename, 'w') as f:
#     f.write(string)


from misc.io import write
def write_actions(actions):
  s = '%s\n'%len(actions)
  for action in actions:
    s += '\n' + write_action(action)
  return s

###########################################################################

def write_axiom(axiom):
  s = 'begin_rule\n'
  s += '%s\n'%len(axiom.pre)
  for var, val in axiom.pre:
    s += '%s %s\n'%(var, val)
  var_con = -1 # Indicates no value
  s += ' %s %s %s\n'%(axiom.var, var_con, axiom.val)
  s += 'end_rule'
  return s

def write_axioms(axioms):
  s = '%s\n'%len(axioms)
  for axiom in axioms:
    s += '\n' + write_axiom(axiom)
  return s

###########################################################################


PATH = 'output.sas'

def write_file(problem):

# Path: misc/io.py
# def write(filename, string):
#   with open(filename, 'w') as f:
#     f.write(string)


# Path: sas/retired/downward.py
from misc.io import write

def write_actions(actions):
  s = '%s\n'%len(actions)
  for action in actions:
    s += '\n' + write_action(action)
  return s

###########################################################################

def write_axiom(axiom):
  s = 'begin_rule\n'
  s += '%s\n'%len(axiom.pre)
  for var, val in axiom.pre:
    s += '%s %s\n'%(var, val)
  var_con = -1 # Indicates no value
  s += ' %s %s %s\n'%(axiom.var, var_con, axiom.val)
  s += 'end_rule'
  return s

def write_axioms(axioms):
  s = '%s\n'%len(axioms)
  for axiom in axioms:
    s += '\n' + write_axiom(axiom)
  return s

###########################################################################


PATH = 'output.sas'

def write_file(problem):

  write(PATH, problem)