# Tic-Tac-Toe

Let's consider an example of a robot that runs a game of tic-tac-toe implemented on Sherpa Robot.

The robot project consists of six diagrams. To describe it step by step, this robot works as follows:

1. It starts the game by offering to choose a symbol that the user will play with.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcGD7I4VCwXOIVc5PMM6KozNHuaS8Kb0LosBpSs33u5IB89ZYzLAX3Jp8TKkSVN9Wac0jlEzZh_JInf2Vkpq2aU2k1M9NbGW7uEfT6W5qJEXSb7wFX9WNaqAHPoyDjtbUMhxXGSkg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

2. It opens the game board, after which the user and the computer take turns selecting a cell to make a move.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdwKr3tkiXq8CVbjJgqzOSffJeBt1STul-vs5QwL9fJL9gi8zwBqdrCuZvU0TqS03NruHAvgumIrGOX16HTQKpZeLKKqg16dREc1VPGU-LB0-2YGAvQQUmIvTYnKsSL3sNJdfuMnQ?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

3. In case the user wins, it displays a window with a message about it.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc7Mxcz3VCswuBwv-RcPDEng1qsshmrBdxnxhLIXMDGo2QZDgY1vfDLk5LTIW-4E5CNotknwlZChOFKMiOehtVeDh6rv5NTdKUFgbmfPndRVek6gHqEz4SRjDFAp4Y0HAuMQaHW_Q?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

The main diagram of the project is called "TicTacToe" and looks like this (for convenience, the blocks of the diagram are numbered):

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf18SaDH552gEsXQvmBqhIcrw65NW6KDljR4NM8C4YLfIlUX0dda0cPebtQXHOYzxN4D6uW2Fy-ImlCpLHrbN-QDuK4dGUPHJ0_qkT7yDgMC2WeCMdibXiZcjaNnhRttpFEiidsEg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

1. **Block "Start"** (any diagram starts from this block).
2. **Block "Get Path"** allows you to find out the full path to the file. The following properties are specified for this block:

* File name (file name);
* Generate name (if the flag is set, a random file name will be generated, including the extension).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeqoscEXVmxeWC6UsE9SAx1q8utQ-aFgqmAHMte70_NtN8rONyIpaT-BgSZTmfjzwX2j4I9Iu-vouw4J2TitNFbz3ZzsmPXLOD-dtWFpqq8FJG-7ILnEZQ1FGDnFW35QXde1_-9?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

3. **Block "Get Path"** allows you to find out the full path to the file. The following properties are specified for this block:

* File name (file name);
* Generate name (if the flag is set, a random file name will be generated, including the extension).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdAYKpoL4iuDH--fZvseYmKEebB_tMXosKfYJsJGrL7YrodP1oG-an3pJ2wfFiohXFcuutN063QP2_InA4TKHDefnONxX0huLzzVTszorqtWWMyhi1Ta5Ro0QsTuaebvpc0Yct-?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

4. **Block "Show Window"** allows you to create your own windows (forms) and display them in modal and non-modal mode, including asynchronously relative to the flow of the script. If a selector is specified, the coordinates of the created window will be bound to a control element in another application. The following properties are specified for this block:

* Configuration (configuration string);
* Window object (variable with the window object);
* Modal (if the flag is set, the window will be shown as modal);
* Process ID (variable that stores the process identifier).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdC1ciF21txiUHWdW_QXMNCLCwwb8N3vG72_FTJFKhJz8Z8n14-QddBS3lW-JGPPIQMpmv951hu5hrXOZJzFUYlRKDcbRMUD3hZUtKwxZFT7gYBq2vXtQczn8vpf2aHykjuV-q-?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

To create and edit the window, the "Edit..." button located in the block is used. When this button is pressed, the "[Window Editor](https://docs.sherparpa.ru/en/sherpa-rpa/sherpa-designer/rabota-v-sherpa-designer/osnovnoe-menyu/panel-razrabotka/menyu-dopolnitelno/redaktor-okon)" opens.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfoNIdYzd3rA8EtB8PzZ6ZpR3ThxUovLmWudzCurx7dJRtjQ3nxUQrnSwe_z5GmIU-0rpVx2AZExbSVjbje53WyVX4toIO5nJld4oMxeQpKK8VPXx746tFU1h7CsqozzHD7qNMFpw?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

