<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Adding input algorithms</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>Recent changes to Adding input algorithms</description><atom:link href="https://sourceforge.net/p/ms-pacman/wiki/Adding%20input%20algorithms/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 20 Sep 2012 17:47:49 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ms-pacman/wiki/Adding%20input%20algorithms/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage Adding input algorithms modified by Luuk Bom</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>&lt;pre&gt;--- v5
+++ v6
@@ -41,10 +41,10 @@
         stateRep[i + 3] = fl.result[3];
 
         if (Globals.showVisualisation == true &amp;&amp; Globals.showCharter == true) {
-            chart.alterData("PillVisionInput", "Left", stateRep[i + 0]);
-            chart.alterData("PillVisionInput", "Right", stateRep[i + 1]);
-            chart.alterData("PillVisionInput", "Up", stateRep[i + 2]);
-            chart.alterData("PillVisionInput", "Down", stateRep[i + 3]);
+            chart.alterData("FeelingLuckyInput", "Left", stateRep[i + 0]);
+            chart.alterData("FeelingLuckyInput", "Right", stateRep[i + 1]);
+            chart.alterData("FeelingLuckyInput", "Up", stateRep[i + 2]);
+            chart.alterData("FeelingLuckyInput", "Down", stateRep[i + 3]);
         }
 
         i += 4;
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luuk Bom</dc:creator><pubDate>Thu, 20 Sep 2012 17:47:49 -0000</pubDate><guid>https://sourceforge.net12c2afd6a880a5e6a55dbe86b2516cefaa5ed360</guid></item><item><title>WikiPage Adding input algorithms modified by Luuk Bom</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>&lt;pre&gt;--- v4
+++ v5
@@ -15,40 +15,40 @@
 *  In PacMan.java, we need to change the network specifications. Go to the line that says "// neural network specifications" and add the following code inside the for-loop:
 
 ~~~~~~~~~~~~~~~~
-            if (Globals.enableFeelingLuckyInput[i] == true) {
-                inputs[i]++;
-            }
+    if (Globals.enableFeelingLuckyInput[i] == true) {
+        inputs[i]++;
+    }
 ~~~~~~~~~~~~~~~~
 Which loosely translates to: if this new input algorithm is enabled, you will need one extra input node for the corresponding neural network.
 
 *  In the same file, find the function writeNN() and add the following code inside the for-loop:
 
 ~~~~~~~~~~~~~~~~
-      globalVars += Globals.enableFeelingLuckyInput[i] + ",";
+    globalVars += Globals.enableFeelingLuckyInput[i] + ",";
 ~~~~~~~~~~~~~~~~
 This will make sure that the algorithm will still be enabled/disabled after loading a neural network file.
 
 *  Lastly, find the function getStateRep() in the same file. Add the following code below the line that says "int i=0;".
 
 ~~~~~~~~~~~~~~~
-        if (Globals.enableFeelingLuckyInput[netID] == true) {
-            FeelingLucky fl = new FeelingLucky();
-            fl.getFeeling(Game);
+    if (Globals.enableFeelingLuckyInput[netID] == true) {
+        FeelingLucky fl = new FeelingLucky();
+        fl.getFeeling(Game);
                       
-            stateRep[i + 0] = fl.result[0];
-            stateRep[i + 1] = fl.result[1];
-            stateRep[i + 2] = fl.result[2];
-            stateRep[i + 3] = fl.result[3];
+        stateRep[i + 0] = fl.result[0];
+        stateRep[i + 1] = fl.result[1];
+        stateRep[i + 2] = fl.result[2];
+        stateRep[i + 3] = fl.result[3];
 
-            if (Globals.showVisualisation == true &amp;&amp; Globals.showCharter == true) {
-                chart.alterData("PillVisionInput", "Left", stateRep[i + 0]);
-                chart.alterData("PillVisionInput", "Right", stateRep[i + 1]);
-                chart.alterData("PillVisionInput", "Up", stateRep[i + 2]);
-                chart.alterData("PillVisionInput", "Down", stateRep[i + 3]);
-            }
+        if (Globals.showVisualisation == true &amp;&amp; Globals.showCharter == true) {
+            chart.alterData("PillVisionInput", "Left", stateRep[i + 0]);
+            chart.alterData("PillVisionInput", "Right", stateRep[i + 1]);
+            chart.alterData("PillVisionInput", "Up", stateRep[i + 2]);
+            chart.alterData("PillVisionInput", "Down", stateRep[i + 3]);
+        }
 
-            i += 4;
-        }
+        i += 4;
+    }
 ~~~~~~~~~~~~
 
 This will present the neural networks with the proper resulting variable from your new input algorithm and plot it if needed.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luuk Bom</dc:creator><pubDate>Thu, 20 Sep 2012 16:28:00 -0000</pubDate><guid>https://sourceforge.net96ebc5497c46a31d862125128cc9f277ed2b30ea</guid></item><item><title>WikiPage Adding input algorithms modified by Luuk Bom</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>&lt;pre&gt;--- v3
+++ v4
@@ -24,7 +24,7 @@
 *  In the same file, find the function writeNN() and add the following code inside the for-loop:
 
 ~~~~~~~~~~~~~~~~
