How to use addCommand method in Cypress

Best JavaScript code snippet using cypress

Run Cypress automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

commands.js

Source: commands.js Github

copy
1/* @Author Ronan
2 * @Author Vcoc
3        Name: Steward
4        Map(s): Foyer
5        Info: Commands
6        Script: commands.js
7*/
8
9var status;
10
11var comm_lv6 = [];
12var desc_lv6 = [];
13
14var comm_lv5 = [];
15var desc_lv5 = [];
16
17var comm_lv4 = [];
18var desc_lv4 = [];
19
20var comm_lv3 = [];
21var desc_lv3 = [];
22
23var comm_lv2 = [];
24var desc_lv2 = [];
25
26var comm_lv1 = [];
27var desc_lv1 = [];
28
29var comm_lv0 = [];
30var desc_lv0 = [];
31
32var levels = ["Common", "Donator", "JrGM", "GM", "SuperGM", "Developer", "Admin"];
33
34var comm_cursor, desc_cursor;
35
36function addCommand(comm, desc) {
37    comm_cursor.push(comm);
38    desc_cursor.push(desc);
39}
40
41function writeSolaxiaCommandsLv6() {    //Admin
42    comm_cursor = comm_lv6;
43    desc_cursor = desc_lv6;
44
45    addCommand("setgmlevel", "");
46    addCommand("warpworld", "");
47    addCommand("saveall", "");
48    addCommand("dcall", "");
49    addCommand("mapplayers", "");
50    addCommand("getacc", "");
51    addCommand("shutdown", "");
52    addCommand("shutdownnow", "");
53    addCommand("clearquestcache", "");
54    addCommand("clearquest", "");
55}
56
57function writeSolaxiaCommandsLv5() {    //Developer
58    comm_cursor = comm_lv5;
59    desc_cursor = desc_lv5;
60
61    addCommand("debugmonster", "");
62    addCommand("debugpacket", "");
63    addCommand("debugportal", "");
64    addCommand("debugspawnpoint", "");
65    addCommand("debugpos", "");
66    addCommand("debugmap", "");
67    addCommand("debugmobsp", "");
68    addCommand("debugevent", "");
69    addCommand("debugareas", "");
70    addCommand("debugreactors", "");
71    addCommand("debugcoupons", "");
72    addCommand("debugplayercoupons", "");
73    addCommand("debugtimer", "");
74}
75
76function writeSolaxiaCommandsLv4() {    //SuperGM
77    comm_cursor = comm_lv4;
78    desc_cursor = desc_lv4;
79
80    addCommand("servermessage", "");
81    addCommand("proitem", "");
82    addCommand("seteqstat", "");
83    addCommand("exprate", "");
84    addCommand("mesorate", "");
85    addCommand("droprate", "");
86    addCommand("bossdroprate", "");
87    addCommand("itemvac", "");
88    addCommand("forcevac", "");
89    addCommand("zakum", "");
90    addCommand("horntail", "");
91    addCommand("pinkbean", "");
92    addCommand("pap", "");
93    addCommand("pianus", "");
94    addCommand("cake", "");
95    //addCommand("playernpc", "");
96}
97
98function writeSolaxiaCommandsLv3() {    //GM
99    comm_cursor = comm_lv3;
100    desc_cursor = desc_lv3;
101
102    addCommand("spawn", "");
103    addCommand("mutemap", "");
104    addCommand("checkdmg", "");
105    addCommand("inmap", "");
106    addCommand("reloadevents", "");
107    addCommand("reloaddrops", "");
108    addCommand("reloadportals", "");
109    addCommand("reloadmap", "");
110    addCommand("hpmp", "");
111    addCommand("music", "");
112    addCommand("monitor", "");
113    addCommand("monitors", "");
114    addCommand("ignore", "");
115    addCommand("ignored", "");
116    addCommand("pos", "");
117    addCommand("togglecoupon", "");
118    addCommand("chat", "");
119    addCommand("fame", "");
120    addCommand("givenx", "");
121    addCommand("givevp", "");
122    addCommand("givems", "");
123    addCommand("id", "");
124    addCommand("expeds", "");
125    addCommand("kill", "");
126    addCommand("seed", "");
127    addCommand("maxenergy", "");
128    addCommand("killall", "");
129    addCommand("notice", "");
130    addCommand("rip", "");
131    addCommand("openportal", "");
132    addCommand("closeportal", "");
133    addCommand("pe", "");
134    addCommand("startevent", "");
135    addCommand("endevent", "");
136    addCommand("online2", "");
137    addCommand("warpsnowball", "");
138    addCommand("ban", "");
139    addCommand("unban", "");
140    addCommand("healmap", "");
141    addCommand("healperson", "");
142    addCommand("hurt", "");
143    addCommand("killmap", "");
144    addCommand("night", "");
145    addCommand("npc", "");
146    addCommand("face", "");
147    addCommand("hair", "");
148}
149
150function writeSolaxiaCommandsLv2() {    //JrGM
151    comm_cursor = comm_lv2;
152    desc_cursor = desc_lv2;
153
154    addCommand("hide", "");
155    addCommand("unhide", "");
156    addCommand("sp", "");
157    addCommand("ap", "");
158    addCommand("empowerme", "");
159    addCommand("buffmap", "");
160    addCommand("buff", "");
161    addCommand("bomb", "");
162    addCommand("dc", "");
163    addCommand("cleardrops", "");
164    addCommand("clearslot", "");
165    addCommand("warp", "");
166    addCommand("warpto", "");
167    addCommand("warphere", "");
168    addCommand("gmshop", "");
169    addCommand("heal", "");
170    addCommand("item", "");
171    addCommand("level", "");
172    addCommand("levelpro", "");
173    addCommand("setstat", "");
174    addCommand("maxstat", "");
175    addCommand("maxskill", "");
176    addCommand("mesos", "");
177    addCommand("search", "");
178    addCommand("jail", "");
179    addCommand("unjail", "");
180    addCommand("job", "");
181    addCommand("unbug", "");
182}
183
184function writeSolaxiaCommandsLv1() {    //Donator
185    comm_cursor = comm_lv1;
186    desc_cursor = desc_lv1;
187
188    addCommand("buffme", "");
189    addCommand("goto", "");
190    addCommand("recharge", "");
191    addCommand("whereami", "");
192}
193
194function writeSolaxiaCommandsLv0() {    //Common
195    comm_cursor = comm_lv0;
196    desc_cursor = desc_lv0;
197
198    addCommand("commands", "");
199    addCommand("time", "");
200    addCommand("staff", "");
201    addCommand("uptime", "");
202    addCommand("gacha", "");
203    addCommand("whatdropsfrom", "");
204    addCommand("whodrops", "");
205    addCommand("dispose", "");
206    addCommand("equiplv", "");
207    addCommand("showrates", "");
208    addCommand("rates", "");
209    addCommand("online", "");
210    addCommand("gm", "");
211    addCommand("bug", "");
212    //addCommand("points", "");
213    addCommand("joinevent", "");
214    addCommand("leaveevent", "");
215    addCommand("bosshp", "");
216    addCommand("ranks", "");
217}
218
219function writeSolaxiaCommands() {
220    writeSolaxiaCommandsLv0();  //Common
221    writeSolaxiaCommandsLv1();  //Donator
222    writeSolaxiaCommandsLv2();  //JrGM
223    writeSolaxiaCommandsLv3();  //GM
224    writeSolaxiaCommandsLv4();  //Developer
225    writeSolaxiaCommandsLv5();  //SuperGM
226    writeSolaxiaCommandsLv6();  //Admin
227}
228
229function start() {
230    status = -1;
231    writeSolaxiaCommands();
232    action(1, 0, 0);
233}
234
235function action(mode, type, selection) {
236    if (mode == -1) {
237        cm.dispose();
238    } else {
239        if (mode == 0 && type > 0) {
240            cm.dispose();
241            return;
242        }
243        if (mode == 1)
244            status++;
245        else
246            status--;
247
248        if (status == 0) {
249            var sendStr = "There are all available commands for you:\r\n\r\n#b";
250            for (var i = 0; i <= cm.getPlayer().gmLevel(); i++) {
251                sendStr += "#L" + i + "#" + levels[i] + "#l\r\n";
252            }
253
254            cm.sendSimple(sendStr);
255        } else if (status == 1) {
256            var lvComm, lvDesc;
257
258            if (selection == 0) {
259                lvComm = comm_lv0;
260                lvDesc = desc_lv0;
261            } else if (selection == 1) {
262                lvComm = comm_lv1;
263                lvDesc = desc_lv1;
264            } else if (selection == 2) {
265                lvComm = comm_lv2;
266                lvDesc = desc_lv2;
267            } else if (selection == 3) {
268                lvComm = comm_lv3;
269                lvDesc = desc_lv3;
270            } else if (selection == 4) {
271                lvComm = comm_lv4;
272                lvDesc = desc_lv4;
273            } else if (selection == 5) {
274                lvComm = comm_lv5;
275                lvDesc = desc_lv5;
276            } else {
277                lvComm = comm_lv6;
278                lvDesc = desc_lv6;
279            }
280
281            var sendStr = "The following commands are available for #b" + levels[selection] + "#k:\r\n\r\n";
282            for (var i = 0; i < lvComm.length; i++) {
283                sendStr += "  #L" + i + "# " + lvComm[i] + " - " + lvDesc[i];
284                sendStr += "#l\r\n";
285            }
286
287            cm.sendPrev(sendStr);
288        } else {
289            cm.dispose();
290        }
291    }
292}
293
Full Screen

