anchor.diff:    Posi   : array [1..2] of integer;
     end;
     Snake = record
  -  Length : integer;
  -  Shape  : char;
  -  Dead   : boolean;
  -  Dir    : char;
  +  Length   : integer;
  +  Shape    : char;
  +  Dead     : boolean;
  +  Dir      : char;
     HeadPos, BackPos : array [1..2] of integer;
     end;
  +  Board = array [2..25, 2..80] of  char;
   var
     score, game    : PWindow;
     max_y, max_x   : integer; { max screen size }
  
positive.code:     mvwprintw(win, i, 0, '|');
      mvwprintw(win, i, x - 1, '|');
    end;
    for i := 1 to (x - 2) do begin
      mvwprintw(win, 0, i, '-');
      mvwprintw(win, y - 1, i, '-');
    end;
  
negative.code:     end;
      rk := wgetch(game);
      case rk of
        67    : Dir := 'R'; {Right}
        68    : Dir := 'L'; {Left}
        65    : Dir := 'U'; {UP}
        66    : Dir := 'D'; {Down}
      end;
      movingSnake(PSnake, Dir, PBoard);
      checkCollision(PSnake, PApple);
      if (PApple.Eaten) or (scr = -1) then begin
        {mvwdelch(game, rand_y, rand_x);}
        mvwprintw(game, rand_y, rand_x, ' ');
        PBoard[rand_y][rand_x] := 'E';
        generateApple(max_y, max_x, rand_y, rand_x);
        PBoard[rand_y][rand_x] := 'A'; { A means apple }
        Inc(scr);
        Inc(PSnake.Length);
      end;
      { Printing Part; Printing the board to the screen 
      for i:=2 to max_y-6 do
        for j:=2 to max_x do
          begin
            in this way it will clean itself no need for window clear
            if (PBoard[i][j] = 'S') then begin
              mvwprintw(game, j, i, 'O');
              PBoard[i][j] := 'E';
            end
            else if (PBoard[i][j] = 'E') then mvwprintw(game, j, i, ' ');
            //napms(20);
          end;}
      {  this cleans behind the Snake }
      { Displaying score }
        mvwprintw(game, PSnake.HeadPos[1], PSnake.HeadPos[2]-, ' ');
        mvwprintw(score, 1, 1, PChar(concat(IntToStr(scr), '                   '))); { the argument must be passed as a PChar }
        wrefresh(game);
        wrefresh(score);
    end;
    endwin();
  END.
  