<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.weizmann.ac.il/bp/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.weizmann.ac.il/bp/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Assaf</id>
		<title>BP Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.weizmann.ac.il/bp/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Assaf"/>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Special:Contributions/Assaf"/>
		<updated>2026-06-10T05:24:46Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.22.4</generator>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers</id>
		<title>Dining Philosophers</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers"/>
				<updated>2014-05-12T08:58:59Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Dining Philosophers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dining Philosophers =&lt;br /&gt;
In this example one can see (a) how multiple behaviors coexist independently of each other, with very simple rules for each and (b) how model-checking can help find conflicts and other desired and undesired properties.&lt;br /&gt;
&lt;br /&gt;
The example can be found in the BPJ project in the source package bp.state.unittest.ph .&lt;br /&gt;
&lt;br /&gt;
= Problem Description =&lt;br /&gt;
&lt;br /&gt;
In the famous dining philosophers problem several philosophers are sitting at a circular table, and are either eating or thinking. At the center is a large bowl of spaghetti, which requires two forks to serve and to eat. A fork is placed in between each pair of adjacent philosophers. Each philosopher may only use the fork to her left and the fork to her right. When a philosopher finishes eating, she puts down the two forks and begins thinking again. Our present goal is to check whether deadlocks, or other starvation conditions, may occur under various philosopher behaviors.&lt;br /&gt;
&lt;br /&gt;
The problem is programmed/modeled behaviorally as follows: &lt;br /&gt;
== Events ==&lt;br /&gt;
The events are the picking up and the putting down of a given fork by a given philosopher (e.g., PickUp-F2-by-P2  or PutDown-F1-by-P2)&lt;br /&gt;
&lt;br /&gt;
== B-Threads ==&lt;br /&gt;
There is a b-thread for the behavior of each philosopher and a b-thread for each fork.  In the classical&lt;br /&gt;
version, each philosopher b-thread repeatedly requests the sequence of events representing her picking up the fork to her right, picking up the fork to her left, putting down the right-hand fork, and then putting down the left-hand one. Each fork's b-thread&lt;br /&gt;
repeatedly waits for an event of picking up the fork by either of its two adjacent philosophers and then blocks its picking up&lt;br /&gt;
(again)until the fork is put down.&lt;br /&gt;
&lt;br /&gt;
The application assists the model-checking search by labeling the four philosopher behavior states&lt;br /&gt;
T(thinking -- forks down), 1 (one fork up), E (eating -- two forks up) and F (finished eating -- one fork down).&lt;br /&gt;
&lt;br /&gt;
The fork b-thread states are D (down) and U (up).&lt;br /&gt;
&lt;br /&gt;
We use model-checking to look for violations of liveness properties, and&lt;br /&gt;
detect the deadlock conditions that are possible under this classical behavior.&lt;br /&gt;
&lt;br /&gt;
For example, a path to a deadlock state in the case of 3 philosophers is displayed as:&lt;br /&gt;
&lt;br /&gt;
 Verification failed:&lt;br /&gt;
 init-&amp;gt;[T, D, T, D, T, D]&lt;br /&gt;
 PickUp-F2-by-P2-&amp;gt;[T, D, T, D, 1, U]&lt;br /&gt;
 PickUp-F1-by-P1-&amp;gt;[T, D, 1, U, 1, U]&lt;br /&gt;
 PickUp-F0-by-P0-&amp;gt;[1, U, 1, U, 1, U]&lt;br /&gt;
 [1, U, 1, U, 1, U] is a deadlock state&lt;br /&gt;
&lt;br /&gt;
where each line of the form &amp;quot;&amp;lt;event&amp;gt; -&amp;gt; &amp;lt;State&amp;gt;&amp;quot; describes a composite states of the entire program along the path and the event whose triggering led the program to transition from the preceding state to the current.&lt;br /&gt;
&lt;br /&gt;
In the symmetry breaking approach one of the philosophers is left-handed, and thus first picks up the fork to her left, rather than the one to her right. As expected, this setup is then proven by model-checking to be deadlock-free, following checking of all possible states.&lt;br /&gt;
&lt;br /&gt;
For liveness testing, the philosophers behavior b-threads marks the non-eating states as hot, and the model-checker is then&lt;br /&gt;
able to detect the starvation conditions that are possible if fairness is weak.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers</id>
		<title>Dining Philosophers</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers"/>
				<updated>2014-05-12T08:58:36Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Dining Philosophers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dining Philosophers =&lt;br /&gt;
In this example one can see (a) how multiple behaviors coexist independently of each other, with very simple rules for each and (b) how model-checking can help find conflicts and other desired and undesired properties.&lt;br /&gt;
&lt;br /&gt;
The example can be found in the BPJ project under bp.state.unittest.ph .&lt;br /&gt;
&lt;br /&gt;
= Problem Description =&lt;br /&gt;
&lt;br /&gt;
In the famous dining philosophers problem several philosophers are sitting at a circular table, and are either eating or thinking. At the center is a large bowl of spaghetti, which requires two forks to serve and to eat. A fork is placed in between each pair of adjacent philosophers. Each philosopher may only use the fork to her left and the fork to her right. When a philosopher finishes eating, she puts down the two forks and begins thinking again. Our present goal is to check whether deadlocks, or other starvation conditions, may occur under various philosopher behaviors.&lt;br /&gt;
&lt;br /&gt;
The problem is programmed/modeled behaviorally as follows: &lt;br /&gt;
== Events ==&lt;br /&gt;
The events are the picking up and the putting down of a given fork by a given philosopher (e.g., PickUp-F2-by-P2  or PutDown-F1-by-P2)&lt;br /&gt;
&lt;br /&gt;
== B-Threads ==&lt;br /&gt;
There is a b-thread for the behavior of each philosopher and a b-thread for each fork.  In the classical&lt;br /&gt;
version, each philosopher b-thread repeatedly requests the sequence of events representing her picking up the fork to her right, picking up the fork to her left, putting down the right-hand fork, and then putting down the left-hand one. Each fork's b-thread&lt;br /&gt;
repeatedly waits for an event of picking up the fork by either of its two adjacent philosophers and then blocks its picking up&lt;br /&gt;
(again)until the fork is put down.&lt;br /&gt;
&lt;br /&gt;
The application assists the model-checking search by labeling the four philosopher behavior states&lt;br /&gt;
T(thinking -- forks down), 1 (one fork up), E (eating -- two forks up) and F (finished eating -- one fork down).&lt;br /&gt;
&lt;br /&gt;
The fork b-thread states are D (down) and U (up).&lt;br /&gt;
&lt;br /&gt;
We use model-checking to look for violations of liveness properties, and&lt;br /&gt;
detect the deadlock conditions that are possible under this classical behavior.&lt;br /&gt;
&lt;br /&gt;
For example, a path to a deadlock state in the case of 3 philosophers is displayed as:&lt;br /&gt;
&lt;br /&gt;
 Verification failed:&lt;br /&gt;
 init-&amp;gt;[T, D, T, D, T, D]&lt;br /&gt;
 PickUp-F2-by-P2-&amp;gt;[T, D, T, D, 1, U]&lt;br /&gt;
 PickUp-F1-by-P1-&amp;gt;[T, D, 1, U, 1, U]&lt;br /&gt;
 PickUp-F0-by-P0-&amp;gt;[1, U, 1, U, 1, U]&lt;br /&gt;
 [1, U, 1, U, 1, U] is a deadlock state&lt;br /&gt;