5. **Block "Switch/Case"**. The switch operator compares the expression with the specified values and exits through the specified connector. If no matches are found, it exits through the "Default" connector. The following properties are specified for this block:

* Expression (the expression to compare);
* Condition 1 (if matched, it will exit through connector 1, and expression 1 will also be executed if specified. If the connector is not specified, the exit will be made by default);
* Execute expression 1 (if condition 1 is met, this expression will be executed and exit through the corresponding connector. If the connector is not connected, the exit will be made by default);
* Condition 2 (if matched, it will exit through connector 2, and expression 2 will also be executed if specified. If the connector is not specified, the exit will be made by default);
* Execute expression 2 (if condition 2 is met, this expression will be executed and exit through the corresponding connector. If the connector is not connected, the exit will be made by default);

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeYWfNurXMOyfAarm85dIa3vQnFa-d1zcUjsssxHsT53uAd7TGi9jSeyyHsvAQxonEwxAc5Ju00Fd8id0jECMim2ZrgKd3cchrch4odoJoGRxFdB75mYsNPWQk97kNZA5keeVo9VA?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

6. **Block "Assign Value to Variable"** sets new values for one or more variables. In this case, one value is specified in the properties that needs to be assigned to one variable, respectively.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXePfUen2D_5epkkpriBctr_go5a7nLOz54FzKWPsU8sYf55LX3XBv_TuBif7Gfeam1vQtWm-4aEOIHlSqE5cYWIfvapFPEgfUMDXdkveaCKUvyp9_0aav4RcSMbpHenvwt2It2fpQ?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

7. **Block "Process"** allows you to create scenarios consisting of multiple diagrams. The execution of the scenario will continue from the "Start" block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the "End" block is reached in the external diagram. For the "Process" block, the property "Diagram Name" is specified (the file name of the diagram where the scenario will continue execution).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeA5LwUHPpv55WZkC15R0wWLftaTKt8yqKrmCUgm-oZ8Wi0Q-uKQGfdvWQVj_MhhDyXEjX1bgGnhW17JWXDQ_IBb8fyPjOpO8kWi7CEqq5KNId7NveUeeFL0TaGnyvf_OeS_yMvsg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

8. **Block "Condition"** checks the specified condition for truth, after which the execution of the scenario continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of the variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is “Yes”, otherwise – the exit is “No”.

In this case, the condition is set as: $IsFinal. That is, it checks for the final.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdoaNwyxwik2eEAhB_JGb12YhAb1Q3WEjqvqR03J89tPNk38Q-2tdFJ3c7o9fMZRQw_T61PW1cZpIqYE_N3TkhM8w61lit5Au6unBwdr9eZtCsdOZYjFybHrTG6eh8xnYab5bUITg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

9. **Block "Process"** allows you to create scenarios consisting of multiple diagrams. The execution of the scenario will continue from the "Start" block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the "End" block is reached in the external diagram. For the "Process" block, the property "Diagram Name" is specified (the file name of the diagram where the scenario will continue execution).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfrvRVlhsLZrN90bppRvnPoqiTNlnaKy_i-_BmKmot5cljnauBac5dPMtK72JlNlFWOggy5PyYCt9fx5Qs2p4alTDY0JqVX96Ot0O67eXZUyB1UTmwGIT0fZAnKcmquLa_834n5?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

10. **Block "Condition"** checks the specified condition for truth, after which the execution of the scenario continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of the variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is “Yes”, otherwise – the exit is “No”. In this case, the condition is set as: $IsStepUser. That is, it checks for the player's turn.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXervXuw-7wfa3-sdFul5F2SuoMsnCJ7Fr0IuDYoSkdo_MmowmEaYnOwPKRZpgibPx2I8mhLc9IlaExJliEcA-LySpjJcpKpfUMyd05-cEvxS8QEqoWTlUGRYBv05O4iQHCUUpqC?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

11. **Block "Process"** allows you to create scenarios consisting of multiple diagrams. The execution of the scenario will continue from the "Start" block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the "End" block is reached in the external diagram. For the "Process" block, the property "Diagram Name" is specified (the file name of the diagram where the scenario will continue execution).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXddHDkXiXMJGUrl5BxWiqkt8Z54SuM1yYarJ-EKJdg-xPr0s0pH5UK1AT_a65tyInOFhfkrcgRXY-vfhrW1stcFSH9H5dMasLc6qngJzZzT-fJnPkXfavTIROCi-Voqh0pckHiJdQ?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

