ChristmasProg

by Mitchell Weiss: L6 Age ~16

Introduction

The user can select sequences of carefully constructed writeln statements to generate images that give the impression of decorating the Christmas tree. The result is effective.

The Program

Change Syntax Highlighting

program ChristmasProg;
{$APPTYPE CONSOLE}
{
    Copyright (c) 2010 Mitchell Weiss

    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/

    Formatting improved and minor changes made by PPS - March 2014
}

uses
  SysUtils;
var
  choice : char;
  choice1: char;
  choice2: char;
begin
  writeln('-------------------------------');
  writeln('|                             |');
  writeln('|This Is a Christmas Tree Game|');
  writeln('|                             |');
  writeln('-------------------------------');

  writeln('           /\                  ');
  writeln('          /~~\                 ');
  writeln('         /~~~~\                ');
  writeln('        /~~~~~~\               ');
  writeln('       /~~~~~~~~\              ');
  writeln('      /~~~~~~~~~~\             ');
  writeln('     /~~~~~~~~~~~~\            ');
  writeln('    /~~~~~~~~~~~~~~\           ');
  writeln('   /~~~~~~~~~~~~~~~~\          ');
  writeln('  /~~~~~~~~~~~~~~~~~~\         ');
  writeln('  --------|  |--------         ');
  writeln('          |  |                 ');
  writeln('          ----                 ');

  repeat
    writeln('To decorate your tree with ball-balls enter B');  //local slang for baubles?
    writeln('To decorate your tree with tinsel enter T');
    writeln('To put the star on top of the tree enter S');
    readln(choice);
    if choice = 'B' then
      begin
        writeln;
        writeln('Ball-Balls!');
        writeln;
        writeln('           /\                  ');
        writeln('          /~~\                 ');
        writeln('         /~~o~\                ');
        writeln('        /o~~~~~\               ');
        writeln('       /~~~~~~o~\              ');
        writeln('      /~~~~~o~~~~\             ');
        writeln('     /~~o~~~~~~~~~\            ');
        writeln('    /~~~~~o~~~~~o~~\           ');
        writeln('   /~o~~~~~~~~~~~~~~\          ');
        writeln('  /~~~~~~~~~o~~~~~~~~\         ');
        writeln('  --------|  |--------         ');
        writeln('          |  |                 ');
        writeln('          ----                 ');
      end;

    if choice = 'T' then
      begin
        writeln;
        writeln('Tinsel Time!');
        writeln;
        writeln('           /\                  ');
        writeln('          /~~\                 ');
        writeln('         /~~**\                ');
        writeln('        /~**~~~\               ');
        writeln('       /**~~~~**\              ');
        writeln('      /~~~~~**~~~\             ');
        writeln('     /~~~~**~~~~**\            ');
        writeln('    /~~**~~~~~**~~~\           ');
        writeln('   /**~~~~~~**~~~~~~\          ');
        writeln('  /~~~~~~~**~~~~~~~**\         ');
        writeln('  --------|  |--------         ');
        writeln('          |  |                 ');
        writeln('          ----                 ');
      end;

    if choice = 'S' then
      begin
        writeln;
        writeln('The Star!');
        writeln;
        writeln('           **                  ');
        writeln('          *  *                 ');
        writeln('           **                  ');
        writeln('           /\                  ');
        writeln('          /~~\                 ');
        writeln('         /~~~~\                ');
        writeln('        /~~~~~~\               ');
        writeln('       /~~~~~~~~\              ');
        writeln('      /~~~~~~~~~~\             ');
        writeln('     /~~~~~~~~~~~~\            ');
        writeln('    /~~~~~~~~~~~~~~\           ');
        writeln('   /~~~~~~~~~~~~~~~~\          ');
        writeln('  /~~~~~~~~~~~~~~~~~~\         ');
        writeln('  --------|  |--------         ');
        writeln('          |  |                 ');
        writeln('          ----                 ');
      end;
    writeln('To go to the next step enter N');
    readln(choice2);
  until choice2 = 'N';

  writeln('Now enter A to combine all 3!');
  readln(choice1);
  if choice1 = 'A' then
    begin
    writeln;
    writeln('Full Decorations!');
    writeln;
    writeln('           **                  ');
    writeln('          *  *                 ');
    writeln('           **                  ');
    writeln('           /\                  ');
    writeln('          /~~\                 ');
    writeln('         /o~**\                ');
    writeln('        /~**~o~\               ');
    writeln('       /**~~~~**\              ');
    writeln('      /~o~~~**o~~\             ');
    writeln('     /~~~~**~~~~~o\            ');
    writeln('    /~o~**~~~~~**~~\           ');
    writeln('   /~~**~~o~~**o~~**\          ');
    writeln('  /~**~~~~~**~~~**~~~\         ');
    writeln('  --------|  |--------         ');
    writeln('          |  |                 ');
    writeln('          ----                 ');
  end;
  readln;
end.

Remarks

Can you write a program using ASCII art?

Programming - a skill for life!

Student programs to inspire you!