&lt;br /&gt;
where each line of the form &amp;quot;&amp;lt;event&amp;gt; -&amp;gt; &amp;lt;State&amp;gt;&amp;quot; describes a composite states of the entire program along the path and the event whose triggering led the program to transition from the preceding state to the current.&lt;br /&gt;
&lt;br /&gt;
In the symmetry breaking approach one of the philosophers is left-handed, and thus first picks up the fork to her left, rather than the one to her right. As expected, this setup is then proven by model-checking to be deadlock-free, following checking of all possible states.&lt;br /&gt;
&lt;br /&gt;
For liveness testing, the philosophers behavior b-threads marks the non-eating states as hot, and the model-checker is then&lt;br /&gt;
able to detect the starvation conditions that are possible if fairness is weak.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers</id>
		<title>Dining Philosophers</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers"/>
				<updated>2014-05-12T08:56:55Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* B-Threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dining Philosophers =&lt;br /&gt;
In this example one can see (a) how multiple behaviors coexist independently of each other, with very simple rules for each and (b) how model-checking can help find conflicts and other desired and undesired properties. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
= Problem Description =&lt;br /&gt;
&lt;br /&gt;
In the famous dining philosophers problem several philosophers are sitting at a circular table, and are either eating or thinking. At the center is a large bowl of spaghetti, which requires two forks to serve and to eat. A fork is placed in between each pair of adjacent philosophers. Each philosopher may only use the fork to her left and the fork to her right. When a philosopher finishes eating, she puts down the two forks and begins thinking again. Our present goal is to check whether deadlocks, or other starvation conditions, may occur under various philosopher behaviors.&lt;br /&gt;
&lt;br /&gt;
The problem is programmed/modeled behaviorally as follows: &lt;br /&gt;
== Events ==&lt;br /&gt;
The events are the picking up and the putting down of a given fork by a given philosopher (e.g., PickUp-F2-by-P2  or PutDown-F1-by-P2)&lt;br /&gt;
&lt;br /&gt;
== B-Threads ==&lt;br /&gt;
There is a b-thread for the behavior of each philosopher and a b-thread for each fork.  In the classical&lt;br /&gt;
version, each philosopher b-thread repeatedly requests the sequence of events representing her picking up the fork to her right, picking up the fork to her left, putting down the right-hand fork, and then putting down the left-hand one. Each fork's b-thread&lt;br /&gt;
repeatedly waits for an event of picking up the fork by either of its two adjacent philosophers and then blocks its picking up&lt;br /&gt;
(again)until the fork is put down.&lt;br /&gt;
&lt;br /&gt;
The application assists the model-checking search by labeling the four philosopher behavior states&lt;br /&gt;
T(thinking -- forks down), 1 (one fork up), E (eating -- two forks up) and F (finished eating -- one fork down).&lt;br /&gt;
&lt;br /&gt;
The fork b-thread states are D (down) and U (up).&lt;br /&gt;
&lt;br /&gt;
We use model-checking to look for violations of liveness properties, and&lt;br /&gt;
detect the deadlock conditions that are possible under this classical behavior.&lt;br /&gt;
&lt;br /&gt;
For example, a path to a deadlock state in the case of 3 philosophers is displayed as:&lt;br /&gt;
&lt;br /&gt;
 Verification failed:&lt;br /&gt;
 init-&amp;gt;[T, D, T, D, T, D]&lt;br /&gt;
 PickUp-F2-by-P2-&amp;gt;[T, D, T, D, 1, U]&lt;br /&gt;
 PickUp-F1-by-P1-&amp;gt;[T, D, 1, U, 1, U]&lt;br /&gt;
 PickUp-F0-by-P0-&amp;gt;[1, U, 1, U, 1, U]&lt;br /&gt;
 [1, U, 1, U, 1, U] is a deadlock state&lt;br /&gt;
&lt;br /&gt;
where each line of the form &amp;quot;&amp;lt;event&amp;gt; -&amp;gt; &amp;lt;State&amp;gt;&amp;quot; describes a composite states of the entire program along the path and the event whose triggering led the program to transition from the preceding state to the current.&lt;br /&gt;
&lt;br /&gt;
In the symmetry breaking approach one of the philosophers is left-handed, and thus first picks up the fork to her left, rather than the one to her right. As expected, this setup is then proven by model-checking to be deadlock-free, following checking of all possible states.&lt;br /&gt;
&lt;br /&gt;
For liveness testing, the philosophers behavior b-threads marks the non-eating states as hot, and the model-checker is then&lt;br /&gt;
able to detect the starvation conditions that are possible if fairness is weak.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers</id>
		<title>Dining Philosophers</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Dining_Philosophers"/>
				<updated>2014-05-12T08:56:24Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: Created page with &amp;quot;= Dining Philosophers = In this example one can see (a) how multiple behaviors coexist independently of each other, with very simple rules for each and (b) how model-checking ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Dining Philosophers =&lt;br /&gt;
