Casino Game Tutorial
Learn Pulse basics by creating a simple process.
In this tutorial, you will create an application template that generates a random number between one and six via a python script.
You will create a process involving the previously created generic task and import an in task from the library. You will modify the generic task to add a user input variable and connect it to the if task so it can determine if you have won or lost.
Before you begin the tutorial, download the Pulse folder with the tutorial materials.
Create Dice
-
Define the Library.
- From the menu bar, select to select the pulse folder as the library.
-
Create an application template.
-
Link the script to Pulse using script editor.
-
Define the output in the Block Diagram.
-
Execute a task.
- From the Author ribbon, Execute group, click the Run tool.
Note: The variable value changes each time the task is run. -
Export a task to library.
Create Game
- From the Tasks folder inside the Library, drag-and-drop the Dice generic task into the work area.
-
From the Tasks folder inside the Library, drag-and-drop the Equals If task into
the Block Diagram.
Note: The If task evaluates if user input a and user input b are equal. This can be viewed in the logical condition.
-
Connect tasks.
-
Modify Widget.
-
Connect tasks.
- From the Tasks folder inside the Library, drag-and-drop the Win and Lose tasks into the work area.
- In the Block Diagram, connect the output ports of Equals to the input ports of Win and Lose.
Figure 6.
-
Execute process.
The values are updated in the Variable Browser.
-
Export the process to library.