12. **Block "Process"** allows you to create scenarios consisting of multiple diagrams. The execution of the scenario will continue from the "Start" block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the "End" block is reached in the external diagram. For the "Process" block, the property "Diagram Name" is specified (the file name of the diagram where the scenario will continue execution).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXddHDkXiXMJGUrl5BxWiqkt8Z54SuM1yYarJ-EKJdg-xPr0s0pH5UK1AT_a65tyInOFhfkrcgRXY-vfhrW1stcFSH9H5dMasLc6qngJzZzT-fJnPkXfavTIROCi-Voqh0pckHiJdQ?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

13. **Block "Assign Value to Variable"** sets new values for one or more variables. In this case, one value is specified in the properties that needs to be assigned to one variable, respectively.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdXN7SMvYppUx6BXjFKG5i3IBhD4U2R_EcFaJ8D3oMjTJU2EsDRuXUPOidevc_-yJs-nCmyB473t9C86URLLccO94dwmW3bO2SODfVsA7Vb3GN7zLQW3J8zsC2-KZAhqSH5WJnM7g?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

14. – 15. **Blocks "End"** (these blocks complete the execution of the scenario or return the subprocess diagram to the main process).

**Diagram "Make Move"**

This diagram consists of pairs of "Condition" and "End" blocks. The "Make Move" diagram executes each subsequent move and checks for condition compliance.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc8gk2qGajWIr1Nw5xrr7jzxo2smpa-oRsgNAtLfbraaa0XARZyaaw4gUWRctRrOz-y_0OCSf6QO3Iwo1QSwNGVFsiq_jo-pyb_2VGjLN4oOGgjei8mMN4ONxT5AZfR1yjCjY7tow?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

**Diagram "Player's Turn"**

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-cb549cd6e701bae9055bf6bb4450aa102ba9bdcb%2F%D0%A5%D0%BE%D0%B4%D0%98%D0%B3%D1%80%D0%BE%D0%BA1.png?alt=media" alt=""><figcaption></figcaption></figure>

1. **Block "Start"** (any diagram starts from this block).
2. **Block "Show Window"** allows you to create your own windows (forms) and display them in modal and non-modal mode, including asynchronously relative to the flow of the script. If a selector is specified, the coordinates of the created window will be bound to a control element in another application. The following properties are specified for this block:

* Configuration (configuration string);
* Window object (variable with the window object);
* Process ID (variable that stores the process identifier).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdusoAzXULW57mVoWYCC3eiaskn-Egtz9sZ0tXMWR6mB4CLLHZmD7F189wg0-5QDj8_NoaAAHT1vJXwV488QK8GfUPIAXsLWKDX6-XGbu7fGzxPxa-sJQKaWtrZ8X8sqpB8HuRs0w?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

To create and edit the window, the "Edit..." button located in the block is used. When this button is pressed, the "Window Editor" opens.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcER_K2baWfUb8iOTGLAgcnJpAkqWyMMiLbo4hdlTq6XlDDPded6_gwUSgkdaOybetW7vF1Fd_jQ3S0yCUwu4MyGyY-AE-QaVcUSFrJto18rIooM_f6PU0lbERbMoeR0HGYQvxAjg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

3. **Block "Condition"** checks the specified condition for truth, after which the execution of the scenario continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of the variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is “Yes”, otherwise – the exit is “No”. In this case, the condition is set as: $ControlEvent -ne "linkStop.LinkClicked". That is, it checks that the "End Game" link has not been clicked.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf1lDXqw30eRN3lBC0gHrONjYW1GajlCjOH0MtI9hNb4C8sR-qCOeLK6sY4uYbqPY64LhXdpdJDMfwdIYWK0PtGYliMIxjfSJIOq_nWcWbAbt7SwctjUaD2-Nul3xDAwvavq5_KYg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

4. **Block "Process"** allows you to create scenarios consisting of multiple diagrams. The execution of the scenario will continue from the "Start" block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the "End" block is reached in the external diagram. The following properties are specified for this block:

