From 878323eba8d3c1733b56d68968ec1ca1f483382b Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Tue, 9 Feb 2016 11:59:54 +0000 Subject: [PATCH] lot --- lot.js | 605 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 605 insertions(+) create mode 100755 lot.js diff --git a/lot.js b/lot.js new file mode 100755 index 0000000..2a5f2a9 --- /dev/null +++ b/lot.js @@ -0,0 +1,605 @@ +#!/usr/bin/env node + +var m = [], + prev = [], + mo = [], + star = [], + trip = [], + results = [], + line = []; + +var re = [ +['05-Jan-2016',6,10,31,36,39,6,10], +['01-Jan-2016',4,37,38,39,44,4,7], +['29-Dec-2015',5,20,31,32,36,6,7], +['25-Dec-2015',3,10,25,27,40,3,9], +['22-Dec-2015',18,19,20,40,41,7,10], +['18-Dec-2015',6,22,26,29,48,5,6], +['15-Dec-2015',8,11,23,27,35,4,11], +['11-Dec-2015',3,5,21,40,43,6,11], +['08-Dec-2015',12,17,29,38,48,9,11], +['04-Dec-2015',8,17,18,27,39,1,7], +['01-Dec-2015',2,15,25,35,45,8,10], +['27-Nov-2015',16,29,30,37,50,6,8], +['24-Nov-2015',9,14,16,17,26,10,11], +['20-Nov-2015',4,30,34,46,49,7,8], +['17-Nov-2015',6,7,23,37,38,10,11], +['13-Nov-2015',10,17,18,33,40,2,8], +['10-Nov-2015',6,13,18,39,43,2,8], +['06-Nov-2015',3,17,26,38,40,4,10], +['03-Nov-2015',8,27,39,46,49,2,6], +['30-Oct-2015',8,13,17,21,34,6,7], +['27-Oct-2015',11,12,20,25,36,6,9], +['23-Oct-2015',7,25,30,32,39,2,8], +['20-Oct-2015',17,19,21,30,45,8,10], +['16-Oct-2015',7,28,29,43,48,3,10], +['13-Oct-2015',12,15,26,29,47,3,11], +['09-Oct-2015',01,40,42,43,47,9,11], +['06-Oct-2015',11,20,22,29,32,1,8], +['02-Oct-2015',7,18,21,32,35,2,11], +['29-Sep-2015',11,14,26,29,49,3,9], +['25-Sep-2015',13,14,23,30,37,2,8], +['22-Sep-2015',14,23,26,27,29,7,10], +['18-Sep-2015',7,29,33,34,39,7,8], +['15-Sep-2015',8,15,17,44,49,5,8], +['11-Sep-2015',10,18,19,29,50,1,9], +['08-Sep-2015',14,16,39,40,42,1,4], +['04-Sep-2015',8,9,27,45,50,8,10], +['01-Sep-2015',6,19,21,27,45,1,8], +['28-Aug-2015',11,29,30,31,34,4,7], +['25-Aug-2015',27,31,33,42,50,2,5], +['21-Aug-2015',4,16,18,43,47,6,10], +['18-Aug-2015',7,10,11,12,19,2,9], +['14-Aug-2015',4,7,39,44,45,3,5], +['11-Aug-2015',2,3,8,15,16,4,11], +['07-Aug-2015',1,5,21,39,44,4,11], +['04-Aug-2015',10,15,39,45,50,9,10], +['31-Jun-2015',16,21,34,40,50,6,9], +['28-Jun-2015',23,32,36,43,49,7,8], +['24-Jun-2015',2,9,21,35,46,2,11], +['21-Jun-2015',14,20,27,29,44,7,10], +['17-Jun-2015',1,21,22,43,48,7,9], +['14-Jun-2015',6,18,19,34,36,1,8], +['10-Jun-2015',5,8,15,35,41,4,5], +['07-Jun-2015',6,7,18,33,41,3,10], +['03-Jun-2015',11,12,15,18,44,3,9], +['30-Jun-2015',11,15,28,34,37,1,8], +['26-Jun-2015',3,6,10,19,24,5,7], +["23-Jun-2015",4,16,22,38,49,6,9], +["19-Jun-2015",7,14,20,31,42,3,9], +["16-Jun-2015",10,15,16,36,37,3,9], +["12-Jun-2015",5,8,10,11,37,7,9], +["09-Jun-2015",5,9,17,32,34,6,8], +["05-Jun-2015",2,7,8,45,48,1,9], +["02-Jun-2015",23,7,41,29,37,1,8], +["29-May-2015",4,20,48,45,3,8,6], +["26-May-2015",6,24,7,21,5,6,5], +["22-May-2015",18,44,35,24,45,5,11], +["19-May-2015",35,37,31,26,30,11,8], +["15-May-2015",47,42,44,5,35,9,8], +["12-May-2015",29,30,14,46,40,3,6], +["08-May-2015",14,19,49,7,47,10,3], +["05-May-2015",1,17,10,42,20,9,8], +["01-May-2015",19,26,20,25,3,6,10], +["28-Apr-2015",36,24,28,26,45,10,7], +["24-Apr-2015",31,5,40,29,19,3,10], +["21-Apr-2015",14,42,17,6,45,8,1], +['17-Apr-2015',2,24,30,34,39,8,11], +['14-Apr-2015',24,32,34,35,49,1,2], +['10-Apr-2015',22,23,25,30,43,5,9], +['07-Apr-2015',39,25,50,44,18,8,5], +['03-Apr-2015',39,37,49,29,27,4,2], +['31-Mar-2015',8,28,20,24,49,8,9], +['27-Mar-2015',30,39,32,44,2,10,6], +['24-Mar-2015',40,10,39,24,26,3,10], +['20-Mar-2015',3,14,42,48,37,1,10], +['17-Mar-2015',11,23,44,38,26,8,1], +['13-mar-2015',4,5,18,22,23,1,3], +['10-mar-2015',2,6,23,30,31,2,10], +['06-mar-2015',23,30,47,49,50,2,7], +['03-mar-2015',6,8,11,13,21,7,8], +['27-feb-2015',5,14,17,25,47,9,10], +['24-feb-2015',3,25,28,34,50,1,11], +['20-feb-2015',4,10,14,37,46,4,7], +['17-Feb-2015',2,5,18,30,43,1,10], +['13-Feb-2015',12,24,39,42,44,3,11], +['10-Feb-2015',13,17,20,30,45,9,10], +['06-Feb=2015',10,26,30,39,50,7,8], +['03-Feb-2015',17,31,33,44,50,7,11], +['30-Jan-2015',9,13,15,19,24,3,8], +['27-Jan-2015',10,33,5,31,40,10,8], +['23-Jan-2015',30,45,29,38,6,8,1], +['20-Jan-2015',33,47,15,41,44,10,8], + + ['16-Jan-2015', 34, 32, 29, 30, 46, 6, 3], + ['13-Jan-2015', 34, 31, 21, 8, 17, 10, 9], + ['09-Jan-2015', 6, 32, 45, 21, 24, 1, 11], + ['06-Jan-2015', 20, 38, 30, 14, 49, 4, 3], + ['02-Jan-2015', 24, 25, 49, 28, 22, 3, 6], + ['30-Dec-2014', 6, 18, 39, 50, 44, 11, 8], + ['26-Dec-2014', 26, 45, 27, 49, 17, 2, 3], + ['23-Dec-2014', 49, 25, 9, 19, 8, 10, 2], + ['19-Dec-2014', 39, 44, 23, 29, 31, 5, 8], + ['16-Dec-2014', 13, 7, 3, 25, 12, 5, 8], + ['12-Dec-2014', 28, 2, 15, 31, 37, 4, 6], + ['09-Dec-2014', 31, 1, 3, 42, 46, 11, 4], + ['05-Dec-2014', 5, 8, 48, 47, 37, 3, 2], + ['02-Dec-2014', 15, 25, 3, 49, 44, 9, 1], + ['28-Nov-2014', 10, 23, 6, 41, 15, 10, 4], + ['25-Nov-2014', 32, 7, 36, 3, 25, 1, 6], + ['21-Nov-2014', 28, 32, 7, 37, 4, 5, 10], + ['18-Nov-2014', 3, 2, 36, 38, 17, 11, 4], + ['14-Nov-2014', 36, 32, 38, 48, 17, 8, 5], + ['11-Nov-2014', 46, 14, 36, 2, 21, 11, 7], + ['07-Nov-2014', 32, 13, 38, 46, 25, 10, 1], + ['04-Nov-2014', 1, 13, 6, 26, 17, 3, 5], + ['31-Oct-2014', 10, 41, 13, 20, 33, 9, 3], + ['28-Oct-2014', 45, 17, 40, 10, 15, 1, 2], + ['24-Oct-2014', 42, 20, 3, 30, 9, 6, 1], + ['21-Oct-2014', 40, 33, 27, 20, 21, 3, 10], + ['17-Oct-2014', 49, 13, 48, 1, 40, 8, 10], + ['14-Oct-2014', 15, 23, 32, 4, 5, 7, 3], + ['10-Oct-2014', 29, 42, 47, 45, 6, 9, 10], + ['07-Oct-2014', 38, 30, 21, 9, 28, 8, 1], + ['03-Oct-2014', 13, 23, 50, 48, 4, 10, 5], + ['30-Sep-2014', 33, 13, 15, 3, 42, 5, 7], + ['26-Sep-2014', 46, 35, 47, 13, 27, 1, 2], + ['23-Sep-2014', 13, 35, 14, 29, 12, 1, 7], + ['19-Sep-2014', 6, 34, 8, 38, 48, 9, 3], + ['16-Sep-2014', 4, 30, 35, 50, 29, 4, 2], + ['12-Sep-2014', 31, 9, 33, 26, 13, 7, 11], + ['09-Sep-2014', 15, 35, 19, 8, 24, 10, 8], + ['05-Sep-2014', 18, 50, 23, 46, 1, 9, 3], + ['02-Sep-2014', 39, 45, 25, 31, 5, 8, 1], + ['29-Aug-2014', 32, 38, 26, 9, 2, 3, 6], + ['26-Aug-2014', 36, 48, 45, 10, 22, 11, 4], + ['22-Aug-2014', 29, 17, 49, 35, 4, 1, 2], + ['19-Aug-2014', 11, 34, 47, 4, 7, 7, 8], + ['15-Aug-2014', 4, 21, 30, 5, 23, 10, 8], + ['12-Aug-2014', 22, 19, 7, 16, 33, 5, 2], + ['08-Aug-2014', 29, 21, 35, 46, 43, 1, 9], + ['05-Aug-2014', 5, 21, 42, 7, 19, 11, 5], + ['01-Aug-2014', 50, 44, 46, 48, 24, 10], + ['29-Jul-2014', 40, 23, 35, 10, 43, 9, 3], + ['25-Jul-2014', 10, 24, 9, 12, 43, 5, 9], + ['22-Jul-2014', 1, 43, 50, 45, 24, 5, 8], + ['18-Jul-2014', 1, 41, 43, 11, 29, 3, 11], + ['15-Jul-2014', 18, 27, 15, 34, 20, 1, 3], + ['11-Jul-2014', 38, 35, 5, 49, 22, 7, 4], + ['08-Jul-2014', 24, 18, 22, 8, 27, 11, 4], + ['04,Jul,2014', 4, 18, 39, 43, 47, 2, 6], + ['01,Jul,2014', 18, 22, 25, 27, 39, 5, 10], + ['27,Jun,2014', 31, 33, 34, 39, 45, 2, 10], + ['24,Jun,2014', 1, 7, 20, 21, 48, 4, 7], + ['20,Jun,2014', 5, 15, 25, 38, 49, 1, 2], + ['17,Jun,2014', 11, 13, 37, 40, 48, 8, 9], + ['13,Jun,2014', 16, 18, 22, 28, 46, 9, 11], + ['10,Jun,2014', 12, 18, 21, 32, 33, 1, 11], + ['06,Jun,2014', 7, 25, 34, 40, 49, 9, 11], + ['03,Jun,2014', 2, 15, 32, 39, 44, 5, 10], + ['30,May,2014', 5, 24, 27, 41, 45, 6, 7], + ['27,May,2014', 7, 13, 16, 25, 26, 1, 6], + ['23,May,2014', 3, 8, 31, 34, 47, 9, 11], + ['20,May,2014', 5, 33, 36, 38, 47, 4, 9], + ['16,May,2014', 23, 26, 29, 37, 40, 3, 4], + ['13,May,2014', 4, 13, 30, 34, 47, 2, 6], + ['09,May,2014', 3, 21, 26, 28, 45, 7, 10], + ['06,May,2014', 5, 19, 24, 31, 37, 1, 9], + ['02,May,2014', 4, 30, 31, 38, 42, 2, 11], + ['29-Apr-2014', 18, 23, 26, 35, 44, 3, 11], + ['25-Apr-2014', 13, 21, 24, 44, 49, 1, 9], + ['22-Apr-2014', 13, 15, 20, 24, 46, 1, 8], + ['18-Apr-2014', 21, 24, 31, 39, 47, 3, 7], + ['15-Apr-2014', 3, 14, 26, 47, 50, 7, 11], + ['11-Apr-2014', 8, 12, 19, 30, 33, 4, 11], + ['08-Apr-2014', 11, 18, 29, 42, 49, 4, 11], + ['04-Apr-2014', 6, 10, 28, 45, 50, 10, 11], + ['01-Apr-2014', 16, 18, 26, 38, 44, 8, 10], + ['28-Mar-2014', 3, 4, 19, 28, 43, 3, 7], + ['25-Mar-2014', 7, 20, 26, 28, 50, 2, 8], + ['21-Mar-2014', 7, 30, 37, 39, 42, 5, 7], + ['18-Mar-2014', 8, 27, 34, 36, 39, 5, 10], + ['14-Mar-2014', 6, 24, 25, 27, 30, 5, 9], + ['11-Mar-2014', 1, 4, 23, 33, 44, 7, 8], + ['07-Mar-2014', 5, 10, 38, 40, 41, 1, 8], + ['04-Mar-2014', 3, 5, 22, 27, 44, 1, 6], + ['28-Feb-2014', 12, 32, 38, 43, 44, 2, 7], + ['25-Feb-2014', 21, 25, 28, 35, 42, 4, 6], + ['21-Feb-2014', 13, 17, 28, 30, 32, 5, 7], + ['18-Feb-2014', 23, 26, 36, 37, 49, 6, 7], + ['14-Feb-2014', 19, 39, 4, 2, 6, 2, 7], + ['11-Feb-2014', 47, 25, 8, 17, 41, 1, 2], + ['07-Feb-2014', 17, 19, 47, 3, 46, 9, 10], + ['04-Feb-2014', 37, 1, 33, 21, 38, 8, 4], + ['31-Jan-2014', 10, 15, 31, 8, 16, 8, 9], + ['28-Jan-2014', 18, 23, 48, 20, 42, 2, 9], + ['24-Jan-2014', 19, 41, 35, 34, 5, 1, 5], + ['21-Jan-2014', 4, 42, 35, 48, 12, 5, 8], + ['17-Jan-2014', 26, 19, 33, 42, 32, 10, 4], + ['14-Jan-2014', 25, 18, 20, 26, 37, 11, 10], + ['10-Jan-2014', 1, 27, 2, 11, 29, 10, 1], + ['07-Jan-2014', 2, 45, 20, 27, 33, 6, 10], + ['03-Jan-2014', 3, 44, 27, 38, 31, 3, 8], + ['31-Dec-2013', 29, 45, 24, 20, 13, 7, 3], + ['27-Dec-2013', 1, 22, 6, 13, 28, 10, 5], + ['24-Dec-2013', 5, 31, 43, 50, 19, 6, 2], + ['20-Dec-2013', 13, 22, 17, 43, 12, 10, 3], + ['17-Dec-2013', 41, 6, 8, 37, 27, 7, 10], + ['13-Dec-2013', 24, 22, 23, 1, 31, 6, 11], + ['10-Dec-2013', 49, 50, 24, 6, 35, 7, 1], + ['06-Dec-2013', 18, 31, 36, 2, 1, 7, 10], + ['03-Dec-2013', 32, 6, 29, 15, 13, 2, 9], + ['29-Nov-2013', 2, 7, 10, 23, 43, 4, 7], + ['26-Nov-2013', 19, 23, 27, 42, 44, 3, 5], + ['22-Nov-2013', 13, 25, 26, 40, 50, 8, 9], + ['19-Nov-2013', 14, 15, 19, 36, 45, 1, 10], + ['15-Nov-2013', 3, 13, 15, 29, 42, 1, 4], + ['12-Nov-2013', 14, 29, 37, 40, 48, 2, 11], + ['08-Nov-2013', 20, 28, 35, 42, 43, 8, 10], + ['05-Nov-2013', 6, 12, 13, 35, 38, 2, 3], + ['01-Nov-2013', 7, 19, 29, 30, 33, 3, 8], + ['29-Oct-2013', 9, 10, 30, 32, 37, 2, 6], + ['25-Oct-2013', 2, 3, 10, 31, 38, 6, 10], + ['22-Oct-2013', 29, 33, 39, 41, 44, 9, 11], + ['18-Oct-2013', 5, 25, 36, 46, 47, 2, 6], + ['15-Sep-2013', 18, 27, 39, 43, 47, 4, 7], + ['11-Oct-2013', 6, 12, 17, 23, 43, 5, 9], + ['08-Oct-2013', 23, 24, 26, 33, 42, 3, 5], + ['04-Oct-2013', 6, 20, 24, 35, 50, 5, 10], + ['01-Oct-2013', 19, 23, 25, 44, 48, 8, 9], + ['27-Sep-2013', 11, 15, 38, 41, 43, 2, 6], + ['24-Sep-2013', 10, 20, 26, 28, 43, 9, 11], + ['20-Sep-2013', 5, 11, 35, 38, 45, 2, 3], + ['17-Sep-2013', 13, 17, 21, 42, 44, 9, 11], + ['13-Sep-2013', 4, 6, 14, 27, 33, 5, 10], + ['10-Sep-2013', 7, 11, 14, 28, 30, 2, 10], + ['06-Sep-2013', 11, 23, 25, 32, 37, 4, 7], + ['03-Sep-2013', 5, 9, 16, 18, 42, 7, 9], + ['30-Aug-2013', 2, 17, 25, 36, 45, 5, 9], + ['27-Aug-2013', 7, 30, 38, 40, 43, 2, 6], + ['23-Aug-2013', 1, 6, 26, 30, 37, 5, 8], + ['20-Aug-2013', 5, 11, 42, 49, 50, 8, 11], + ['16-Aug-2013', 20, 24, 27, 37, 39, 5, 10], + ['13-Aug-2013', 5, 17, 20, 47, 50, 1, 4], + ['09-Aug-2013', 4, 7, 9, 23, 24, 8, 9], + ['06-Aug-2013', 17, 47, 16, 49, 31, 3, 11], + ['02-Aug-2013', 42, 36, 48, 37, 21, 7, 4], + ['30-Jul-2013', 3, 14, 4, 11, 43, 1, 6], + ['26-Jul-2013', 23, 38, 29, 12, 49, 4, 3], + ['23-Jul-2013', 19, 14, 44, 16, 15, 4, 5], + ['19-Jul-2013', 24, 35, 13, 26, 16, 5, 2], + ['16-Jul-2013', 50, 34, 47, 19, 23, 4, 6], + ['12-Jul-2013', 26, 42, 33, 18, 32, 3, 2], + ['09-Jul-2013', 18, 16, 38, 49, 31, 10, 4], + ['05-Jul-2013', 28, 4, 33, 12, 15, 1, 10], + ['02-Jul-2013', 14, 13, 11, 28, 30, 4, 5], + ['28-Jun-2013', 15, 1, 47, 28, 35, 7, 1], + ['25-Jun-2013', 4, 13, 35, 27, 5, 2, 1], + ['21-Jun-2013', 30, 11, 36, 45, 10, 1, 2], + ['18-Jun-2013', 24, 33, 17, 41, 44, 11, 1], + ['14-Jun-2013', 41, 25, 48, 10, 47, 6, 10], + ['11-Jun-2013', 7, 9, 25, 5, 41, 5, 1], + ['07-Jun-2013', 14, 26, 45, 50, 7, 2, 7], + ['04-Jun-2013', 34, 33, 40, 31, 37, 6, 1], + ['31-May-2013', 29, 43, 28, 34, 27, 10, 5], + ['28-May-2013', 34, 38, 13, 8, 26, 3, 11], + ['24-May-2013', 22, 17, 40, 7, 27, 2, 3], + ['21-May-2013', 29, 19, 8, 28, 7, 9, 5], + ['17-May-2013', 25, 24, 50, 6, 20, 9, 10], + ['14-May-2013', 24, 7, 8, 36, 27, 11, 5], + ['10-May-2013', 48, 35, 45, 1, 32, 4, 11], + ['07-May-2013', 43, 27, 13, 28, 42, 4, 6], + ['03-May-2013', 5, 49, 34, 3, 40, 2, 3], + ['30-Apr-2013', 13, 50, 40, 43, 36, 9, 5], + ['26-Apr-2013', 40, 38, 16, 24, 11, 2, 5], + ['23-Apr-2013', 50, 4, 1, 7, 10, 4, 11], + ['19-Apr-2013', 1, 46, 8, 42, 48, 4, 7], + ['16-Apr-2013', 33, 50, 22, 1, 11, 4, 6], + ['12-Apr-2013', 28, 45, 15, 5, 10, 3, 9], + ['09-Apr-2013', 15, 44, 48, 38, 35, 10, 5], + ['05-Apr-2013', 32, 1, 17, 39, 11, 7, 2], + ['02-Apr-2013', 17, 12, 41, 29, 25, 1, 4], + ['29-Mar-2013', 44, 30, 46, 43, 13, 9, 5], + ['26-Mar-2013', 44, 30, 26, 42, 4, 6, 11], + ['22-Mar-2013', 27, 32, 12, 34, 49, 9, 8], + ['19-Mar-2013', 44, 32, 19, 37, 35, 9, 1], + ['15-Mar-2013', 24, 14, 39, 4, 21, 10, 3], + ['12-Mar-2013', 50, 4, 10, 2, 22, 5, 8], + ['08-Mar-2013', 20, 42, 23, 28, 3, 8, 11], + ['05-Mar-2013', 33, 31, 19, 8, 39, 7, 2], + ['01-Mar-2013', 1, 11, 36, 29, 42, 4, 5], + ['26-Feb-2013', 12, 13, 17, 3, 30, 6, 2], + ['22-Feb-2013', 15, 37, 36, 16, 28, 2, 11], + ['19-Feb-2013', 28, 30, 44, 12, 15, 9, 8], + ['15-Feb-2013', 2, 4, 42, 28, 22, 4, 9], + ['12-Feb-2013', 28, 25, 5, 11, 16, 7, 9] +]; + +function $(elm) { + return document.getElementById(elm); +} + +function dynamicSort(property) { + var sortOrder = 1; + if (property[0] === "-") { + sortOrder = -1; + property = property.substr(1); + } + return function (a, b) { + var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0; + return result * sortOrder; + } +} + +function buildArray() { + for (var x = 0; x < 51; x++) { + var l = []; + for (var y = 0; y < 51; y++) { + l.push(0); + } + m[x] = l; + } +} + +function buildTable() { + var area = $('area'); + // clean area. + /* while (area.lastChild) { + area.removeChild(area.lastChild); + } + */ + var table = document.createElement('table'); + var row = document.createElement('tr'); + var cell = document.createElement('td'); + var p = document.createTextNode('---') + cell.appendChild(p); + row.appendChild(cell); + for (var x = 1; x < 50; x++) { + var cell = document.createElement('td'); + var p = document.createTextNode(x) + cell.appendChild(p); + row.appendChild(cell); + } + table.appendChild(row); + /** + * + */ + for (var y = 0; y < 51; y++) { + var row = document.createElement('tr'); + var cell = document.createElement('td'); + var p = document.createTextNode('[' + parseInt(y + 1) + ']') + cell.appendChild(p); + row.appendChild(cell); + for (var x = 1; x < 51; x++) { + var cell = document.createElement('td'); + var p = document.createTextNode(m[y][x - 1]) + cell.appendChild(p); + row.appendChild(cell); + } + table.appendChild(row); + } + area.appendChild(table); +} + +function calc() { + var i = 0; + for (i = 0; i < re.length - 1; i++) { + console.log(re[i]); + for (var s = 1; s < 6; s++) { + var cv = re[i][s]; + console.log("row: " + cv); + for (var n = 1; n < 6; n++) { + if (n != s) { + wv = re[i][n]; + console.log(wv); + m[cv - 1][wv - 1]++; + } + } + } + } + buildTable(); +} + +function othercalc() { + var i = 0; + // var p = 1 / ((-1)*re.length); + var p = 1.0 / (re.length); + + for (i = 0; i < re.length - 1; i++) { + // console.log(re[i]); + for (var s = 1; s < 6; s++) { + var cv = re[i][s]; + // console.log("row: " + cv); + for (var n = 1; n < 6; n++) { + if (n != s) { + wv = re[i][n]; + // console.log(wv); + // m[cv-1][wv-1]++; + var flag = false; + for (var t = 0; t < mo.length; t++) { + if (mo[t].a == cv && mo[t].b == wv) { + flag = true; + mo[t].v++; + /* + if (i < (re.length/2)) + mo[t].v = mo[t].v - (p * i) + else + */ + mo[t].v = mo[t].v + (p * i); + //; + //mo[t].v = mo[t].v + 1; + // ; + } + } + if (!flag) { + mo.push({ + a: cv, + b: wv, + v: 1 + }); + } + } + } + } + } + + console.log("******************************************"); + mo.sort(dynamicSort("v")); + + //for (var t = (mo.length - 20); t < mo.length; t++) { + var t = mo.length - 1; + while (line.length < 5) { + if (line.indexOf(mo[t].a) == -1 && line.length < 5) { + line.push(mo[t].a); + } + if (line.indexOf(mo[t].b) == -1 && line.length < 5) { + line.push(mo[t].b); + } + t = t - 1; + } + +// console.log(line); +console.log(line.sort()); + + for (var t = mo.length-1; t > (mo.length - 3); t--) { + // if (mo[t].v >= 3) { + if (mo[t].v > 1) { + console.log(mo[t].a + ', ' + mo[t].b + ", " + mo[t].v) + } + } + // buildTable(); +} + +function tripCalc() { + var blist = [[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]; + var p = 1.0 / (re.length); + var a, b, c, cur; + //var trip = []; + //console.log + for (i = 0; i < re.length - 1; i++) { + + for (var t = 0; t < blist.length; t++) { + cur = blist[t]; + + a = re[i][cur[0] + 1]; + b = re[i][cur[1] + 1]; + c = re[i][cur[2] + 1]; + + + // console.log(a + ", " + b + "," + c); + + + var found = false; + for (y = 0; y < trip.length; y++) { + var nums = trip[y].nums; + + if (!found) { + if ((nums.indexOf(a) != -1) && (nums.indexOf(b) != -1) && (nums.indexOf(c) != -1)) { + /* console.log("nums:" + nums); + console.log("want: " + a + ", " + b + "," + c); + console.log("A:" + nums.indexOf(a)); + console.log("B:" + nums.indexOf(b)); + console.log("C:" + nums.indexOf(c)); +*/ + + trip[y].cnt = trip[y].cnt + (p * i); + // trip[y].cnt = trip[y].cnt + 1; + +// console.log(">>>" + trip[y].cnt); + found = true; + } + } + + } + + if (!found) { + + //trip.push({nums:[a,b,c],cnt:(p * i)}); + trip.push({ + nums: [a, b, c], + cnt: 1 + }); + + } + } + + + + } + + var max = 0; + for (y = 0; y < trip.length; y++) { + if (trip[y].cnt > max) max = trip[y].cnt; + } + console.log("Max: " + max); + for (y = 0; y < trip.length; y++) { + if (trip[y].cnt == max) console.log(trip[y].cnt + ", " + trip[y].nums); + } + + +// console.log(JSON.stringify(trip)); +} + +function starcalc() { + var i = 0; + var p = 1 / re.length; + for (i = 0; i < re.length - 1; i++) { + // console.log(re[i]); + for (var s = 6; s < 8; s++) { + var cv = re[i][s]; + // console.log("row: " + cv); + for (var n = 6; n < 8; n++) { + if (n != s) { + wv = re[i][n]; + // console.log(wv); + // m[cv-1][wv-1]++; + var flag = false; + for (var t = 0; t < mo.length; t++) { + if (mo[t].a == cv && mo[t].b == wv) { + flag = true; + mo[t].v++; + + mo[t].v = mo[t].v + (p * i); + } + } + if (!flag) { + mo.push({ + a: cv, + b: wv, + v: 1 + }); + } + } + } + } + } + + console.log("******************************************"); + mo.sort(dynamicSort("v")); + + var t = mo.length - 1; + + var starOutput=[]; + starOutput.push(mo[t].a); + starOutput.push(mo[t].b); + + + + //console.log('Stars: ' + mo[t].a + ', ' + mo[t].b); + + console.log('Stars: ' + starOutput.sort()[0] + ', ' + starOutput.sort()[1]); + for (var t = mo.length - 6; t < mo.length; t++) { + if (mo[t].v >= 3) { + console.log(mo[t].a + ', ' + mo[t].b + ", " + mo[t].v) + } + } + + // buildTable(); +} +buildArray(); +//buildTable(); +othercalc(); +console.log("---------------------------------------"); +starcalc(); + +tripCalc();