In this example one can see (a) how multiple behaviors coexist independently of each other, with very simple rules for each and (b) how model-checking can help find conflicts and other desired and undesired properties. &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
= Problem Description =&lt;br /&gt;
&lt;br /&gt;
In the famous dining philosophers problem several philosophers are sitting at a circular table, and are either eating or thinking. At the center is a large bowl of spaghetti, which requires two forks to serve and to eat. A fork is placed in between each pair of adjacent philosophers. Each philosopher may only use the fork to her left and the fork to her right. When a philosopher finishes eating, she puts down the two forks and begins thinking again. Our present goal is to check whether deadlocks, or other starvation conditions, may occur under various philosopher behaviors.&lt;br /&gt;
&lt;br /&gt;
The problem is programmed/modeled behaviorally as follows: &lt;br /&gt;
== Events ==&lt;br /&gt;
The events are the picking up and the putting down of a given fork by a given philosopher (e.g., PickUp-F2-by-P2  or PutDown-F1-by-P2)&lt;br /&gt;
&lt;br /&gt;
== B-Threads == &lt;br /&gt;
There is a b-thread for the behavior of each philosopher and a b-thread for each fork.  In the classical&lt;br /&gt;
version, each philosopher b-thread repeatedly requests the sequence of events representing her picking up the fork to her right, picking up the fork to her left, putting down the right-hand fork, and then putting down the left-hand one. Each fork's b-thread &lt;br /&gt;
repeatedly waits for an event of picking up the fork by either of its two adjacent philosophers and then blocks its picking up&lt;br /&gt;
(again)until the fork is put down.&lt;br /&gt;
&lt;br /&gt;
== &lt;br /&gt;
The application assists the model-checking search by labeling the four philosopher behavior states&lt;br /&gt;
T(thinking -- forks down), 1 (one fork up), E (eating -- two forks up) and F (finished eating -- one fork down).&lt;br /&gt;
&lt;br /&gt;
The fork b-thread states are D (down) and U (up).&lt;br /&gt;
&lt;br /&gt;
We use model-checking to look for violations of liveness properties, and&lt;br /&gt;
detect the deadlock conditions that are possible under this classical behavior.&lt;br /&gt;
&lt;br /&gt;
For example, a path to a deadlock state in the case of 3 philosophers is displayed as:&lt;br /&gt;
&lt;br /&gt;
 Verification failed:&lt;br /&gt;
 init-&amp;gt;[T, D, T, D, T, D]&lt;br /&gt;
 PickUp-F2-by-P2-&amp;gt;[T, D, T, D, 1, U]&lt;br /&gt;
 PickUp-F1-by-P1-&amp;gt;[T, D, 1, U, 1, U]&lt;br /&gt;
 PickUp-F0-by-P0-&amp;gt;[1, U, 1, U, 1, U]&lt;br /&gt;
 [1, U, 1, U, 1, U] is a deadlock state&lt;br /&gt;
&lt;br /&gt;
where each line of the form &amp;quot;&amp;lt;event&amp;gt; -&amp;gt; &amp;lt;State&amp;gt;&amp;quot; describes a composite states of the entire program along the path and the event whose triggering led the program to transition from the preceding state to the current.&lt;br /&gt;
&lt;br /&gt;
In the symmetry breaking approach one of the philosophers is left-handed, and thus first picks up the fork to her left, rather than the one to her right. As expected, this setup is then proven by model-checking to be deadlock-free, following checking of all possible states.&lt;br /&gt;
&lt;br /&gt;
For liveness testing, the philosophers behavior b-threads marks the non-eating states as hot, and the model-checker is then&lt;br /&gt;
able to detect the starvation conditions that are possible if fairness is weak.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Programming_Examples</id>
		<title>BPJ Programming Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Programming_Examples"/>
				<updated>2014-05-12T08:41:56Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* BPJ Programming Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ Programming Examples =&lt;br /&gt;
*[[Water Tap | Alternating Taps]]&lt;br /&gt;
*[[Tic-Tac-Toe | Tic-Tac-Toe]]&lt;br /&gt;
*[[Helicopter flight and mission | Helicopter flight and mission ]]&lt;br /&gt;
*[[Flight of a flock of birds | Simulating flight of a flock of birds]]&lt;br /&gt;
*[[Sudoku | Sudoku]]&lt;br /&gt;
*[[Dining Philosophers | Dining Philosophers]]&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Download</id>
		<title>Download</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Download"/>
				<updated>2014-05-12T08:38:33Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Download and Installation =&lt;br /&gt;