* Diagram Name (the file name of the diagram where the scenario will continue execution);
* Variable 1 (the name of the first variable that needs to be assigned a new value);
* Value 1 (the new value of the first variable);
* Variable 2 (the name of the second variable that needs to be assigned a new value);
* Value 2 (the new value of the second variable).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXepDeOWbdQdwnh_X5kaPD1juuWm-4xrWijQqqt_uiBlX99C1BgPggVzDmHKBAQati7ob1b5lBbozaZLu_m3t5gwa3VyvUfd_r0iOcs00RhZKoL3FxVPxGC0dc9fV_V6WHBlJVAW?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

5. **Block "Condition"** checks the specified condition for truth, after which the execution of the scenario continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of the variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is “Yes”, otherwise – the exit is “No”. In this case, the condition is set as: $IsCorrectMove. That is, it checks the correctness of the player's move.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfOLhaiXpLy5r2zCIzznePrGNNQj787VhClzx-kWUhhguLS63odgcGSXis1lSdkm8Fc7rVu0aFFBaJAQYYenTq5u3zvMs-2pdEx6YIRHv7D9YYx05q3FGWe8_SfAmf4EEdbJxL7?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

6. **Block "Stop"** interrupts the execution of the scenario or generates an error.
7. **Block "End"** (this block completes the execution of the scenario or returns the subprocess diagram to the main process).

**Diagram "Computer's Move"**

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXerMFtAloxxwOwXQOW3NkaxHF-QOSdylq5mS3jJkRMzaPIqGHlM5y08AtjPBd-ZKjDcL0EJXttN_0ZJdm4l4OoVpr1-l3tZ4PLPp4RdRBUL8DuzUel8k5kp_DEbEP-t94O7M_4oKg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

1. **Block "Start"** (any diagram starts from this block).
2. **Block "Random Number"** generates random numbers with specified parameters. The following properties are specified for this block:

* Min. value (the random number will not be less than this value);
* Max. value (the random number will not be greater than this value);
* Step (the step of the random number).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd3MnPszQ4sCVrDLLDn9gg8U4yl5wkC4f62OtSzmWVDOihPiMiV2AGeaUOaUVbYwulLJrZt5vtRw2avchNhhE3O6gOI6kcWPbP-sQZjHCHYdubC3goEsiCObgkaB3I4Zu4jxqHhOQ?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

3. **Block "Assign Value to Variable"** sets new values for one or more variables. In this case, one value is specified in the properties that needs to be assigned to one variable, respectively.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfE2Rd56Vk_PeLUHUD416RjJnbyOuBpb4w4rMVBHDQwqAeP9gTw_Pyj1Wfrl_HaUdbbZ-6SV05kpsDDBje7Z3UDUjAU0GqBrKbi-wZZvPFgxQRFzBMugoKFheodH5ZX9Zyd0Q6Z?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

4. **Block "Process"** allows you to create scenarios consisting of multiple diagrams. The execution of the scenario will continue from the "Start" block of the specified project diagram. The execution of the scenario will return to the current block and continue in the current diagram as soon as the "End" block is reached in the external diagram. The following properties are specified for this block:

* Diagram Name (the file name of the diagram where the scenario will continue execution);
* Variable 1 (the name of the first variable that needs to be assigned a new value);
* Value 1 (the new value of the first variable);
* Variable 2 (the name of the second variable that needs to be assigned a new value);
* Value 2 (the new value of the second variable).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcjlem_r8ny4HqWMMVbqok1_l_k-AGdykATARUr6rLVEoWejcCAOtnnrxouIcSGKqj0R8CHMshKSu3o2yq-VnK9cZYZUxUfKp-o8SXf2fr1qH67G1Vg12v-THtFDhw_sB0LkWEASg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

<br>

5. **Block "Condition"** checks the specified condition for truth, after which the execution of the scenario continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of the variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is “Yes”, otherwise – the exit is “No”. In this case, the condition is set as: $IsCorrectMove. That is, it checks the correctness of the player's move.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfp-DNjBmoYKXHDXNOj3B8mzkXXl5EVF6c_zTkHlmdeYje72A8D3kKsgNehOMHTxQDuIA809USTEceGzAvbpMe6bKDdc6QjaZIqUKfVxODVtzu6qBDcVM6iQNODRYoLnUBNqlbrUg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

6. **Block "End"** (this block completes the execution of the scenario or returns the subprocess diagram to the main process).

**Diagram "Check for Final"**

