- public static void token(Dock source, Destination dest) {
- println(ANSI.purple(" token: ") + (source + " -> " + ANSI.purple(dest+"")));
+ public static void packet(Packet p) {
+ BitVector data = p.getValue();
+ Dock source = p.getSource();
+ Destination dest = p.getDestination();
+ if (dest.getDock().getInstructionDestination()==dest) {
+ if (p.isToken()) {
+ println(ANSI.yellow(ANSI.bold(" torpedo: ")) + (source + " -> " + ANSI.yellow(ANSI.bold(dest+""))));
+ } else {
+ Instruction d = source.getShip().getFleet().decodeInstruction(data, source);
+ println(ANSI.red("dispatch: " + indent(d+"", " ")));
+ }
+ } else {
+ if (p.isToken()) {
+ println(ANSI.blue(ANSI.bold(" token: ")) + (source + " -> " + ANSI.blue(ANSI.bold(dest+""))));
+ } else {
+ println(indent(ANSI.cyan(" data: "+data) +
+ (source==null ? "" :
+ (" : " + source))+(" -> "+ANSI.cyan(""+dest)), " "));
+ }
+ }