void ExecInstruction(VM vm) { var command = vm.prog[vm.ip].Split(' '); switch (command[0]) { case "set": set(vm, command); break; case "sub": sub(vm, command); break; case "mul": mul(vm, command); break; case "jnz": jnz(vm, command); break; default: Oh.WhatTheFuck(); break; } }
void ChangeDirection(Map map, int x, int y, ref int dX, ref int dY) { if (dX == 0) { var left = map.GetCell(x - 1, y); var right = map.GetCell(x + 1, y); if (left == '-' || IsLetter(left)) { dX = -1; dY = 0; } else if (right == '-' || IsLetter(right)) { dX = 1; dY = 0; } else { Oh.WhatTheFuck(); } } else { var up = map.GetCell(x, y - 1); var down = map.GetCell(x, y + 1); if (up == '|' || IsLetter(up)) { dX = 0; dY = -1; } else if (down == '|' || IsLetter(down)) { dX = 0; dY = 1; } else { Oh.Bugger(); } } }
void ExecInstruction(VM vm) { var command = vm.prog[vm.ip].Split(' '); switch (command[0]) { case "snd": snd(vm, command); break; case "set": set(vm, command); break; case "add": add(vm, command); break; case "mul": mul(vm, command); break; case "mod": mod(vm, command); break; case "rcv": rcv(vm, command); break; case "jgz": jgz(vm, command); break; default: Oh.WhatTheFuck(); break; } }