board.js
changeset 117 5701802ff232
parent 116 61f7f1f03a8d
child 121 b7b5e4a03e4b
equal deleted inserted replaced
116:61f7f1f03a8d 117:5701802ff232
  1051     if (f2 === 0) {
  1051     if (f2 === 0) {
  1052         to.aa = 0;
  1052         to.aa = 0;
  1053         to.ab = 0;
  1053         to.ab = 0;
  1054         to.ac = 0;
  1054         to.ac = 0;
  1055         to.ad = f3;
  1055         to.ad = f3;
  1056         continue;
  1056     } else if (f1 === 0) {
  1057     }
       
  1058     if (f1 === 0) {
       
  1059         to.aa = 0;
  1057         to.aa = 0;
  1060         to.ab = 0;
  1058         to.ab = 0;
  1061         if (f2 === f3) {
  1059         if (f2 === f3) {
  1062             updated = true;
  1060             updated = true;
  1063             to.ac = 0;
  1061             to.ac = 0;
  1064             to.ad = f3 + 1;
  1062             to.ad = f3 + 1;
  1065         } else {
  1063         } else {
  1066             to.ac = f2;
  1064             to.ac = f2;
  1067             to.ad = f3;
  1065             to.ad = f3;
  1068         }
  1066         }
  1069         continue;
  1067     } else if (f2 === f3) {
  1070     }
       
  1071     if (f2 === f3) {
       
  1072         updated = true;
  1068         updated = true;
  1073         to.aa = 0;
  1069         to.aa = 0;
  1074         to.ad = f3 + 1;
  1070         to.ad = f3 + 1;
  1075         if (f0 === f1) {
  1071         if (f0 === f1) {
  1076             to.ab = 0;
  1072             to.ab = 0;
  1150     if (f2 === 0) {
  1146     if (f2 === 0) {
  1151         to.ba = 0;
  1147         to.ba = 0;
  1152         to.bb = 0;
  1148         to.bb = 0;
  1153         to.bc = 0;
  1149         to.bc = 0;
  1154         to.bd = f3;
  1150         to.bd = f3;
  1155         continue;
  1151     } else if (f1 === 0) {
  1156     }
       
  1157     if (f1 === 0) {
       
  1158         to.ba = 0;
  1152         to.ba = 0;
  1159         to.bb = 0;
  1153         to.bb = 0;
  1160         if (f2 === f3) {
  1154         if (f2 === f3) {
  1161             updated = true;
  1155             updated = true;
  1162             to.bc = 0;
  1156             to.bc = 0;
  1163             to.bd = f3 + 1;
  1157             to.bd = f3 + 1;
  1164         } else {
  1158         } else {
  1165             to.bc = f2;
  1159             to.bc = f2;
  1166             to.bd = f3;
  1160             to.bd = f3;
  1167         }
  1161         }
  1168         continue;
  1162     } else if (f2 === f3) {
  1169     }
       
  1170     if (f2 === f3) {
       
  1171         updated = true;
  1163         updated = true;
  1172         to.ba = 0;
  1164         to.ba = 0;
  1173         to.bd = f3 + 1;
  1165         to.bd = f3 + 1;
  1174         if (f0 === f1) {
  1166         if (f0 === f1) {
  1175             to.bb = 0;
  1167             to.bb = 0;
  1249     if (f2 === 0) {
  1241     if (f2 === 0) {
  1250         to.ca = 0;
  1242         to.ca = 0;
  1251         to.cb = 0;
  1243         to.cb = 0;
  1252         to.cc = 0;
  1244         to.cc = 0;
  1253         to.cd = f3;
  1245         to.cd = f3;
  1254         continue;
  1246     } else if (f1 === 0) {
  1255     }
       
  1256     if (f1 === 0) {
       
  1257         to.ca = 0;
  1247         to.ca = 0;
  1258         to.cb = 0;
  1248         to.cb = 0;
  1259         if (f2 === f3) {
  1249         if (f2 === f3) {
  1260             updated = true;
  1250             updated = true;
  1261             to.cc = 0;
  1251             to.cc = 0;
  1262             to.cd = f3 + 1;
  1252             to.cd = f3 + 1;
  1263         } else {
  1253         } else {
  1264             to.cc = f2;
  1254             to.cc = f2;
  1265             to.cd = f3;
  1255             to.cd = f3;
  1266         }
  1256         }
  1267         continue;
  1257     } else if (f2 === f3) {
  1268     }
       
  1269     if (f2 === f3) {
       
  1270         updated = true;
  1258         updated = true;
  1271         to.ca = 0;
  1259         to.ca = 0;
  1272         to.cd = f3 + 1;
  1260         to.cd = f3 + 1;
  1273         if (f0 === f1) {
  1261         if (f0 === f1) {
  1274             to.cb = 0;
  1262             to.cb = 0;
  1348     if (f2 === 0) {
  1336     if (f2 === 0) {
  1349         to.da = 0;
  1337         to.da = 0;
  1350         to.db = 0;
  1338         to.db = 0;
  1351         to.dc = 0;
  1339         to.dc = 0;
  1352         to.dd = f3;
  1340         to.dd = f3;
  1353         continue;
  1341     } else if (f1 === 0) {
  1354     }
       
  1355     if (f1 === 0) {
       
  1356         to.da = 0;
  1342         to.da = 0;
  1357         to.db = 0;
  1343         to.db = 0;
  1358         if (f2 === f3) {
  1344         if (f2 === f3) {
  1359             updated = true;
  1345             updated = true;
  1360             to.dc = 0;
  1346             to.dc = 0;
  1361             to.dd = f3 + 1;
  1347             to.dd = f3 + 1;
  1362         } else {
  1348         } else {
  1363             to.dc = f2;
  1349             to.dc = f2;
  1364             to.dd = f3;
  1350             to.dd = f3;
  1365         }
  1351         }
  1366         continue;
  1352     } else if (f2 === f3) {
  1367     }
       
  1368     if (f2 === f3) {
       
  1369         updated = true;
  1353         updated = true;
  1370         to.da = 0;
  1354         to.da = 0;
  1371         to.dd = f3 + 1;
  1355         to.dd = f3 + 1;
  1372         if (f0 === f1) {
  1356         if (f0 === f1) {
  1373             to.db = 0;
  1357             to.db = 0;
  1453     if (f2 === 0) {
  1437     if (f2 === 0) {
  1454         to.aa = 0;
  1438         to.aa = 0;
  1455         to.ba = 0;
  1439         to.ba = 0;
  1456         to.ca = 0;
  1440         to.ca = 0;
  1457         to.da = f3;
  1441         to.da = f3;
  1458         continue;
  1442     } else if (f1 === 0) {
  1459     }
       
  1460     if (f1 === 0) {
       
  1461         to.aa = 0;
  1443         to.aa = 0;
  1462         to.ba = 0;
  1444         to.ba = 0;
  1463         if (f2 === f3) {
  1445         if (f2 === f3) {
  1464             to.ca = 0;
  1446             to.ca = 0;
  1465             to.da = f3 + 1;
  1447             to.da = f3 + 1;
  1466             updated = true;
  1448             updated = true;
  1467         } else {
  1449         } else {
  1468             to.ca = f2;
  1450             to.ca = f2;
  1469             to.da = f3;
  1451             to.da = f3;
  1470         }
  1452         }
  1471         continue;
  1453     } else if (f2 === f3) {
  1472     }
       
  1473     if (f2 === f3) {
       
  1474         updated = true;
  1454         updated = true;
  1475         to.aa = 0;
  1455         to.aa = 0;
  1476         to.da = f3 + 1;
  1456         to.da = f3 + 1;
  1477         if (f0 === f1) {
  1457         if (f0 === f1) {
  1478             to.ba = 0;
  1458             to.ba = 0;
  1552     if (f2 === 0) {
  1532     if (f2 === 0) {
  1553         to.ab = 0;
  1533         to.ab = 0;
  1554         to.bb = 0;
  1534         to.bb = 0;
  1555         to.cb = 0;
  1535         to.cb = 0;
  1556         to.db = f3;
  1536         to.db = f3;
  1557         continue;
  1537     } else if (f1 === 0) {
  1558     }
       
  1559     if (f1 === 0) {
       
  1560         to.ab = 0;
  1538         to.ab = 0;
  1561         to.bb = 0;
  1539         to.bb = 0;
  1562         if (f2 === f3) {
  1540         if (f2 === f3) {
  1563             to.cb = 0;
  1541             to.cb = 0;
  1564             to.db = f3 + 1;
  1542             to.db = f3 + 1;
  1565             updated = true;
  1543             updated = true;
  1566         } else {
  1544         } else {
  1567             to.cb = f2;
  1545             to.cb = f2;
  1568             to.db = f3;
  1546             to.db = f3;
  1569         }
  1547         }
  1570         continue;
  1548     } else if (f2 === f3) {
  1571     }
       
  1572     if (f2 === f3) {
       
  1573         updated = true;
  1549         updated = true;
  1574         to.ab = 0;
  1550         to.ab = 0;
  1575         to.db = f3 + 1;
  1551         to.db = f3 + 1;
  1576         if (f0 === f1) {
  1552         if (f0 === f1) {
  1577             to.bb = 0;
  1553             to.bb = 0;
  1651     if (f2 === 0) {
  1627     if (f2 === 0) {
  1652         to.ac = 0;
  1628         to.ac = 0;
  1653         to.bc = 0;
  1629         to.bc = 0;
  1654         to.cc = 0;
  1630         to.cc = 0;
  1655         to.dc = f3;
  1631         to.dc = f3;
  1656         continue;
  1632     } else if (f1 === 0) {
  1657     }
       
  1658     if (f1 === 0) {
       
  1659         to.ac = 0;
  1633         to.ac = 0;
  1660         to.bc = 0;
  1634         to.bc = 0;
  1661         if (f2 === f3) {
  1635         if (f2 === f3) {
  1662             to.cc = 0;
  1636             to.cc = 0;
  1663             to.dc = f3 + 1;
  1637             to.dc = f3 + 1;
  1664             updated = true;
  1638             updated = true;
  1665         } else {
  1639         } else {
  1666             to.cc = f2;
  1640             to.cc = f2;
  1667             to.dc = f3;
  1641             to.dc = f3;
  1668         }
  1642         }
  1669         continue;
  1643     } else if (f2 === f3) {
  1670     }
       
  1671     if (f2 === f3) {
       
  1672         updated = true;
  1644         updated = true;
  1673         to.ac = 0;
  1645         to.ac = 0;
  1674         to.dc = f3 + 1;
  1646         to.dc = f3 + 1;
  1675         if (f0 === f1) {
  1647         if (f0 === f1) {
  1676             to.bc = 0;
  1648             to.bc = 0;
  1750     if (f2 === 0) {
  1722     if (f2 === 0) {
  1751         to.ad = 0;
  1723         to.ad = 0;
  1752         to.bd = 0;
  1724         to.bd = 0;
  1753         to.cd = 0;
  1725         to.cd = 0;
  1754         to.dd = f3;
  1726         to.dd = f3;
  1755         continue;
  1727     } else if (f1 === 0) {
  1756     }
       
  1757     if (f1 === 0) {
       
  1758         to.ad = 0;
  1728         to.ad = 0;
  1759         to.bd = 0;
  1729         to.bd = 0;
  1760         if (f2 === f3) {
  1730         if (f2 === f3) {
  1761             to.cd = 0;
  1731             to.cd = 0;
  1762             to.dd = f3 + 1;
  1732             to.dd = f3 + 1;
  1763             updated = true;
  1733             updated = true;
  1764         } else {
  1734         } else {
  1765             to.cd = f2;
  1735             to.cd = f2;
  1766             to.dd = f3;
  1736             to.dd = f3;
  1767         }
  1737         }
  1768         continue;
  1738     } else if (f2 === f3) {
  1769     }
       
  1770     if (f2 === f3) {
       
  1771         updated = true;
  1739         updated = true;
  1772         to.ad = 0;
  1740         to.ad = 0;
  1773         to.dd = f3 + 1;
  1741         to.dd = f3 + 1;
  1774         if (f0 === f1) {
  1742         if (f0 === f1) {
  1775             to.bd = 0;
  1743             to.bd = 0;
  1855     if (f1 === 0) {          // a 0 0 0
  1823     if (f1 === 0) {          // a 0 0 0
  1856         to.ad = 0;
  1824         to.ad = 0;
  1857         to.ac = 0;
  1825         to.ac = 0;
  1858         to.ab = 0;
  1826         to.ab = 0;
  1859         to.aa = f0;
  1827         to.aa = f0;
  1860         continue;
  1828     } else if (f2 === 0) {
  1861     }
       
  1862     if (f2 === 0) {
       
  1863         to.ad = 0;
  1829         to.ad = 0;
  1864         to.ac = 0;
  1830         to.ac = 0;
  1865         if (f1 === f0) {     // a a 0 0
  1831         if (f1 === f0) {     // a a 0 0
  1866             updated = true;
  1832             updated = true;
  1867             to.ab = 0;
  1833             to.ab = 0;
  1868             to.aa = f0 + 1;
  1834             to.aa = f0 + 1;
  1869         } else {             // a b 0 0
  1835         } else {             // a b 0 0
  1870             to.ab = f1;
  1836             to.ab = f1;
  1871             to.aa = f0;
  1837             to.aa = f0;
  1872         }
  1838         }
  1873         continue;
  1839     } else if (f1 === f0) {
  1874     }
       
  1875     if (f1 === f0) {
       
  1876         updated = true;
  1840         updated = true;
  1877         to.ad = 0;
  1841         to.ad = 0;
  1878         to.aa = f0 + 1;
  1842         to.aa = f0 + 1;
  1879         if (f3 === f2) {     // a a b b
  1843         if (f3 === f2) {     // a a b b
  1880             to.ac = 0;
  1844             to.ac = 0;
  1953     if (f1 === 0) {          // a 0 0 0
  1917     if (f1 === 0) {          // a 0 0 0
  1954         to.bd = 0;
  1918         to.bd = 0;
  1955         to.bc = 0;
  1919         to.bc = 0;
  1956         to.bb = 0;
  1920         to.bb = 0;
  1957         to.ba = f0;
  1921         to.ba = f0;
  1958         continue;
  1922     } else if (f2 === 0) {
  1959     }
       
  1960     if (f2 === 0) {
       
  1961         to.bd = 0;
  1923         to.bd = 0;
  1962         to.bc = 0;
  1924         to.bc = 0;
  1963         if (f1 === f0) {     // a a 0 0
  1925         if (f1 === f0) {     // a a 0 0
  1964             updated = true;
  1926             updated = true;
  1965             to.bb = 0;
  1927             to.bb = 0;
  1966             to.ba = f0 + 1;
  1928             to.ba = f0 + 1;
  1967         } else {             // a b 0 0
  1929         } else {             // a b 0 0
  1968             to.bb = f1;
  1930             to.bb = f1;
  1969             to.ba = f0;
  1931             to.ba = f0;
  1970         }
  1932         }
  1971         continue;
  1933     } else if (f1 === f0) {
  1972     }
       
  1973     if (f1 === f0) {
       
  1974         updated = true;
  1934         updated = true;
  1975         to.bd = 0;
  1935         to.bd = 0;
  1976         to.ba = f0 + 1;
  1936         to.ba = f0 + 1;
  1977         if (f3 === f2) {     // a a b b
  1937         if (f3 === f2) {     // a a b b
  1978             to.bc = 0;
  1938             to.bc = 0;
  2051     if (f1 === 0) {          // a 0 0 0
  2011     if (f1 === 0) {          // a 0 0 0
  2052         to.cd = 0;
  2012         to.cd = 0;
  2053         to.cc = 0;
  2013         to.cc = 0;
  2054         to.cb = 0;
  2014         to.cb = 0;
  2055         to.ca = f0;
  2015         to.ca = f0;
  2056         continue;
  2016     } else if (f2 === 0) {
  2057     }
       
  2058     if (f2 === 0) {
       
  2059         to.cd = 0;
  2017         to.cd = 0;
  2060         to.cc = 0;
  2018         to.cc = 0;
  2061         if (f1 === f0) {     // a a 0 0
  2019         if (f1 === f0) {     // a a 0 0
  2062             updated = true;
  2020             updated = true;
  2063             to.cb = 0;
  2021             to.cb = 0;
  2064             to.ca = f0 + 1;
  2022             to.ca = f0 + 1;
  2065         } else {             // a b 0 0
  2023         } else {             // a b 0 0
  2066             to.cb = f1;
  2024             to.cb = f1;
  2067             to.ca = f0;
  2025             to.ca = f0;
  2068         }
  2026         }
  2069         continue;
  2027     } else if (f1 === f0) {
  2070     }
       
  2071     if (f1 === f0) {
       
  2072         updated = true;
  2028         updated = true;
  2073         to.cd = 0;
  2029         to.cd = 0;
  2074         to.ca = f0 + 1;
  2030         to.ca = f0 + 1;
  2075         if (f3 === f2) {     // a a b b
  2031         if (f3 === f2) {     // a a b b
  2076             to.cc = 0;
  2032             to.cc = 0;
  2149     if (f1 === 0) {          // a 0 0 0
  2105     if (f1 === 0) {          // a 0 0 0
  2150         to.dd = 0;
  2106         to.dd = 0;
  2151         to.dc = 0;
  2107         to.dc = 0;
  2152         to.db = 0;
  2108         to.db = 0;
  2153         to.da = f0;
  2109         to.da = f0;
  2154         continue;
  2110     } else if (f2 === 0) {
  2155     }
       
  2156     if (f2 === 0) {
       
  2157         to.dd = 0;
  2111         to.dd = 0;
  2158         to.dc = 0;
  2112         to.dc = 0;
  2159         if (f1 === f0) {     // a a 0 0
  2113         if (f1 === f0) {     // a a 0 0
  2160             updated = true;
  2114             updated = true;
  2161             to.db = 0;
  2115             to.db = 0;
  2162             to.da = f0 + 1;
  2116             to.da = f0 + 1;
  2163         } else {             // a b 0 0
  2117         } else {             // a b 0 0
  2164             to.db = f1;
  2118             to.db = f1;
  2165             to.da = f0;
  2119             to.da = f0;
  2166         }
  2120         }
  2167         continue;
  2121     } else if (f1 === f0) {
  2168     }
       
  2169     if (f1 === f0) {
       
  2170         updated = true;
  2122         updated = true;
  2171         to.dd = 0;
  2123         to.dd = 0;
  2172         to.da = f0 + 1;
  2124         to.da = f0 + 1;
  2173         if (f3 === f2) {     // a a b b
  2125         if (f3 === f2) {     // a a b b
  2174             to.dc = 0;
  2126             to.dc = 0;