2015-02-11

posted Feb 11, 2015, 8:47 AM by Samuel Konstantinovich   [ updated Feb 12, 2015, 10:54 AM ]



import java.util.*;
import java.io.*;


public class KnightsTour{
	//constants for the class
	//terminal specific character to clear screen , or hide/show cursor
	final static String clear =  "\033[2J";
	final static String hide =  "\033[?25l";
	final static String show =  "\033[?25h";

	//instance variable
    private int[][]board;


		//terminal specific character to move the cursor
    private String go(int x,int y){
				return ("\033[" + x + ";" + y + "H");
    }
 
    public void wait(int millis){
				try {
						Thread.sleep(millis);
				}
				catch (InterruptedException e) {
				}
    }

    public String toString(){
				String ans = "\n";
				//build your knights tour here...
				return hide + clear + go(0,0) + ans + "\n" + show;
    }

    public KnightsTour(int size){
				
    }

    
    public void solve(){
				
    }

    public void solve(int startx, int starty){
				
    }

public boolean solve(int x,int y,int currentMoveNumber){ System.out.println(this); wait(20); return false; } }
Comments