|
12 | 12 | "firewalk", |
13 | 13 | "forestwalk", |
14 | 14 | "morningwalk", |
15 | | - "energywalk" |
| 15 | + "energywalk", |
| 16 | + "circuitwalk" |
16 | 17 | ], |
17 | 18 | { |
18 | 19 | MouseEvent: { |
|
78 | 79 | } |
79 | 80 | } |
80 | 81 | }, |
81 | | - "MouseEvent@morningwalk,energywalk": { |
| 82 | + "MouseEvent@morningwalk,energywalk,circuitwalk": { |
82 | 83 | inputModes: { |
83 | 84 | edit: ["shade", "number", "clear", "info-line"], |
84 | 85 | play: ["line", "peke", "info-line"] |
|
222 | 223 | line: function(val) { |
223 | 224 | this.board.scanResult = null; |
224 | 225 | this.board.roommgr.isStale = true; |
| 226 | + if (this.board.linesupergraph) { |
| 227 | + this.board.linesupergraph.isStale = true; |
| 228 | + } |
225 | 229 | for (var sc = 0; sc <= 1; sc++) { |
226 | 230 | var cell = this.sidecell[sc]; |
227 | 231 | cell.updateFireQans(); |
|
239 | 243 | }, |
240 | 244 | ques: function(val) { |
241 | 245 | this.board.roommgr.isStale = true; |
| 246 | + if (this.board.linesupergraph) { |
| 247 | + this.board.linesupergraph.isStale = true; |
| 248 | + } |
242 | 249 | if (val === 6) { |
243 | 250 | this.setQnum(-1); |
244 | 251 | } |
|
338 | 345 | "Board@firewalk": { |
339 | 346 | hasdots: 1 |
340 | 347 | }, |
| 348 | + "Board@circuitwalk": { |
| 349 | + addExtraInfo: function() { |
| 350 | + this.linesupergraph = this.addInfoList(this.klass.LineSuperGraph); |
| 351 | + } |
| 352 | + }, |
341 | 353 | "BoardExec@firewalk": { |
342 | 354 | adjustBoardData: function(key, d) { |
343 | 355 | if (key & this.TURNFLIP) { |
|
391 | 403 | "Graphic@energywalk": { |
392 | 404 | icecolor: "rgb(255, 255, 163)" |
393 | 405 | }, |
| 406 | + "Graphic@circuitwalk": { |
| 407 | + icecolor: "rgb(118, 165, 175)" |
| 408 | + }, |
394 | 409 | "Graphic@firewalk": { |
395 | 410 | icecolor: "rgb(255, 192, 192)", |
396 | 411 |
|
|
544 | 559 | LineGraph: { |
545 | 560 | enabled: true |
546 | 561 | }, |
547 | | - "LineGraph@icewalk": { |
| 562 | + "LineGraph@icewalk,circuitwalk": { |
548 | 563 | isLineCross: true |
549 | 564 | }, |
| 565 | + "LineSuperGraph:LineGraph@circuitwalk": { |
| 566 | + enabled: true, |
| 567 | + isLineCross: false, |
| 568 | + countprop: "l3cnt", |
| 569 | + getComponentRefs: function(obj) { |
| 570 | + return obj.lgrph; |
| 571 | + }, |
| 572 | + setComponentRefs: function(obj, component) { |
| 573 | + obj.lgrph = component; |
| 574 | + }, |
| 575 | + getObjNodeList: function(nodeobj) { |
| 576 | + return nodeobj.lgrphnodes; |
| 577 | + }, |
| 578 | + resetObjNodeList: function(nodeobj) { |
| 579 | + nodeobj.lgrphnodes = []; |
| 580 | + } |
| 581 | + }, |
550 | 582 | "LineGraph@firewalk": { |
551 | 583 | relation: { "border.line": "link", "cell.qans": "arcs" }, |
552 | 584 | isLineCross: true, |
|
720 | 752 | "checkForestCell@forestwalk", |
721 | 753 | "checkEnergyCell@energywalk", |
722 | 754 | "checkEnergyLoop@energywalk", |
| 755 | + "checkCircuitCell@circuitwalk", |
| 756 | + "checkSelfIntersect@circuitwalk", |
723 | 757 |
|
724 | 758 | "checkOneLoop", |
725 | 759 | "checkDoubleTurnOutside@firewalk", |
|
741 | 775 |
|
742 | 776 | checkWalkLength: function(flag, code) { |
743 | 777 | if (this.board.roommgr.isStale) { |
744 | | - // TODO The room manager will break in certain conditions. |
745 | | - // It is rebuilt here as a workaround. |
746 | 778 | this.board.roommgr.isStale = false; |
747 | 779 | this.board.roommgr.rebuild(); |
748 | 780 | } |
|
781 | 813 | }, "lnIsolate"); |
782 | 814 | } |
783 | 815 | }, |
784 | | - "AnsCheck@icewalk,energywalk#1": { |
| 816 | + "AnsCheck@icewalk,energywalk,circuitwalk#1": { |
785 | 817 | checkCrossLine: function() { |
786 | 818 | this.checkAllCell(function(cell) { |
787 | 819 | return cell.lcnt === 4 && !cell.ice(); |
|
880 | 912 | } |
881 | 913 | } |
882 | 914 | }, |
| 915 | + "AnsCheck@circuitwalk": { |
| 916 | + checkCircuitCell: function() { |
| 917 | + this.checkAllCell(function(cell) { |
| 918 | + return cell.lcnt > 1 && cell.ice() && cell.lcnt < 4; |
| 919 | + }, "lnNoBranch"); |
| 920 | + }, |
| 921 | + checkSelfIntersect: function() { |
| 922 | + this.checkAllCell(function(cell) { |
| 923 | + return ( |
| 924 | + cell.lcnt === 4 && |
| 925 | + cell.adjborder.top.path === cell.adjborder.right.path |
| 926 | + ); |
| 927 | + }, "lnCrossSelf"); |
| 928 | + }, |
| 929 | + checkOneLoop: function() { |
| 930 | + var bd = this.board; |
| 931 | + if (bd.linesupergraph.isStale) { |
| 932 | + bd.linesupergraph.isStale = false; |
| 933 | + bd.linesupergraph.rebuild(); |
| 934 | + } |
| 935 | + var paths = bd.linesupergraph.components; |
| 936 | + if (paths.length > 1) { |
| 937 | + this.failcode.add("lnPlLoop"); |
| 938 | + bd.border.setnoerr(); |
| 939 | + paths[0].setedgeerr(1); |
| 940 | + } |
| 941 | + } |
| 942 | + }, |
883 | 943 | "FailCode@energywalk": { |
884 | 944 | lnPlLoop: "lnPlLoop.forestwalk" |
885 | 945 | }, |
|
0 commit comments