&lt;br /&gt;
*Operating System:&lt;br /&gt;
** Windows or Linux.&lt;br /&gt;
*IDE Requirements:&lt;br /&gt;
** BPJ does not depend on any specific environment. The library and examples can be used with the latest version of Eclipse, or in any other Java programming environment.&lt;br /&gt;
* Downloading Eclipse:&lt;br /&gt;
** Download Eclipse classic for Java from http://www.eclipse.org/.&lt;br /&gt;
** Extract the downloaded files – no installation is needed.&lt;br /&gt;
*Downloading and Configuring BPJ:&lt;br /&gt;
** Download [http://www.wisdom.weizmann.ac.il/~bprogram/code/BPJ.zip  BPJ.zip]&lt;br /&gt;
** In Eclipse, import the project BPJCore110 as follows:&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; General -&amp;gt; Existing Project into Work Space -&amp;gt; BPJCore110&lt;br /&gt;
** Rebuild the project.&lt;br /&gt;
** Import run configurations (optional -- Required mainly for running model-checking examples):&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; Run/Debug. Then select all available configurations&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-05-12T08:30:14Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
&lt;br /&gt;
* When in BP for Blockly (under FireFox), click the drop-down menu and select &amp;quot;Hot and Cold&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This example contains three enabled b-threads and one disabled b-thread.&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* The 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly.&lt;br /&gt;
* To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml.&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* BtnNorth: User clicked North&lt;br /&gt;
* BtnSouth: User clicked South&lt;br /&gt;
* TimeTick: A unit of time passed &lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* (Same for west, north and south) . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketNorth: Request to redraw rocket 10 pixels further to the north&lt;br /&gt;
* RocketSouth: Request to redraw rocket 10 pixels further to the south&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* PadEast: The application wishes the pad to move 10 pixels further to the east&lt;br /&gt;
* PadNorth: The application wishes the pad to move 10 pixels further to the north&lt;br /&gt;
* PadSouth: The application wishes the pad to move 10 pixels further to the south&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Sudoku</id>
		<title>Sudoku</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Sudoku"/>
				<updated>2014-04-29T09:48:39Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Playing b-threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Sudoku =&lt;br /&gt;
In this example one can see two properties of behavioral programming&lt;br /&gt;
* How different heuristics and pieces of knowledge about the problem domain can be used separately to program an application&lt;br /&gt;
* How model-checking can be used to help find a desired scenario.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
In the cells of a 9X9 grid which is also divided into 9 3X3 boxes, place the digits 1-9 such that in each row, column and box, each digit appears exactly once.&lt;br /&gt;
&lt;br /&gt;
= Events =&lt;br /&gt;
&lt;br /&gt;
* Move: A single event class with 9X9X9 = 721 instances, indicating the writing of a given digit in a given cell. The class has the following data fields:&lt;br /&gt;
&lt;br /&gt;
** number: the digit written in the cell  (1-9)&lt;br /&gt;
** row: The row  of the cell (1-9)&lt;br /&gt;
** col: the column of the cell  (1-9)&lt;br /&gt;
** boxrow: The row of the 3X3 box in which this cell resides (1-3)&lt;br /&gt;
** boxcol: the column of the 3X3 box in which this cell resides (1-3)&lt;br /&gt;
&lt;br /&gt;
When enough data is provided, the strategies below are sufficient for solving the game.&lt;br /&gt;
When not enough data is provided, model checking explores the different possibilities until a solution is found.&lt;br /&gt;
&lt;br /&gt;
== Playing b-threads ==&lt;br /&gt;
* MakeGivenMoves: This b-thread provides the opening input to the riddle - filling in the known cells.&lt;br /&gt;
* DefaultMove: Each of the 81 instances of this b-thread class, is associated with a cell, and requests all possible 9 digits. Once an event occurs, all other events for the cell are blocked.&lt;br /&gt;
* DetectWin: This b-thread simply counts until 81 events have been triggered. The correctness of the solution is guaranteed&lt;br /&gt;
* EliminateTwoInABox: This b-thread tries to write a number in a cell after  the same number was written in two other columns of this box. It does not check if the cell is occopied or if the digit was already written in the present column - this is provided by event-blocking in other b-threads.&lt;br /&gt;
* PlaceANumberInARow: With an instance for each digit and each row, this b-thread tries to place a particular digit in the row. It waits till there is only one place to put it, and then requests the corresponding event.&lt;br /&gt;
* PlaceANumberInAColumn: With an instance for each digit and each row, this b-thread tries to place a particular digit in the Column. It waits till there is only one place to put it,  and then requests the corresponding event.&lt;br /&gt;
* PlaceANumberInABox: With an instance for each digit and each place in the box, this b-thread tries to place a particular digit in the box. It waits till there is only one place to put it,  and then requests the corresponding event.&lt;br /&gt;
* EliminateEight: For each cell, an instance of this b-thread checks the possibilities for the cell, and eliminates possibilities as conflicting events occur elsewhere. When the number of remaining possibilities is one, the b-thread requests the remaining digit.&lt;br /&gt;
&lt;br /&gt;
== b-threads that support model-checking ==&lt;br /&gt;
PruneWhenNoSolution: This b-thread requests an event at a low priority. If it is triggered, it means that all move events are blocked, hence the game has failed. It then calls the model-checking API to prune the search.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Notes ==&lt;br /&gt;
* The b-thread DefaultMove could have been split into two. One that requests the default moves and terminates, and one that waits for any event in a cell and blocks all alternative digits in the cell. The present design works because a pending request of DefaultMove is unified with any granted request due to the stratgies/heuristics b-threads, as well as the GivenMoves b-thread.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
# Click [[Media:Sudoku1.zip | here]] to download the sudoku example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The sudoku example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Programming_Examples</id>
		<title>BPJ Programming Examples</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Programming_Examples"/>
				<updated>2014-04-29T09:45:18Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* BPJ Programming Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ Programming Examples =&lt;br /&gt;
*[[Water Tap | Alternating Taps]]&lt;br /&gt;
*[[Tic-Tac-Toe | Tic-Tac-Toe]]&lt;br /&gt;
*[[Helicopter flight and mission | Helicopter flight and mission ]]&lt;br /&gt;
*[[Flight of a flock of birds | Simulating flight of a flock of birds]]&lt;br /&gt;
*[[Sudoku | Sudoku]]&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-29T09:43:39Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
&lt;br /&gt;
* When in BP for Blockly (under FireFox), click the drop-down menu and select &amp;quot;Hot and Cold&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This example contains three enabled b-threads and one disabled b-thread.&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* The 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly.&lt;br /&gt;
* To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml.&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-29T09:43:17Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
&lt;br /&gt;
* When in BP for Blockly (under FireFox), click the drop-down meny and select Hot and Cold.&lt;br /&gt;
&lt;br /&gt;
This example contains three enabled b-threads and one disabled b-thread. &lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* The 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly.&lt;br /&gt;
* To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml.&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Main_Page"/>
				<updated>2014-04-29T09:41:33Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* BP in Blockly and JavaScript */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Behavioral Programming in Imperative Languages =&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
== BP in Java ==&lt;br /&gt;
[[User Guide | BPJ Documentation and Examples]]&lt;br /&gt;
&lt;br /&gt;
== BP in Blockly and JavaScript ==&lt;br /&gt;
&lt;br /&gt;
[[BP Blockly User Guide | BP in Blockly and JavaScript Documentation and Examples]]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[http://www.b-prog.org BP Web Site]&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Main_Page"/>
				<updated>2014-04-29T09:40:48Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* BP in Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Behavioral Programming in Imperative Languages =&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
== BP in Java ==&lt;br /&gt;
[[User Guide | BPJ Documentation and Examples]]&lt;br /&gt;
&lt;br /&gt;
== BP in Blockly and JavaScript ==&lt;br /&gt;
&lt;br /&gt;
[[BP Blockly User Guide | BP Blockly User Guide]]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[http://www.b-prog.org BP Web Site]&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2014-04-29T09:40:05Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ Documentation and Examples =&lt;br /&gt;
&lt;br /&gt;
*[[Download|Downloading, installing and configuring the BPJ library, related tools and examples]]&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~bprogram/pres/BPintroduction.pdf A slide presentation: a general introduction to behavioral programming]&lt;br /&gt;
*[[The BPJ Library|The BPJ library: about b-threads, events, b-programs, etc.]]&lt;br /&gt;
*[[Dynamic b-threads|Symbolic and dynamic and b-threads]]&lt;br /&gt;
*[[TraceVis|Tracing and visualizing behavioral Java programs with TraceVis]]&lt;br /&gt;
*[[BPJ Model Checking|Verifying your application with the BPJ model checking]]&lt;br /&gt;
*[[BPJ Programming Examples | BPJ Programming Examples]]&lt;br /&gt;
&lt;br /&gt;
= Advanced Topics =&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~amarron/FuzzIeee12.pdf Using BPJ for hybrid fuzzy control with BFUZ].&lt;br /&gt;
*[[Z3BP|Working with Z3 Theorem Prover / SMT Solver]]&lt;br /&gt;
*[[Learning | Adaptive Behavioral Programming]]&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T19:12:57Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: The Rocket Landing Game Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly.&lt;br /&gt;
* When in BP for Blockly (under FireFox), click Load Project,  browse and select bp_code/apps/bp/examples/addHotCold.xml.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly.&lt;br /&gt;
* To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml.&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T19:12:40Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly.&lt;br /&gt;
* When in BP for Blockly (under FireFox), click Load Project,  browse and select bp_code/apps/bp/examples/addHotCold.xml.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T19:11:46Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
&lt;br /&gt;
* Download the zipped version of BP Blockly. &lt;br /&gt;
* When in BP for Blockly (under FireFox), click Load Project,  load the Hot and Cold example from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T18:41:43Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Additional Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
When in BP for Blockly, load the Hot and Cold example from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper]&lt;br /&gt;
* A basic game of Tic-Tac-Toe: This example, with very basic strategies, demonstrates the instantiation of a b-thread according to a parameter list. For example, the application block &amp;quot;all Squares&amp;quot; represents a list of all possible squares, and a b-thread is instantiated for each one of these, waiting for a user click in this square, and requesting an X event in the same square.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T18:36:23Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Additional Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
When in BP for Blockly, load the Hot and Cold example from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides two additional examples&lt;br /&gt;
* A nullification game: See explanation in [http://www.wisdom.weizmann.ac.il/~bprogram/pres/agere2012AuthorVersion.pdf AGERE 2012 paper] &lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T18:34:14Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
When in BP for Blockly, load the Hot and Cold example from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
* Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
* A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three additional examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T18:33:24Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
When in BP for Blockly, load the Hot and Cold example from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads:&lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times.&lt;br /&gt;
* 2. Requesting the event addCold 10 times.&lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop.&lt;br /&gt;
&lt;br /&gt;
Experimenting:&lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly.&lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.&lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
&lt;br /&gt;
Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.&lt;br /&gt;
&lt;br /&gt;
A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three additional examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T18:31:37Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Example: Alternating Taps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps =&lt;br /&gt;
When in BP for blockly, load the Hot and Cold example from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
This example contains three b-threads: &lt;br /&gt;
&lt;br /&gt;
* 1. Requesting the event addHot 10 times  &lt;br /&gt;
* 2. Requesting the event addCold 10 times  &lt;br /&gt;
* 3. Forcing the alternation of the two events by waiting for two occurrences of addHot event and blocking the addCold, and vice versa, in a loop. &lt;br /&gt;
&lt;br /&gt;
Experimenting: &lt;br /&gt;
* Try disabling the third b-thread. Both remaining b-threads will run and events will alternate, per the round robin scheduling in this version of BP for Blockly. &lt;br /&gt;
* Then try disabling the first b-thread. Only addCold events will be triggered.  &lt;br /&gt;
* Then enable the third b-thread, and run the program again. No events will be triggered due the blocking of addCold.&lt;br /&gt;
&lt;br /&gt;
Click on the HTML tab and examine the HTML actuator code that displays the event text upon triggering of the events.  In another implementation this code could call a JavaScript method that actually opens a water tap for a few seconds.  &lt;br /&gt;
&lt;br /&gt;
A 4th b-thread was loaded disabled. This is an &amp;quot;actuator&amp;quot; b-thread that reacts to the addHot and addCold events. In this case, by displaying a window with the event text. Again, this b-thread could call a JavaScript method that performs a desired action.&lt;br /&gt;
&lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three additional examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T18:07:31Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.&lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Example: Alternating Taps = &lt;br /&gt;
When in BP for blockly, load the hotcold example from the drop-down menu.  &lt;br /&gt;
= Example: The Rocket Landing Game Example =&lt;br /&gt;
&lt;br /&gt;
To load this example click &amp;quot;Load Project&amp;quot; and browse and select bp_code/apps/bp/examples/RocketLanding.xml. &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending&lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements&lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win&lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three additional examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T17:55:58Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* BP Programming Blocks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: In the version of BP for Blockly there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory. An earlier version of BP there is a container block for a b-threads. &lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game.&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* b-Sync: This block is available in an earlier version of BP for Blockly, and it can specify requested, waited-for and blocked events.  &lt;br /&gt;
* Application specific blocks: These blocks are defined by the user in the application blocks tab, and can then be used from the pallet. They can be used for events, lists and more. For example, to code an application event block, the easiest way is to copy and paste the following code changing the text &amp;quot;MYEVENT&amp;quot; to your event name (in four places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending &lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements &lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win  &lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T17:49:48Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP in Google Blockly is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
It is implemented in Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game. &lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending &lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements &lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win  &lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T17:48:51Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
This is an experimental platform set to illustrate visually the basic capabilities of behavioral programming.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game. &lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending &lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements &lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win  &lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T16:47:42Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Basic Composite Behavior */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads: &lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location: &lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T14:42:14Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* BP Programming Blocks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* B-thread: there is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
** However, the block called &amp;quot;instantiate with&amp;quot; enables the creation of multiple b-threads with different parameters. See example in the Tic-Tac-Toe game. &lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending &lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements &lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win  &lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T14:38:36Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Programming */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending &lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements &lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win  &lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T14:37:03Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* The B-threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* There is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to:&lt;br /&gt;
* User pressing a button - request rocket move&lt;br /&gt;
* Time ticks - Rocket descending &lt;br /&gt;
* Time ticks - Landing pad moves&lt;br /&gt;
* Rocket reaching a wall - block movements &lt;br /&gt;
* Rocket departing from a wall - allow movements&lt;br /&gt;
* Rocket touching the ground - loss&lt;br /&gt;
* Rocket landing on the landing pad - win  &lt;br /&gt;
* Etc.&lt;br /&gt;
&lt;br /&gt;
A key point to observe is that the behavior when rocket reaches the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:46:25Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* The B-threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* There is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas.&lt;br /&gt;
They react to user pressing a button, time ticks, rocket reaching a wall, rocket departing from a wall, etc.&lt;br /&gt;
A key point to observe is that the behavior of the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:46:02Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* The B-threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* There is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
The b-threads in the application can be seen  on the canvas. &lt;br /&gt;
They react to user pressing a button, time ticks, rocket reaching a wall, rocket departing from a wall etc.  &lt;br /&gt;
A key point to observe is that the behavior of the walls is independent and is by blocking of a move past the wall.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:44:11Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* There is no separate block for behavior threads. Each contiguous set of execution blocks forms a b-thread. You can add a comment to the b-thread, indicating its name or function, but this is not mandatory.&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder.&lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples.&lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example ==&lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that&lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but&lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D.&lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
* GameOver: The application determined that the game should be stopped&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
&lt;br /&gt;
As can be seen in the example - behavior threads in blockly are not named. You can add t&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:38:25Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* The B-threads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder. &lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples. &lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example == &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that &lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but &lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D. &lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
&lt;br /&gt;
== The B-threads ==&lt;br /&gt;
Actuator &amp;amp; GameOver &amp;amp; The application determined that the game should be stopped \\&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:38:12Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Actuator Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder. &lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples. &lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example == &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that &lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but &lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D. &lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
=== Actuator Events ===&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
&lt;br /&gt;
== The B-threads == &lt;br /&gt;
Actuator &amp;amp; GameOver &amp;amp; The application determined that the game should be stopped \\&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:38:00Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Sensor Events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder. &lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples. &lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example == &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that &lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but &lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D. &lt;br /&gt;
&lt;br /&gt;
=== Sensor Events ===&lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East&lt;br /&gt;
* BtnWest: User clicked West&lt;br /&gt;
* . . .&lt;br /&gt;
* TimeTick: A unit of time passed (s&lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . .&lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
== Actuator Events ==&lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down&lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . .&lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost&lt;br /&gt;
&lt;br /&gt;
== The B-threads == &lt;br /&gt;
Actuator &amp;amp; GameOver &amp;amp; The application determined that the game should be stopped \\&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide</id>
		<title>BP Blockly User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BP_Blockly_User_Guide"/>
				<updated>2014-04-28T11:37:31Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BP Blockly User Guide =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript.&lt;br /&gt;
Behavioral programs written in Blockly are translated into and executed as JavaScript programs.&lt;br /&gt;
&lt;br /&gt;
= Installation / Getting started =&lt;br /&gt;
* Install Firefox browser version 15.0.1 or later.&lt;br /&gt;
* For online use: open with FireFox the designated [http://www.b-prog.org/BP_Code/apps/BP  Blockly link]&lt;br /&gt;
* For offline/local use on your computer:&lt;br /&gt;
** Download the zip file containing the Blockly and JavaScript package from the download screen;&lt;br /&gt;
** Extract the zip file, preserving directory structure;&lt;br /&gt;
** Open with Firefox the file BP_Code\apps\BP\index.html;&lt;br /&gt;
* Look at example projects in the examples drop down, additional examples linked from this site, and the [http://bp-new-blockly.appspot.com/ tutorial]&lt;br /&gt;
&lt;br /&gt;
= User Interface =&lt;br /&gt;
&lt;br /&gt;
== Tabs ==&lt;br /&gt;
The BP Blockly interface introduces four tabs:&lt;br /&gt;
* Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.&lt;br /&gt;
* HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.&lt;br /&gt;
* Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.&lt;br /&gt;
* JavaScript: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the executable JavaScript generated from the Blockly code&lt;br /&gt;
* XML: This tab, shown in &amp;quot;debug&amp;quot; mode, shows the text file where the entire application is stored.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
* To scroll click and drag the canvas up or down, or use the scroll bar.&lt;br /&gt;
* Note that at initial loading parts of an application may be hidden and you may need to scroll up.&lt;br /&gt;
* Actions: Right click offers a popup menu&lt;br /&gt;
&lt;br /&gt;
= Programming =&lt;br /&gt;
&lt;br /&gt;
* To create an application drag blocks onto the canvas&lt;br /&gt;
* To start the application click on the red &amp;quot;Play&amp;quot; button&lt;br /&gt;
* To provide HTML information, look at templates of existing projects and at [http://www.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE!2012 paper].&lt;br /&gt;
* Sensor example: for translating a button click into a behavioral event&lt;br /&gt;
 input value=&amp;quot;StartGame&amp;quot;&lt;br /&gt;
 type=&amp;quot;button&amp;quot;&lt;br /&gt;
 onclick=&amp;quot;startGame();&amp;quot;&lt;br /&gt;
 style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
* To create an actuator, code&lt;br /&gt;
 when_&amp;lt;eventName&amp;gt; = ... &amp;lt; mycode &amp;gt;&lt;br /&gt;
* Example actuator which changes a screen display:&lt;br /&gt;
  input value='Status:     Playing       '&lt;br /&gt;
  type=&amp;quot;button&amp;quot;&lt;br /&gt;
  when_DisplayWin =&amp;quot;value='Status: *** Successful*** ';alert(' !!! You Won   !!! ');&amp;quot;&lt;br /&gt;
  when_DisplayLose=&amp;quot;value='Status: !!! Game Lost !!! ';alert(' !!! Game Lost !!! ');&amp;quot;&lt;br /&gt;
  style=&amp;quot;position:relative;background-color:LightPink;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events&lt;br /&gt;
* B-thread priority:&lt;br /&gt;
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.&lt;br /&gt;
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas (presently disabled).&lt;br /&gt;
* Loading an existing project: Click &amp;quot;Load project&amp;quot;, and browse and select an XML file where a project has been saved.&lt;br /&gt;
* Saving a project: Click &amp;quot;Save Project&amp;quot; and use standard browser functions to save the XML file. Close the extra tabs.&lt;br /&gt;
* Debugging and Event Logging:&lt;br /&gt;
** Use Firefox console native, or&lt;br /&gt;
** Use [ http://getfirebug.com/ Firebug tool]:&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** In the application GUI screen – click on the firebug icon;&lt;br /&gt;
*** You may have to reload the application GUI screen;&lt;br /&gt;
*** In the firebug display click console tab;&lt;br /&gt;
*** In the console drop-down - make sure console is enabled;&lt;br /&gt;
*** Start the application&lt;br /&gt;
*** Watch the events in the console log.&lt;br /&gt;
* Do not edit the compiled JavaScript or XML file;&lt;br /&gt;
* Avoid spaces or periods in strings and variable names&lt;br /&gt;
* Sometimes the XML file may be corrupted. To avoid losing your data, save frequently in different file names and verify the file can be loaded.&lt;br /&gt;
&lt;br /&gt;
= BP Programming Blocks =&lt;br /&gt;
With BP you have in Blockly the following new programming blocks:&lt;br /&gt;
* Event: Defines a e behavioral event. The event name should be entered a string inside this event block.&lt;br /&gt;
* Request &amp;lt;event&amp;gt;:  Request an event. The event is requested and the program continues when the event is triggered.&lt;br /&gt;
* Wait for &amp;lt;event &amp;gt;: wait for and event. The program continues when the event is triggered.&lt;br /&gt;
* Blocking &amp;lt;event&amp;gt;: This container block, forbids the specified event until the code contained in it completes&lt;br /&gt;
* Break upon &amp;lt;event&amp;gt;: This container block executes the code contained in it, but the execution is interrupted if and when the specified event is triggered.&lt;br /&gt;
* Application specific events: These events are defined by the user in the application blocks tab, and can then be used from the pallet. To code an application block. The easiest way is to copy and paste the following code changing the text &amp;quot;MYEEVENT&amp;quot; to your event name (4 places).&lt;br /&gt;
&lt;br /&gt;
 custom.bp_event_MYEVENT = {&lt;br /&gt;
   helpUrl: 'http://www.example.com/',&lt;br /&gt;
   init: function() {&lt;br /&gt;
     this.setColour(290);&lt;br /&gt;
     this.appendDummyInput()&lt;br /&gt;
         .appendTitle(&amp;quot;MYEVENT&amp;quot;);&lt;br /&gt;
     this.setOutput(true, 'event');&lt;br /&gt;
     this.setTooltip('');&lt;br /&gt;
   }&lt;br /&gt;
 };&lt;br /&gt;
 Blockly.JavaScript.bp_event_MYEVENT = function () {&lt;br /&gt;
     return ['&amp;quot;MYEVENT&amp;quot;', Blockly.JavaScript.ORDER_NONE];&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
= Examples = &lt;br /&gt;
&lt;br /&gt;
The dropdown menu provides three examples&lt;br /&gt;
* A water tap example with two b-threads adding hot water and cold water separately, and a third one alternating between them.&lt;br /&gt;
* A nullification game&lt;br /&gt;
* A basic game of Tic-Tac-Toe&lt;br /&gt;
&lt;br /&gt;
Two additional examples are provided in the examples folder. &lt;br /&gt;
To load them, press Load Project, and then go to the folder where you have downloaded BP Blockly, and browse the subfolder ..BP_Code/apps/BP/examples. &lt;br /&gt;
&lt;br /&gt;
* WaterTap2.xml - A similar example to the hot cold example above, with an actuator b-threads that prints a message&lt;br /&gt;
* RocketLanding.xml - A 3-dimensional rocket-landing game, explained in more detail below&lt;br /&gt;
&lt;br /&gt;
== The Rocket Landing Game Example == &lt;br /&gt;
&lt;br /&gt;
In this game the player attempts to land a rocket on a landing pad on the surface of a planet. The rocket moves downward at a fixed speed in the vertical direction. Using GUI buttons, the player can move the rocket north, south, east and west, with the goal of positioning it directly above the landing pad. The player can also press an Up button to create an exhaust burst that &lt;br /&gt;
suspends the rocket and prevents it from going down in the next time unit. The landing pad keeps moving on the ground either randomly or subject to an unknown plan. Four walls mark the sides of the playing area, and the rocket cannot move past them (but &lt;br /&gt;
does not crash when it touches them). The game is won when the rocket lands exactly on the landing pad, and is lost when it touches the ground without being fully on the pad. The rocket movement is in three dimensions and the view of the entire game scene can be manipulated (tilt, pan, etc.) in 3D. &lt;br /&gt;
&lt;br /&gt;
=== Sensor Events === &lt;br /&gt;
&lt;br /&gt;
* BtnEast: User clicked East &lt;br /&gt;
* BtnWest: User clicked West &lt;br /&gt;
* . . . &lt;br /&gt;
* TimeTick: A unit of time passed (s &lt;br /&gt;
* RocketTouchedEastWall: Rocket arrived at east wall&lt;br /&gt;
* RocketAwayFromEastWall: Rocket departed from east wall&lt;br /&gt;
* . . . &lt;br /&gt;
* TouchDown: Rocket touched launch pad and is aligned with it&lt;br /&gt;
* Missed: Rocket reached or passed launch pad without being aligned with it&lt;br /&gt;
&lt;br /&gt;
== Actuator Events &lt;br /&gt;
* RocketWest: Request to redraw rocket 10 pixels further to the west&lt;br /&gt;
* RocketEast: Request to redraw rocket 10 pixels further to the east&lt;br /&gt;
* RocketDown: Request to redraw rocket 10 pixels down &lt;br /&gt;
* PadWest: The application wishes the pad to move 10 pixels further to the west&lt;br /&gt;
* . . . &lt;br /&gt;
* DisplayWin: The application determined that the player won&lt;br /&gt;
* DisplayLose: The application determined that the player lost &lt;br /&gt;
&lt;br /&gt;
== The B-threads == &lt;br /&gt;
Actuator &amp;amp; GameOver &amp;amp; The application determined that the game should be stopped \\&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T11:03:49Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Incremental Development Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads: &lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location: &lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T11:02:49Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Incremental Development Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T11:02:09Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Incremental Development Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
6cSqPGvRWw0 &lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:52:27Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Detailed Example: Wall Painting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:50:15Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Detailed Example: Wall Painting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator (see link to a movie below). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:49:31Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Detailed Example: Wall Painting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:47:30Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Basic Composite Behavior */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:47:18Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Basic Composite Behavior */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting = &lt;br /&gt;
The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:43:33Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Helicopter Flight Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior = &lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by two independent concurrent LSCs - one directs the helicopter through a rectangular flight path without changing altitude, while the other directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down. &lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting = &lt;br /&gt;
The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-28T10:14:51Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Helicopter Flight Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Example =&lt;br /&gt;
This example demonstrates the control of a toy helicopter. The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The detailed example below is based on a simulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Flight_of_a_flock_of_birds</id>
		<title>Flight of a flock of birds</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Flight_of_a_flock_of_birds"/>
				<updated>2014-04-28T10:05:01Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Requirements - from each bird */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulating Flight of a Flock of Birds =&lt;br /&gt;
In this example we simulate the flight of a flock of birds, with each bird having a simple set of rules implemented as b-threads.&lt;br /&gt;
The example highlights&lt;br /&gt;
* Multi-agent activity&lt;br /&gt;
* Emergent group behaviors - emanating from individual agent behavior&lt;br /&gt;
* Implementation of animation with BPJ - and handling of associated design issues.&lt;br /&gt;
* [http://www.wisdom.weizmann.ac.il/~bprogram/videos/flock25Gather.avi  Movie: 25 birds gathering and flying]&lt;br /&gt;
* [http://www.wisdom.weizmann.ac.il/~bprogram/videos/flockScare.mp4 Movie: Birds disperse in reaction to a &amp;quot;scare&amp;quot; action]&lt;br /&gt;
&lt;br /&gt;
= Requirements - from each bird =&lt;br /&gt;
* Always try to move towards the center of the flock&lt;br /&gt;
* Always avoid colliding with other birds&lt;br /&gt;
* When getting close to a wall - change direction - in the same &amp;quot;reflection&amp;quot; angle&lt;br /&gt;
* When the &amp;quot;Scare&amp;quot; button is hit - fly away from the center of the flock.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Flock.zip | here]] to download the flock of birds example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The flock of birds example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2014-04-28T10:01:31Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Advanced Topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ User Guide=&lt;br /&gt;
&lt;br /&gt;
*[[Download|Downloading, installing and configuring the BPJ library, related tools and examples]]&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~bprogram/pres/BPintroduction.pdf A slide presentation: a general introduction to behavioral programming]&lt;br /&gt;
*[[The BPJ Library|The BPJ library: about b-threads, events, b-programs, etc.]]&lt;br /&gt;
*[[Dynamic b-threads|Symbolic and dynamic and b-threads]]&lt;br /&gt;
*[[TraceVis|Tracing and visualizing behavioral Java programs with TraceVis]]&lt;br /&gt;
*[[BPJ Model Checking|Verifying your application with the BPJ model checking]]&lt;br /&gt;
*[[BPJ Programming Examples | BPJ Programming Examples]]&lt;br /&gt;
&lt;br /&gt;
= Advanced Topics =&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~amarron/FuzzIeee12.pdf Using BPJ for hybrid fuzzy control with BFUZ].&lt;br /&gt;
*[[Z3BP|Working with Z3 Theorem Prover / SMT Solver]]&lt;br /&gt;
*[[Learning | Adaptive Behavioral Programming]]&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Z3BP</id>
		<title>Z3BP</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Z3BP"/>
				<updated>2014-04-28T10:01:04Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Verifying your application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying behavioral programs with the Z3 Theorem Prover / SMT Solver =&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
* See [http://www.wisdom.weizmann.ac.il/~bprogram/emsoft13 reference materials ]&lt;br /&gt;
* Required Environment: Windows 7, Eclipse.&lt;br /&gt;
* Install latest version of Z3 from Z3 Web Site (at the time of writing this page the version is 4.1). Note that the software is under a Microsoft Research folder.&lt;br /&gt;
* Install Python version 2.7.3 from Python web site. Presently the latest version of Z3 does not support the latest version of Python version. The following instructions assume that you have installed Python into C:\Python27\ on your computer.&lt;br /&gt;
* Install PyDev from Pydev web site as follows: find and copy the link for PyDev Eclipse plugin. Open Eclipse. Click &amp;quot;help&amp;quot; and &amp;quot;install new software&amp;quot;. Add the plugin location and install. During installation check and approve the certificate trust.&lt;br /&gt;
* Create a Z3 project. Eclipse -&amp;gt; &amp;quot;file&amp;quot; -&amp;gt; &amp;quot;import project&amp;quot; -&amp;gt;  &amp;quot;general&amp;quot; -&amp;gt;  &amp;quot;existing  project into workspace&amp;quot; (do not copy into workspace). The project will be marked red.&lt;br /&gt;
* Define Interpreter: In Eclipse, open PyDev perspective, right click on the project, select &amp;quot;properties&amp;quot; and then &amp;quot;python interpreter&amp;quot;. Define as   C:\Python27\python.exe.&lt;br /&gt;
* Define PYTHONPATH: In Eclipse: Select &amp;quot;Window&amp;quot; -&amp;gt; &amp;quot;Preferences&amp;quot; -&amp;gt; &amp;quot;PyDev&amp;quot; -&amp;gt; &amp;quot;Interpreter PYTHON&amp;quot;   -&amp;gt; &amp;quot;PYTHONPATH&amp;quot; -&amp;gt; &amp;quot;New Folder&amp;quot;. Add to  the Python path the Python folder within Z3, e.g., C:\Program Files (x86)\Microsoft Research\Z3-4.1\python.&lt;br /&gt;
* Define Windows Path: Add to windows system path variable the bin folder of z3 C:\Program Files (x86)\Microsoft Research\Z3-4.1\bin.&lt;br /&gt;
* Change appearance: In Eclipse, select &amp;quot;Window&amp;quot; -&amp;gt; &amp;quot;Preferences&amp;quot; -&amp;gt; &amp;quot;PyDev&amp;quot;  -&amp;gt; &amp;quot;Editor&amp;quot; (click on it)  -&amp;gt;  &amp;quot;Aptana themes&amp;quot; -&amp;gt; &amp;quot;Eclipse&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Verifying your application ==&lt;br /&gt;
* See Z3 information for Z3 syntax and its Python interface.&lt;br /&gt;
* See examples in the provided project how to define b-thread properties.&lt;br /&gt;
* Modify the example, introducing new b-thread properties, but preserving BP composition properties.&lt;br /&gt;
* Run the model.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-27T19:33:46Z</updated>
		
		<summary type="html">&lt;p&gt;Assaf: /* Incremental Development Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Example =&lt;br /&gt;
This example demonstrates the control of a toy helicopter. The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
[http://www.wisdom.weizmann.ac.il/~bprogram/videos/WallPainting.mp4 Movie: Incremental development of the wall painting application]&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>Assaf</name></author>	</entry>

	</feed>