-globalVars += Globals.enableFeelingLuckyInput[i] + ",";
+      globalVars += Globals.enableFeelingLuckyInput[i] + ",";
 ~~~~~~~~~~~~~~~~
 This will make sure that the algorithm will still be enabled/disabled after loading a neural network file.
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luuk Bom</dc:creator><pubDate>Thu, 20 Sep 2012 16:27:06 -0000</pubDate><guid>https://sourceforge.netcab10afd98805f43841c96d7f160d50e529f1137</guid></item><item><title>WikiPage Adding input algorithms modified by Luuk Bom</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -25,7 +25,7 @@
 
 ~~~~~~~~~~~~~~~~
 globalVars += Globals.enableFeelingLuckyInput[i] + ",";
-~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~
 This will make sure that the algorithm will still be enabled/disabled after loading a neural network file.
 
 *  Lastly, find the function getStateRep() in the same file. Add the following code below the line that says "int i=0;".
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luuk Bom</dc:creator><pubDate>Thu, 20 Sep 2012 16:26:37 -0000</pubDate><guid>https://sourceforge.neta8461965281f6a7376d029e47815804b032122d6</guid></item><item><title>WikiPage Adding input algorithms modified by Luuk Bom</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,4 +1,6 @@
 Adding a new input algorithm involves some tweaking of the code, because it changes the structure of the neural networks by requiring extra input nodes. The framework will expect exactly four values from the algorithm: one for each direction. It is possible to diverge from this method, but it will require a lot of code altering. The following steps illustrate how to add a new input algorithm called "FeelingLuckyInput".
+
+The files below already contain code which implements the current input algorithms. It is wise to add your code so that the order in which the various input algorithms are called is the same in all files. In other words: add the new input algorithm below the code of the pre-existing algorithms.
 
 1. Add a new class containing the input algorithm to util.
 *  In Globals.java, go to the line that says "// ALGORITHMS", and add a new line for your input algorithm below it:
@@ -10,4 +12,43 @@
 
 *  In the same file, raise the value of numAlgorithms by one.
 
-*   
+*  In PacMan.java, we need to change the network specifications. Go to the line that says "// neural network specifications" and add the following code inside the for-loop:
+
+~~~~~~~~~~~~~~~~
+            if (Globals.enableFeelingLuckyInput[i] == true) {
+                inputs[i]++;
+            }
+~~~~~~~~~~~~~~~~
+Which loosely translates to: if this new input algorithm is enabled, you will need one extra input node for the corresponding neural network.
+
+*  In the same file, find the function writeNN() and add the following code inside the for-loop:
+
+~~~~~~~~~~~~~~~~
+globalVars += Globals.enableFeelingLuckyInput[i] + ",";
+~~~~~~~~~~~~~~~ 
+This will make sure that the algorithm will still be enabled/disabled after loading a neural network file.
+
+*  Lastly, find the function getStateRep() in the same file. Add the following code below the line that says "int i=0;".
+
+~~~~~~~~~~~~~~~
+        if (Globals.enableFeelingLuckyInput[netID] == true) {
+            FeelingLucky fl = new FeelingLucky();
+            fl.getFeeling(Game);
+                      
+            stateRep[i + 0] = fl.result[0];
+            stateRep[i + 1] = fl.result[1];
+            stateRep[i + 2] = fl.result[2];
+            stateRep[i + 3] = fl.result[3];
+
+            if (Globals.showVisualisation == true &amp;&amp; Globals.showCharter == true) {
+                chart.alterData("PillVisionInput", "Left", stateRep[i + 0]);
+                chart.alterData("PillVisionInput", "Right", stateRep[i + 1]);
+                chart.alterData("PillVisionInput", "Up", stateRep[i + 2]);
+                chart.alterData("PillVisionInput", "Down", stateRep[i + 3]);
+            }
+
+            i += 4;
+        }
+~~~~~~~~~~~~
+
+This will present the neural networks with the proper resulting variable from your new input algorithm and plot it if needed.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luuk Bom</dc:creator><pubDate>Thu, 20 Sep 2012 16:25:53 -0000</pubDate><guid>https://sourceforge.net65aea59b6f989047cdd407ed7393cc2e0163afe2</guid></item><item><title>WikiPage Adding input algorithms modified by Luuk Bom</title><link>https://sourceforge.net/p/ms-pacman/wiki/Adding%2520input%2520algorithms/</link><description>Adding a new input algorithm involves some tweaking of the code, because it changes the structure of the neural networks by requiring extra input nodes. The framework will expect exactly four values from the algorithm: one for each direction. It is possible to diverge from this method, but it will require a lot of code altering. The following steps illustrate how to add a new input algorithm called "FeelingLuckyInput".

1. Add a new class containing the input algorithm to util.
*  In Globals.java, go to the line that says "// ALGORITHMS", and add a new line for your input algorithm below it:

~~~~~~~~~~~~~~~~
    public static boolean[] enableFeelingLuckyInput =   {true, false, true};
~~~~~~~~~~~~~~~~
The above code will enable the new input algorithm for the DODGE and HUNT networks, yet disable it for the ROBERT network.

*  In the same file, raise the value of numAlgorithms by one.

*   </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Luuk Bom</dc:creator><pubDate>Thu, 20 Sep 2012 16:12:17 -0000</pubDate><guid>https://sourceforge.net5aa8db0657df99874c4bb0501f7b481f1b513055</guid></item></channel></rss>