Tutorial Project. Release 11

From wiki.visual-prolog.com

Written by Victor Yukhtenko. Email: victor@pdc.spb.su

The programs listed below are part of the Evolutions Tutorial Project article.

Game Rules ...

Goal

Demonstrate the basic approaches of the VIP-based programming:

  • The difference in the traditional Console and object-oriented approach (ObjectConsole and GUI);
  • Creation of Vip-based libraries;
  • The strong separation of the User Interface and logical part.

Functionality

Picture Description Details Video
ConsoleSmall.jpg LineByLine User Interaction scenario organization. Ordinary Console strategy.

Multilingual support.

No details Download and see Movie... (Zip archive 640 Kb)
ObjectConsoleSmall.jpg Object-oriented Console. Based on interface components like PushButton, EditConrol etc., mouse based handling User-centered interaction.

Built on the PFC/Console. The concept is similar to PFC/GUI, including the event driven organization.

No multilingual support.

More Details ... Download and see Movie... (Zip archive 2.33 Mb)
ObjectWinSmall.jpg Windows-based User Interface. PFC/GUI concept used.

No multilingual support.

No details Download and see Movie... (Zip archive 2.9 Mb)

Known problem

After some value of the multiplication board size*amount of games in the serial games the application disappears. The reason is explained in the ‘’’Code’’’.

This problem is fixed in the release 12.

Code

  • Tested with Visual Prolog 7.3 build 7302.
  • Release 11 is the set of projects, which has the same game logic organization, but differs by the User Interface type - Соnsole, ObjectConsole, Windows.
  • The use of VIP-based libraries.
    • Some components are represented as the source code (.PRO) and some represented as libraries (.LIB). Alternative projects presented.
    • To build libraries the application lib (Microsoft Linker Stub 7.10.3077) has been used.
  • Logic and UI strongly separated
    • In all projects of the Release 11 the code, representing the logic and the code representing the User Interface are strongly separated.
    • All Projects of the Release 11 family use the common set of classes, which supports the logic of the game, configuration settings and the game managing.
    • Each project uses its own concept of the User Interface. It makes the possibility to create other user interface implementations and to use other UI concepts based say on HTML or XML. It is possible even to use other programming languages to create User Interface.
  • ’’’Universality.’’’ The structure of the code of the common used logical part gives the possibility to use the logical part with no change to organize the set of similar flat games. The only one JuniourJudge module must be replaced by the module with the same class name and interface and with the new rules support. The new concepts of models of players must be created accordingly.
  • ’’’Known problem.’’’ The Release 11 set of projects has been grown on the basis of Release 10 project. The interaction between players is organized as the hidden (deeply recursive) process, where the tail recursion demand is not fulfilled. Because of this reason after some value of the multiplication board size*amount of games in the serial games the call stack is overloaded and the application disappears. This problem is fixed in the release 12.

Install

If you have ‘’’VipSpbSDK’’’, then you will find all projects in the directory Examples\Polyline\Polyline11\Programs

To get the full set of projects of the series of the Polyline projects, please download archives using links at PDC forum:

  • VipSpbSDK_PE_73_Examples_Polyline_1_14.zip
  • VipSpbSDK_PE_73_Tools_Polyline_1_14.zip]

to any convenient directory. The directory named VipSpbSDK will be created automatically.

Building

’’’Please, see first your version specialty’’’ Open and build projects:

  • Polyline11_Console - console application
  • Polyline11_ObjectConsole object-oriented console
  • Polyline11_ObjWindows - Windows PFC/GUI

Run the command file Programs\BuildHumanInterfaceLib.cmd Open and build projects:

  • Polyline11_ConsoleLib - the same but the User Interface placed to the library
  • Polyline11_ObjectConsoleLib - the same but the User Interface placed to the library
  • Polyline11_ObjWindowsLib - Windows PFC/GUI, the User Interface placed to the library

To build projects the IDE variable SpbSolutions must be set to the VipSpbSDK directory.

The complex building

To simplify the settings and initial building of applicaions the Build.cmd command file included (BuildPersonal.cmd - please see details in Polyline Version Reference or in Examples\Polyline\VersionReference.html).

The use of Build.cmd file:

  • sets the SpbSolutions IDE variable, which refers to the VipSpb SDK directory;
  • "knows" where Visual Prolog is installed and uses VipBuilder.exe;
  • builds all projects containing in the subfolders;
  • builds all needed libraries;
  • registers all pzl-Components (if needed);
  • informs regarding the result of each building operation;
  • Build.cmd file may be used together with the Visual Prolog CE only (please see details in Polyline Version Reference or in Examples\Polyline\VersionReference.html).

Run

  • Run the application using the E of the IDE or run the executable at the directory EXE.
  • The language of the application may be defined in the command line by the language identifier:
    • en - English
    • ru - Russian
  • When running the program from the IDE, the parameter of the language must be placed to the field "Project Settings"\Run Options\Run Arguments, available from menu Project\Settings...