page_title: DRAKON
section_title: advanceStep
hierarchical_section_title: DRAKON / Examples of programming in DRAKON language / advanceStep
caption_attribution_description: English: An example of a program in DRAKON-JavaScript that shows the core logic of the Tetris game.
context_page_description: DRAKON is an algorithmic visual programming and modeling language developed within the Buran space project following ergonomic design principles. The language provides a uniform way to represent flowcharts of any complexity that are easy to read and understand.
  The DRAKON Editor, which was released in September 2011, is an implementation of the language available in the public domain. It can be used for creating documentation, or for creating visual programs that can be converted to source code in other languages.
  Unlike UML's philosophy, DRAKON's language philosophy is based on being augmented if needed, by using a hybrid language, which can be illustrated as "incrustating code snippets from text language used into shape DRAKON requires". This way, DRAKON always remains a simple visual language that can be used as an augmentation for a programmer who is interested in making their own project code easier to support or other long-term needs for example improving the ergonomics of the coding process or to making code easier to review and understand.
context_section_description: The advanceStep function implements the core logic of the game. advanceStep is a state machine represented as a decision tree. The game engine calls advanceStep periodically. This state machine has three states "playing", "dropping", and "finished". The game takes different actions depending on the current state. For example, in the "playing" state, when there is a falling projectile and the projectile can move down, it is moved down one step.
  With DRAKON, the reader of the algorithm can visually trace all possible paths in the decision tree.
caption: The core logic of the Tetris game in DRAKON-JavaScript language
exif: {}