default_commands.js

Source: default_commands.js Github

copy
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is Ajax.org Code Editor (ACE).
15 *
16 * The Initial Developer of the Original Code is
17 * Ajax.org Services B.V.
18 * Portions created by the Initial Developer are Copyright (C) 2010
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 *      Fabian Jakobs <fabian AT ajax DOT org>
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38define(function(require, exports, module) {
39
40var canon = require("pilot/canon");
41
42canon.addCommand({
43    name: "selectall",
44    exec: function(env, args, request) { env.editor.getSelection().selectAll(); }
45});
46canon.addCommand({
47    name: "removeline",
48    exec: function(env, args, request) { env.editor.removeLines(); }
49});
50canon.addCommand({
51    name: "gotoline",
52    exec: function(env, args, request) {
53        var line = parseInt(prompt("Enter line number:"));
54        if (!isNaN(line)) {
55            env.editor.gotoLine(line);
56        }
57    }
58});
59canon.addCommand({
60    name: "togglecomment",
61    exec: function(env, args, request) { env.editor.toggleCommentLines(); }
62});
63canon.addCommand({
64    name: "findnext",
65    exec: function(env, args, request) { env.editor.findNext(); }
66});
67canon.addCommand({
68    name: "findprevious",
69    exec: function(env, args, request) { env.editor.findPrevious(); }
70});
71canon.addCommand({
72    name: "find",
73    exec: function(env, args, request) {
74        var needle = prompt("Find:");
75        env.editor.find(needle);
76    }
77});
78canon.addCommand({
79    name: "undo",
80    exec: function(env, args, request) { env.editor.undo(); }
81});
82canon.addCommand({
83    name: "redo",
84    exec: function(env, args, request) { env.editor.redo(); }
85});
86canon.addCommand({
87    name: "redo",
88    exec: function(env, args, request) { env.editor.redo(); }
89});
90canon.addCommand({
91    name: "overwrite",
92    exec: function(env, args, request) { env.editor.toggleOverwrite(); }
93});
94canon.addCommand({
95    name: "copylinesup",
96    exec: function(env, args, request) { env.editor.copyLinesUp(); }
97});
98canon.addCommand({
99    name: "movelinesup",
100    exec: function(env, args, request) { env.editor.moveLinesUp(); }
101});
102canon.addCommand({
103    name: "selecttostart",
104    exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
105});
106canon.addCommand({
107    name: "gotostart",
108    exec: function(env, args, request) { env.editor.navigateFileStart(); }
109});
110canon.addCommand({
111    name: "selectup",
112    exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
113});
114canon.addCommand({
115    name: "golineup",
116    exec: function(env, args, request) { env.editor.navigateUp(); }
117});
118canon.addCommand({
119    name: "copylinesdown",
120    exec: function(env, args, request) { env.editor.copyLinesDown(); }
121});
122canon.addCommand({
123    name: "movelinesdown",
124    exec: function(env, args, request) { env.editor.moveLinesDown(); }
125});
126canon.addCommand({
127    name: "selecttoend",
128    exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
129});
130canon.addCommand({
131    name: "gotoend",
132    exec: function(env, args, request) { env.editor.navigateFileEnd(); }
133});
134canon.addCommand({
135    name: "selectdown",
136    exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
137});
138canon.addCommand({
139    name: "godown",
140    exec: function(env, args, request) { env.editor.navigateDown(); }
141});
142canon.addCommand({
143    name: "selectwordleft",
144    exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
145});
146canon.addCommand({
147    name: "gotowordleft",
148    exec: function(env, args, request) { env.editor.navigateWordLeft(); }
149});
150canon.addCommand({
151    name: "selecttolinestart",
152    exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
153});
154canon.addCommand({
155    name: "gotolinestart",
156    exec: function(env, args, request) { env.editor.navigateLineStart(); }
157});
158canon.addCommand({
159    name: "selectleft",
160    exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
161});
162canon.addCommand({
163    name: "gotoleft",
164    exec: function(env, args, request) { env.editor.navigateLeft(); }
165});
166canon.addCommand({
167    name: "selectwordright",
168    exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
169});
170canon.addCommand({
171    name: "gotowordright",
172    exec: function(env, args, request) { env.editor.navigateWordRight(); }
173});
174canon.addCommand({
175    name: "selecttolineend",
176    exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
177});
178canon.addCommand({
179    name: "gotolineend",
180    exec: function(env, args, request) { env.editor.navigateLineEnd(); }
181});
182canon.addCommand({
183    name: "selectright",
184    exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
185});
186canon.addCommand({
187    name: "gotoright",
188    exec: function(env, args, request) { env.editor.navigateRight(); }
189});
190canon.addCommand({
191    name: "selectpagedown",
192    exec: function(env, args, request) { env.editor.selectPageDown(); }
193});
194canon.addCommand({
195    name: "pagedown",
196    exec: function(env, args, request) { env.editor.scrollPageDown(); }
197});
198canon.addCommand({
199    name: "gotopagedown",
200    exec: function(env, args, request) { env.editor.gotoPageDown(); }
201});
202canon.addCommand({
203    name: "selectpageup",
204    exec: function(env, args, request) { env.editor.selectPageUp(); }
205});
206canon.addCommand({
207    name: "pageup",
208    exec: function(env, args, request) { env.editor.scrollPageUp(); }
209});
210canon.addCommand({
211    name: "gotopageup",
212    exec: function(env, args, request) { env.editor.gotoPageUp(); }
213});
214canon.addCommand({
215    name: "selectlinestart",
216    exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
217});
218canon.addCommand({
219    name: "gotolinestart",
220    exec: function(env, args, request) { env.editor.navigateLineStart(); }
221});
222canon.addCommand({
223    name: "selectlineend",
224    exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
225});
226canon.addCommand({
227    name: "gotolineend",
228    exec: function(env, args, request) { env.editor.navigateLineEnd(); }
229});
230canon.addCommand({
231    name: "del",
232    exec: function(env, args, request) { env.editor.removeRight(); }
233});
234canon.addCommand({
235    name: "backspace",
236    exec: function(env, args, request) { env.editor.removeLeft(); }
237});
238canon.addCommand({
239    name: "outdent",
240    exec: function(env, args, request) { env.editor.blockOutdent(); }
241});
242canon.addCommand({
243    name: "indent",
244    exec: function(env, args, request) { env.editor.indent(); }
245});
246
247});
248
Full Screen

