/* Sumbrero 7 Crossings and Vectors data
// Copyright 2006, A.E.Veltstra
// Part of the Sumbrero solver/
// This script defines the crossings and vectors by the name attribute 
// of 'answer' and 'given' inputs of the sumbrero form.
// Embedding page must embed the sumbrero.js javascript before embedding this file.
*/

/* Vectors are lines formed by the text / number inputs (only 'answer's) on the form.
// Each Vector is defined by the name attribute of a 'given' input on the form,
// and holds an array of names of those 'answer' inputs on the form, that form its line.
*/
Vectors['x02'] = new Array('a00','a01');
Vectors['x13'] = new Array('a10','a11','a12');
Vectors['x23'] = new Array('a21','a22');
Vectors['y20'] = new Array('a00','a10');
Vectors['y31'] = new Array('a01','a11','a21');
Vectors['y32'] = new Array('a12','a22');
Vectors['z23'] = new Array('a01','a12');
Vectors['z32'] = new Array('a10','a21');
Vectors['z33'] = new Array('a00','a11','a22');

/* Crossings are the text / number inputs (both 'answer's and 'given's) on the form.
// Each Crossing is defined by the name attribute of an input on the form,
// and holds an array of the names of those Vectors in the Vectors array,
// in which line it participates.
*/
Crossings['a00'] = new Array('x02','y20','z33');
Crossings['a01'] = new Array('x02','y31','z23');
Crossings['a10'] = new Array('x13','y20','z32');
Crossings['a11'] = new Array('x13','y31','z33');
Crossings['a12'] = new Array('x13','y32','z23');
Crossings['a21'] = new Array('x23','y31','z32');
Crossings['a22'] = new Array('x23','y32','z33');
Crossings['x02'] = new Array('x02');
Crossings['x13'] = new Array('x13');
Crossings['x23'] = new Array('x23');
Crossings['y20'] = new Array('y20');
Crossings['y31'] = new Array('y31');
Crossings['y32'] = new Array('y32');
Crossings['z23'] = new Array('z23');
Crossings['z32'] = new Array('z32');
Crossings['z33'] = new Array('z33');

function CheckAll() {
  //Check the entire form in one go (f.i. invoke at form.onsubmit())
  //Overrides the same function in the sumbrero.js script file: 
	//that generic script doesn't know the form data.

  //only 3 crossings need to be checked to check the entire Sumbrero 7 puzzle.
  CheckCrossing('a00');
  CheckCrossing('a12');
  CheckCrossing('a21');
  return false;
}