Tutorial Project. Release 12

From wiki.visual-prolog.com

Jump to: navigation, search

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

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

Game Rules ...

Contents

Goal

The Release 11 projects family had the game dimension problem - the overloading of the call stack on some values of the multiplication TheSizeOfTheBoard*AmountOfRounds and appropriate breakdown of the application. The purpose of the Release 12 is to solve the game dimension problem.

Functionality

No Changes

Code

  • Tested with Visual Prolog 7.3 build 7302.
  • The set of projects
    • The only projects ObjectConsole and ObjectWin presented in the Release12. The set of projects doesn't contain projects Console, ConsoleLib, ObjectConsoleLib. These projects will not be supported in the future.
    • The Project ObjectWin contains now three variants ObjectWin0, ObjectWin1, ObjectWin2. These variants show the phases of the modification of the code.
    • The Projects ObjectWinLibX correspond to projects ObjectWinX, but the HumanInterface is represented as library.
    • The project ObjectConsole contains the only final solutions. The purpose of the project ObjectConsole is testing and compatibility check.
    • The test model of the player added

The only purpose of the creation of the model of the player Computer00 is to simulate the behavior of the application on the large amount of moves, which players make.

Some Explanations:

Project Description
ObjectWin0/Polyline12_ObjWindows The code of the class SeniourJudge is modified to make it clear the of the interaction of players and the class JuniourJudge. The player model Computer00 added. The Player Computer00 makes always the same special move. The class JuniourJudge recognizes this special move, doesn't show it on the board and informs the SeniourJudge about move occurrence. Thus the next move may be done. The maximal amount of moves is defined by the constant playLimit_C in the class JuniourJudge. The problem appears when playLimit_C=10000.
ObjectWin1/Polyline12_ObjWindows The first step of the modification of the code to solve the problem. The recursive mechanism of the organization of moves is replaced by the iterative mechanism. The application works stable when playLimit_C=100000. The multigame mode and the interruption process is not modified correctly.
ObjectWin2/Polyline12_ObjWindows The final version. All modes can run correctly. Test player Computer00 can play, when playLimit_C=100000.

Install

If you have VipSpbSDK, then you will find all projects in the directory Examples\Polyline\Polyline12\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:

  • Programs\ObjectConsole\Polyline12_ObjConsole.prj6
  • Programs\ObjectWin0\Polyline12_ObjWindows.prj6
  • Programs\ObjectWin1\Polyline12_ObjWindows.prj6
  • ProgramsDir\ObjectWin2\Polyline12_ObjWindows.prj6

Run command file Programs\BuildHumanInterfaceLib.cmd

Open and build projects (if needed):

  • Programs\ObjectWinLib0\Polyline12_ObjWindows.prj6
  • Programs\ObjectWinLib1\Polyline12_ObjWindows.prj6
  • Programs\ObjectWinLib2\Polyline12_ObjWindows.prj6

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

  • Player Computer00 may be involved as the single player and must be assigned as the Starter.
  • 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...
Personal tools
In other languages