turkish-dama.js

Source: turkish-dama.js Github

copy
1ZRF = {
2    JUMP:          0,
3    IF:            1,
4    FORK:          2,
5    FUNCTION:      3,
6    IN_ZONE:       4,
7    FLAG:          5,
8    SET_FLAG:      6,
9    POS_FLAG:      7,
10    SET_POS_FLAG:  8,
11    ATTR:          9,
12    SET_ATTR:      10,
13    PROMOTE:       11,
14    MODE:          12,
15    ON_BOARD_DIR:  13,
16    ON_BOARD_POS:  14,
17    PARAM:         15,
18    LITERAL:       16,
19    VERIFY:        20
20};
21
22Model.Game.BuildDesign = function(design) {
23    design.checkVersion("z2j", "1");
24    design.checkVersion("zrf", "2.0");
25    design.checkVersion("maximal-captures", "true");
26
27    design.addDirection("w");
28    design.addDirection("e");
29    design.addDirection("s");
30    design.addDirection("n");
31
32    design.addPlayer("White", [1, 0, 3, 2]);
33    design.addPlayer("Black", [0, 1, 3, 2]);
34
35    design.addPosition("a8", [0, 1, 8, 0]);
36    design.addPosition("b8", [-1, 1, 8, 0]);
37    design.addPosition("c8", [-1, 1, 8, 0]);
38    design.addPosition("d8", [-1, 1, 8, 0]);
39    design.addPosition("e8", [-1, 1, 8, 0]);
40    design.addPosition("f8", [-1, 1, 8, 0]);
41    design.addPosition("g8", [-1, 1, 8, 0]);
42    design.addPosition("h8", [-1, 0, 8, 0]);
43    design.addPosition("a7", [0, 1, 8, -8]);
44    design.addPosition("b7", [-1, 1, 8, -8]);
45    design.addPosition("c7", [-1, 1, 8, -8]);
46    design.addPosition("d7", [-1, 1, 8, -8]);
47    design.addPosition("e7", [-1, 1, 8, -8]);
48    design.addPosition("f7", [-1, 1, 8, -8]);
49    design.addPosition("g7", [-1, 1, 8, -8]);
50    design.addPosition("h7", [-1, 0, 8, -8]);
51    design.addPosition("a6", [0, 1, 8, -8]);
52    design.addPosition("b6", [-1, 1, 8, -8]);
53    design.addPosition("c6", [-1, 1, 8, -8]);
54    design.addPosition("d6", [-1, 1, 8, -8]);
55    design.addPosition("e6", [-1, 1, 8, -8]);
56    design.addPosition("f6", [-1, 1, 8, -8]);
57    design.addPosition("g6", [-1, 1, 8, -8]);
58    design.addPosition("h6", [-1, 0, 8, -8]);
59    design.addPosition("a5", [0, 1, 8, -8]);
60    design.addPosition("b5", [-1, 1, 8, -8]);
61    design.addPosition("c5", [-1, 1, 8, -8]);
62    design.addPosition("d5", [-1, 1, 8, -8]);
63    design.addPosition("e5", [-1, 1, 8, -8]);
64    design.addPosition("f5", [-1, 1, 8, -8]);
65    design.addPosition("g5", [-1, 1, 8, -8]);
66    design.addPosition("h5", [-1, 0, 8, -8]);
67    design.addPosition("a4", [0, 1, 8, -8]);
68    design.addPosition("b4", [-1, 1, 8, -8]);
69    design.addPosition("c4", [-1, 1, 8, -8]);
70    design.addPosition("d4", [-1, 1, 8, -8]);
71    design.addPosition("e4", [-1, 1, 8, -8]);
72    design.addPosition("f4", [-1, 1, 8, -8]);
73    design.addPosition("g4", [-1, 1, 8, -8]);
74    design.addPosition("h4", [-1, 0, 8, -8]);
75    design.addPosition("a3", [0, 1, 8, -8]);
76    design.addPosition("b3", [-1, 1, 8, -8]);
77    design.addPosition("c3", [-1, 1, 8, -8]);
78    design.addPosition("d3", [-1, 1, 8, -8]);
79    design.addPosition("e3", [-1, 1, 8, -8]);
80    design.addPosition("f3", [-1, 1, 8, -8]);
81    design.addPosition("g3", [-1, 1, 8, -8]);
82    design.addPosition("h3", [-1, 0, 8, -8]);
83    design.addPosition("a2", [0, 1, 8, -8]);
84    design.addPosition("b2", [-1, 1, 8, -8]);
85    design.addPosition("c2", [-1, 1, 8, -8]);
86    design.addPosition("d2", [-1, 1, 8, -8]);
87    design.addPosition("e2", [-1, 1, 8, -8]);
88    design.addPosition("f2", [-1, 1, 8, -8]);
89    design.addPosition("g2", [-1, 1, 8, -8]);
90    design.addPosition("h2", [-1, 0, 8, -8]);
91    design.addPosition("a1", [0, 1, 0, -8]);
92    design.addPosition("b1", [-1, 1, 0, -8]);
93    design.addPosition("c1", [-1, 1, 0, -8]);
94    design.addPosition("d1", [-1, 1, 0, -8]);
95    design.addPosition("e1", [-1, 1, 0, -8]);
96    design.addPosition("f1", [-1, 1, 0, -8]);
97    design.addPosition("g1", [-1, 1, 0, -8]);
98    design.addPosition("h1", [-1, 0, 0, -8]);
99
100    design.addZone("promotion", 1, [0, 1, 2, 3, 4, 5, 6, 7]);
101    design.addZone("promotion", 2, [56, 57, 58, 59, 60, 61, 62, 63]);
102
103    design.addCommand(0, ZRF.FUNCTION,	24);	// from
104    design.addCommand(0, ZRF.PARAM,	0);	// $1
105    design.addCommand(0, ZRF.FUNCTION,	22);	// navigate
106    design.addCommand(0, ZRF.FUNCTION,	2);	// enemy?
107    design.addCommand(0, ZRF.FUNCTION,	20);	// verify
108    design.addCommand(0, ZRF.FUNCTION,	26);	// capture
109    design.addCommand(0, ZRF.PARAM,	1);	// $2
110    design.addCommand(0, ZRF.FUNCTION,	22);	// navigate
111    design.addCommand(0, ZRF.FUNCTION,	1);	// empty?
112    design.addCommand(0, ZRF.FUNCTION,	20);	// verify
113    design.addCommand(0, ZRF.IN_ZONE,	0);	// promotion
114    design.addCommand(0, ZRF.IF,	4);
115    design.addCommand(0, ZRF.MODE,	0);	// jumptype
116    design.addCommand(0, ZRF.FUNCTION,	25);	// to
117    design.addCommand(0, ZRF.JUMP,	4);
118    design.addCommand(0, ZRF.PROMOTE,	1);	// King
119    design.addCommand(0, ZRF.MODE,	2);	// notype
120    design.addCommand(0, ZRF.FUNCTION,	25);	// to
121    design.addCommand(0, ZRF.FUNCTION,	28);	// end
122
123    design.addCommand(1, ZRF.FUNCTION,	24);	// from
124    design.addCommand(1, ZRF.PARAM,	0);	// $1
125    design.addCommand(1, ZRF.FUNCTION,	22);	// navigate
126    design.addCommand(1, ZRF.FUNCTION,	1);	// empty?
127    design.addCommand(1, ZRF.FUNCTION,	20);	// verify
128    design.addCommand(1, ZRF.IN_ZONE,	0);	// promotion
129    design.addCommand(1, ZRF.FUNCTION,	0);	// not
130    design.addCommand(1, ZRF.IF,	4);
131    design.addCommand(1, ZRF.PROMOTE,	1);	// King
132    design.addCommand(1, ZRF.FUNCTION,	25);	// to
133    design.addCommand(1, ZRF.JUMP,	2);
134    design.addCommand(1, ZRF.FUNCTION,	25);	// to
135    design.addCommand(1, ZRF.FUNCTION,	28);	// end
136
137    design.addCommand(2, ZRF.FUNCTION,	24);	// from
138    design.addCommand(2, ZRF.PARAM,	0);	// $1
139    design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
140    design.addCommand(2, ZRF.FUNCTION,	1);	// empty?
141    design.addCommand(2, ZRF.FUNCTION,	0);	// not
142    design.addCommand(2, ZRF.IF,	7);
143    design.addCommand(2, ZRF.PARAM,	1);	// $2
144    design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
145    design.addCommand(2, ZRF.FUNCTION,	4);	// last-from?
146    design.addCommand(2, ZRF.FUNCTION,	0);	// not
147    design.addCommand(2, ZRF.FUNCTION,	20);	// verify
148    design.addCommand(2, ZRF.JUMP,	-8);
149    design.addCommand(2, ZRF.FUNCTION,	2);	// enemy?
150    design.addCommand(2, ZRF.FUNCTION,	20);	// verify
151    design.addCommand(2, ZRF.PARAM,	2);	// $3
152    design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
153    design.addCommand(2, ZRF.FUNCTION,	1);	// empty?
154    design.addCommand(2, ZRF.FUNCTION,	0);	// not
155    design.addCommand(2, ZRF.IF,	18);
156    design.addCommand(2, ZRF.FUNCTION,	6);	// mark
157    design.addCommand(2, ZRF.FUNCTION,	1);	// empty?
158    design.addCommand(2, ZRF.FUNCTION,	0);	// not
159    design.addCommand(2, ZRF.IF,	5);
160    design.addCommand(2, ZRF.PARAM,	3);	// $4
161    design.addCommand(2, ZRF.FUNCTION,	23);	// opposite
162    design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
163    design.addCommand(2, ZRF.JUMP,	-6);
164    design.addCommand(2, ZRF.FUNCTION,	26);	// capture
165    design.addCommand(2, ZRF.FUNCTION,	7);	// back
166    design.addCommand(2, ZRF.FORK,	4);
167    design.addCommand(2, ZRF.MODE,	0);	// jumptype
168    design.addCommand(2, ZRF.FUNCTION,	25);	// to
169    design.addCommand(2, ZRF.FUNCTION,	28);	// end
170    design.addCommand(2, ZRF.PARAM,	4);	// $5
171    design.addCommand(2, ZRF.FUNCTION,	22);	// navigate
172    design.addCommand(2, ZRF.JUMP,	-19);
173    design.addCommand(2, ZRF.FUNCTION,	28);	// end
174
175    design.addCommand(3, ZRF.FUNCTION,	24);	// from
176    design.addCommand(3, ZRF.PARAM,	0);	// $1
177    design.addCommand(3, ZRF.FUNCTION,	22);	// navigate
178    design.addCommand(3, ZRF.FUNCTION,	1);	// empty?
179    design.addCommand(3, ZRF.FUNCTION,	0);	// not
180    design.addCommand(3, ZRF.IF,	7);
181    design.addCommand(3, ZRF.FORK,	3);
182    design.addCommand(3, ZRF.FUNCTION,	25);	// to
183    design.addCommand(3, ZRF.FUNCTION,	28);	// end
184    design.addCommand(3, ZRF.PARAM,	1);	// $2
185    design.addCommand(3, ZRF.FUNCTION,	22);	// navigate
186    design.addCommand(3, ZRF.JUMP,	-8);
187    design.addCommand(3, ZRF.FUNCTION,	28);	// end
188
189    design.addPriority(0);			// jumptype
190    design.addPriority(1);			// normaltype
191
192    design.addPiece("Man", 0);
193    design.addMove(0, 0, [3, 3], 0);
194    design.addMove(0, 0, [0, 0], 0);
195    design.addMove(0, 0, [1, 1], 0);
196    design.addMove(0, 1, [3], 1);
197    design.addMove(0, 1, [0], 1);
198    design.addMove(0, 1, [1], 1);
199
200    design.addPiece("King", 1);
201    design.addMove(1, 2, [3, 3, 3, 3, 3], 0);
202    design.addMove(1, 2, [0, 0, 0, 0, 0], 0);
203    design.addMove(1, 2, [1, 1, 1, 1, 1], 0);
204    design.addMove(1, 2, [2, 2, 2, 2, 2], 0);
205    design.addMove(1, 3, [3, 3], 1);
206    design.addMove(1, 3, [0, 0], 1);
207    design.addMove(1, 3, [1, 1], 1);
208    design.addMove(1, 3, [2, 2], 1);
209
210    design.setup("White", "Man", 48);
211    design.setup("White", "Man", 49);
212    design.setup("White", "Man", 50);
213    design.setup("White", "Man", 51);
214    design.setup("White", "Man", 52);
215    design.setup("White", "Man", 53);
216    design.setup("White", "Man", 54);
217    design.setup("White", "Man", 55);
218    design.setup("White", "Man", 40);
219    design.setup("White", "Man", 41);
220    design.setup("White", "Man", 42);
221    design.setup("White", "Man", 43);
222    design.setup("White", "Man", 44);
223    design.setup("White", "Man", 45);
224    design.setup("White", "Man", 46);
225    design.setup("White", "Man", 47);
226    design.setup("Black", "Man", 8);
227    design.setup("Black", "Man", 9);
228    design.setup("Black", "Man", 10);
229    design.setup("Black", "Man", 11);
230    design.setup("Black", "Man", 12);
231    design.setup("Black", "Man", 13);
232    design.setup("Black", "Man", 14);
233    design.setup("Black", "Man", 15);
234    design.setup("Black", "Man", 16);
235    design.setup("Black", "Man", 17);
236    design.setup("Black", "Man", 18);
237    design.setup("Black", "Man", 19);
238    design.setup("Black", "Man", 20);
239    design.setup("Black", "Man", 21);
240    design.setup("Black", "Man", 22);
241    design.setup("Black", "Man", 23);
242}
243
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Cypress on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)