+
Point of view
All features
class PYRAMID
Summary
Solving the problem of the Pyramid for small pyramid only.
This program uses the back-tracking method. Its goal is to try to fill a pyramid by making a subtraction between two successive columns and to take its absolute value. The result is put on the next line. Example:
 6   14   15   3   13
   8    1   12  10
      7   11   2
        4    9
           5
See also pyramid2, which run faster than this first solution.
Direct parents
Insert list: ARGUMENTS
Overview
Creation features
{ANY}
Features
{ANY}
{}
{ANY}
{}
Implementation of ARGUMENTS (do not use directly):
{}
size: INTEGER_32
writable attribute
{ANY}
make
effective procedure
{ANY}
effective function
{ANY}
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
require
  • locked: tagged_out_locked
ensure
  • still_locked: tagged_out_locked
  • not_cleared: tagged_out_memory.count >= old tagged_out_memory.count
  • append_only: old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
belongs_to (nb: INTEGER_32): BOOLEAN
effective function
{ANY}
require
  • too_small: nb >= 1
  • too_large: nb <= max
propagate (col: INTEGER_32, val_column_1: INTEGER_32): BOOLEAN
effective function
{ANY}
require
  • val_column_1.in_range(1, max)
  • col.in_range(1, size)
fill_up (col: INTEGER_32): BOOLEAN
effective function
{ANY}
require
  • col >= 1
writable attribute
{}
case_vide: INTEGER_32
is 0
constant attribute
{}
biggest_one: INTEGER_32
is 10
constant attribute
{}
indice (lig: INTEGER_32, col: INTEGER_32): INTEGER_32
effective function
{}
require
  • lig_trop_petit: lig >= 1
  • lig_trop_grand: lig <= size
  • col_trop_petit: col >= 1
  • col_trop_grand: col <= size
ensure
  • Result >= 1
  • Result <= max
clear_column (col: INTEGER_32)
effective procedure
{}
require
  • col >= 1
  • col <= size
argument_count: INTEGER_32
effective function
{ANY}
Number of arguments given to command that started system execution (command name does not count).
ensure
  • Result >= 0
argument (i: INTEGER_32): STRING
effective function
{ANY}
i th argument of command that started system execution Gives the command name if i is 0.
require ensure
  • Result /= Void
command_name: STRING
effective function
{ANY}
command_arguments: FAST_ARRAY[STRING]
frozen
once function
{}
Give access to arguments command line including the command name at index 0.
This is a once function, so you can modify command-line arguments! (NOTE: just be sure not to remove the first argument, although you may change it)
ensure
  • not Result.is_empty
se_argc: INTEGER_32
{}
To implement command_arguments
se_argv (i: INTEGER_32): STRING
{}
To implement command_arguments