Problem #1. Given the interface of the following ADT, as shown below, write a procedure almost_draw: boolean; used in the ADT that determines if all the rows but the last one for each column are occupied by a checker. The values of number_of_rows and number_of_cols are given in the number_unit

unit TestADT;
interface
uses number_unit

type
  column_type = 1..number_of_cols; {index for columns}
  row_type = 1..number_of_rows; {index for columns}
  square_type = {index for squares}
    record
      column : column_type;
      row : column_type
    end;
  color_type = (red,blue);
  value_type = {what a square contains}
    record
      empty : boolean;   {is square empty?}
      color : color_type {if not empty, what color it is}
    end;
  array_type = array[column_type,row_type] of value_type;
  board_type = 
    object
        procedure Initialize; 
        procedure Make_Move(column : column_type); 
        procedure Get_Value(square : square_type; Val : value_type); 
        function Get_Current_Color : color_type;
        function Is_Full(column : column_type) : boolean;
        function Win : boolean;
        function almost_draw : boolean;
      private
        Value : array_type; {the board configuration}
        current_color : color_type; {whose turn it is}
    end; {object board_type}
Problem #2

Write a recursive function function nocci(n : integer) : integer that Gives the nth number in the following sequence where the first three numbers are 0,1,1 and the rest are the sum of the preceding three numbers in the sequence, e.g., 0, 1, 1, 2, 4, 7, 13, 24, etc

Problem #3

Given a singly linked list that has the pointer head to the first node. The list has at least one node. Write a procedure called double that has head as its only parameter. The procedure copies the list into one that is doubly linked. Use the following type definitions for the singly and doubly linked list respectively:

pointer = ^ node;
node = record
  info : char;
  next : pointer
end;


d_pointer = ^ d_node;
d_node = record
  info : char;
  left, right : d_pointer
end;