This diagram consists of pairs of "Condition" and "Assign Value to Variable" blocks. The "Check for Final" diagram performs a check after each move by the player or the computer.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeU-mLT0RT44FkTpX-hRFOPlvoooP7R_iUlvapgopTBToIirz2Drzzr-Sm8tVSSdhHtlUt-10_YCsSMEkHsyHnhWmqlCkRfwDMW067Ak3pfUFqcnAuTtU12EzLKsSsvd4ogrnmZQQ?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

<br>

**Diagram "Game Over"**

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdNuaCa03qLf6tNJaj2ehSbmUfSO1-dMhwpTX8rygElb2AsfZDC3576qARUBqvEEH2d0QleLai4TFv7XVkeeriEEErZsGZKQdUOmXe0VWmiy-BLIf-dlAjvmo8yYfgoLDpCTkZUCg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

1. **Block "Start"** (any diagram starts from this block).
2. **Block "Show Window"** allows you to create your own windows (forms) and display them in modal and non-modal mode, including asynchronously relative to the flow of the script. If a selector is specified, the coordinates of the created window will be bound to a control element in another application. The following properties are specified for this block:

* Configuration (configuration string);
* Window object (variable with the window object);
* Modal (if the flag is set, the window will be shown as modal);
* Process ID (variable that stores the process identifier).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfEkV91ynbheNtmDoTRzkdt4eLNCbLGPUXluKxwK0NoK8d3hMrsIPWDOV8zg9ms-mZWk-0-rPWuLVaIm657AatKylrtzBIxs-mYl_QftfxZUSDUl_XeRkdNuMtz1-TS4OeyB97nSg?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

To create and edit the window, the "Edit..." button located in the block is used. When this button is pressed, the "Window Editor" opens.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfC_b9lskCt5R8o_tajztewaoyjtlPWYOyh2IgJXtvHvUQR7WblAfYMO82rqRoO3r00r-TN7o81hZLehF4FICtU7wRY_X3NOUjy3iT2Bm5Lli9fDOFbz5YjCHF1wrh9EeObfZ0Gww?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

3. **Block "Condition"** checks the specified condition for truth, after which the execution of the scenario continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: “variable” equals (==)/ greater than (>)/ less than (<) “value”.

For example: $a == “Hello”, that is, if the value of the variable $a is equal to “Hello”, then the exit is “Yes”, otherwise – the exit is “No”.

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is “Yes”, otherwise – the exit is “No”. In this case, the condition is specified as: $UserWon. That is, it checks whether the player has won.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcUW3qCe_jrjybivhgtbvQA8uS5yRa8etRIxBcUHT-a3A68LCTDlDKqDBhFOvJkmb6ZmcIPES8vJmsNuvCDHpSvnzJGNUn_tyGZQdtjFwCX9y50wfmKBVPKiwoNByTemWJRHT_x9Q?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

4. **Block "Message Window"** shows the user a modal dialog window with a specified title, text, and set of buttons. If a window with multiple buttons is used, the block allows you to write to a variable the text constant corresponding to the button pressed by the user. The following properties are specified for this block:

* Message (the text that will be displayed inside the dialog window);
* Buttons (the buttons that will be available for the user to press).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcNJ2CuS4uMoH__MroPin5PuFvUtoYaA0ZtQvo1UH5fzEyJ2p0sKKXmYPTE3BDX34GH9dSQ_J8LsDbX9t0N69OV2AqIy_EzujjaDpbJ4yBiO0iBUmLtGs9IGyXfRuTrGjo5M3Wl?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

5. The "Message Window" block shows the user a modal dialog window with a specified title, text, and set of buttons. If a window with multiple buttons is used, the block allows you to write to a variable the text constant corresponding to the button pressed by the user. The following properties are specified for this block:

* Message (the text that will be displayed inside the dialog window);
* Buttons (the buttons that will be available for the user to press).

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc_E6Yi_mrjKkApFIXseb5l0Z8ENSH-atYtQtFfAVG2MAB2ilr_DLlSBKsnuRHuWrudU1uxKX4OHKVu38h_jZkA1hppF_k7oI9UQjQijk4YqJohP5DVC0dT2HWSYcfSueKi3I5Xiw?key=8OqHXqKR2hFCRM0MvJDUmXXN" alt=""><figcaption></figcaption></figure>

6. – 7. **Blocks "End"** (these blocks complete the execution of the scenario or return the subprocess diagram to the main process).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sherparpa.ru/en/sherpa-rpa/sherpa-designer/primery-robotov/krestiki-noliki.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
