Running a 2D model in TRIK Studio from Sublime Text
This article discusses setting up and using the Sublime Text external programming environment to call programs in the TRIK Studio 2D model.
This will allow experienced TRIK Studio users to use all the features of professional text editors and their plugins: static analyzers, auto formatters, color themes.
It also describes how to automatically run the program on several fields, which can be useful for participants in competitions with automated verification systems.
It is assumed that the user is writing a program in an external editor and would like to run this program on one or more fields. Fields can be presented both in the
.xmlformat (more details in the article "2D model tuning"), and in the
- 1.Download run_2d_model.cmd file for Windows or run_2d_model.sh for Linux and place it in the folder where TRIK Studio is installed.
- 2.Place the fields on which you want to test the program in a separate folder. If the fields are in
.xmlformat, create an empty
default.qrsproject in this folder.
The instruction was tested on Sublime Text 3 (Build 3211). You can download Sublime Text on the official website.
1. Open Sublime Text.
Tools → Build System → New Build System.
3. A window with a text file will open. You need to erase everything in it and paste the following code instead, where
<path to field dir>is the full path to the folder with the fields:
"cmd": ["D:\\TRIKStudio\\run_2d_model.cmd", “<path to fields dir>”, "$file"],
4. Edit this file:
- For Linux, substitute your path to the
run_2d_model.shfile instead of the one specified in the code. For example:
"cmd": ["/home/admin/TRIKStudio/run_2d_model.sh", “/home/admin/fields/”, "$file"]
- For Windows, substitute your path to the
run_2d_model.cmdfile instead of the one specified in the code. For example:
"cmd": ["D:\TRIKStudio\run_2d_model.cmd", "D:\Users\Admin\fields", "$file"]
5. Save this text file in the suggested directory
<system folder>\Sublime Text 3\Packages\Userunder the name
6. Open your source code in Sublime Text. To launch it, just click
Tools → Buildor the corresponding key combination (Ctrl + B).
For the proposal to add this functionality, the TRIK project team thanks Alexander Zhuravlev, the participant of the NTI IRS Olympiad 2018-2020.