/*
* Example node implementation for enumration of nodes from the node of the .
* The nodes agree on a specific but random node (highest num) and enumerate distance from there.
*
* How to use: Replace node.js with this file.
*/

function Node(mac, meta = {}) {
/* Required fields */

  // Basic data
  this.mac = mac;
  this.meta = meta;
  this.incoming = [];
  this.outgoing = [];

/* Additional fields */

  this.num = Math.floor(Math.random() * 1000);
  this.enum = 0;
}

Node.prototype.step = function () {

  for (var i = 0; i < this.incoming.length; i++) {
    var packet = this.incoming[i];

    if (packet.num > this.num) {
      this.num = packet.num;
      this.enum = packet.enum + 1;
    }
  }
  this.incoming = [];

  // Send own num to all direct neighbors
  var packet = new Packet(this.mac, BROADCAST_MAC, this.mac, BROADCAST_MAC);
  packet.num = this.num;
  packet.enum = this.enum;
  this.outgoing.push(packet);
}

Node.prototype.getNodeName = function () {
  return this.enum.toString();
}

Node.prototype.getNodeLabel = function () {
  return '';
}

Node.prototype.getRingColor = function () {
  return '';
}

Node.prototype.getBodyColor = function () {
  return '#fff';
}

Node.prototype.getClientCount = function () {
  return 0;
}

Node.prototype.reset = function () {
  this.incoming = [];
  this.outgoing = [];
  this.num = Math.floor(Math.random() * 1000);
}

// For the transition to new implementations
Node.prototype.copyFromOldImplementation = function (oldNode) {
  copyExistingFields(oldNode, this);
};

@@ -1,84 +1,7 @@
 /*%0A
-* Example node implementation for enumration of nodes from the node of the .%0A
 * Th
@@ -67,16 +67,21 @@
 nd e
-numerate
+valuate their
  dis
@@ -94,17 +94,28 @@
 from the
-r
+ choosen nod
 e.%0A*%0A* H

fix example description