# in which it can fill in 81 underscores with digits for a puzzle. # The suffix of the request URL determines which template is used. # # On a command line without any arguments, prints text for a # random sudoku puzzle, with an estimate of its difficulty. # On a command line with a filename, solves the given puzzles # (files should look like the text generated by the generator). # # Adapted for Adafruit_Thermal library by Phil Burgess for # Adafruit Industries. from __future__ import print_function import sys, os, random, getopt, re from atp import * printer = atp(timeout=5) def main(): printer.setLineSpacing(0) # So graphical chars fit together args = sys.argv[1:] if len(args) > 0: puzzles = [loadboard(filename) for filename in args] else: puzzles = [makepuzzle(solution([None] * 81))] for puzzle in puzzles: printer.println("PUZZLE:") printer.feed(1) printer.print(printboard(puzzle)) printer.feed(1) printer.println("RATING:", ratepuzzle(puzzle, 4)) if len(args) > 0:
#!/usr/bin/python from atp import * import Image, sys path = sys.argv[1] pic = Image.open(path) printer = atp() printer.printImage(pic, True) printer.feedClear()