//

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

class Router
{
	public static void main( String args[] ) throws Exception
	{
		Board myBoard = new Board( 15, 20 );
		int xPin1 = 0;
		int yPin1 = 0;
		int xPin2 = 0;
		int yPin2 = 0;
		FileReader pinInFile = new FileReader( args[0] );
		BufferedReader pinInBuffer = new BufferedReader( pinInFile );
		String pinInString;
		String netName;

		myBoard.Read();

		while ( ( pinInString = pinInBuffer.readLine() ) != null )
		{
			netName = pinInString;
			System.out.println( "Net name: " + netName );
			if ( ( pinInString = pinInBuffer.readLine() ) != null )
			{
				xPin1 = Integer.parseInt( pinInString );
				System.out.println( "Pin 1 x-position: " + xPin1 );
			}
			if ( ( pinInString = pinInBuffer.readLine() ) != null )
			{
				yPin1 = Integer.parseInt( pinInString );
				System.out.println( "Pin 1 y-position: " + yPin1 );
			}
			if ( ( pinInString = pinInBuffer.readLine() ) != null )
			{
				xPin2 = Integer.parseInt( pinInString );
				System.out.println( "Pin 2 x-position: " + xPin2 );
			}
			if ( ( pinInString = pinInBuffer.readLine() ) != null )
			{
				yPin2 = Integer.parseInt( pinInString );
				System.out.println( "Pin 2 y-position: " + yPin2 );
			}
			myBoard.Route( xPin1, yPin1, xPin2, yPin2 );
			
		}

		

		myBoard.Write( args[1] );

		pinInFile.close();
	}
}
