Chainer

Program to run three games by Nikhil (Y9, Age ~14)

Introduction

Nikhil had the excellent idea of running a compendium of games from a single program. Compile the three programs (Nikhil's GoalQuest and MazePlus and Neil's Roller) and put the full pathname of each executable into the code. We put them all in the folder D:\games to make this code work for us.

The Program

program Chainer;
{
    Copyright (c) 2013 Nikhil
    
    Licensed under the Apache License, Version 2.0 (the "License"); you may not 
    use this file except in compliance with the License, as described at
    http://www.apache.org/licenses/ and http://www.pp4s.co.uk/licenses/
}

{$mode objfpc}{$H+}

uses
 SysUtils, Crt, process;

procedure openmaze;
var
  Proc : TProcess;
begin
  Proc := TProcess.Create(nil);
  try
    Proc.CommandLine := 'D:\games\MazePlus.exe';
    PRoc.Options := Proc.Options + [poWaitOnExit];
    PRoc.Execute;
  finally
    Proc.free;
  end;
end;

procedure openquest;
var
  Proc : TProcess;
begin
  Proc := TProcess.Create(nil);
  try
    Proc.CommandLine := 'D:\games\GoalQuest.exe';
    PRoc.Options := Proc.Options + [poWaitOnExit];
    PRoc.Execute;
  finally
    Proc.free;
  end;
end;

procedure openroller;
var
  Proc : TProcess;
begin
  Proc := TProcess.Create(nil);
  try
    Proc.CommandLine := 'D:\games\Roller.exe';
    PRoc.Options := Proc.Options + [poWaitOnExit];
    PRoc.Execute;
  finally
    Proc.free;
  end;
end;

begin
   textColor(yellow);
   textBackground(cyan);
   clrscr;
   writeln('Hi');
   writeln('There are three games.');
   writeln('The first game will come in a new window.');
   writeln('You must close it once you''re finished.');
   writeln('It is made by Neil and IS NOT mine!');
   writeln('The second and third are by me and ARE mine!');
   writeln('ENJOY!!');
   readln;
   openroller;
   openmaze;
   openquest;
end.

Remarks

Could you write a program to run your games in succession?

Programming - a skill for life!

Three programs including MazePlus by Nikhil