user
The first turtle graphic discussed in Mindstorms: Children, Computers, and Powerful Ideas by Seymour Papert is a simple drawing of a house. It is a square with a triangle on top for the roof.

For a slightly more advanced audience, a more practical introduction to turtle graphics might be to draw a bar chart.

Task
:   :   * Create a function (or subroutine) that uses turtle graphics to draw a house of a specified size as depicted. Optionally make it lovely by adding details such as, for example, doors and windows.

:   :   * Create a function (or subroutine) that takes a list (array, vector) of non-negative numbers and draws a bar chart from them, scaled to fit exactly in a square of a specified size. The enclosing square need not be drawn.

:   :   * Both functions should return the turtle to the location it was at and facing in the same direction as it was immediately before the function was executed.
assistant
```
# 20250303 Raku programming solution

use Cairo;

sub house(Cairo::Context $cr, $x, $y, $size) {
   $cr.save;
   $cr.rgb(1.0, 1.0, 1.0);

   $cr.rectangle($x, $y, $size, $size);
   $cr.stroke;

   $cr.move_to($x + $size / 2, $y - $size / 2);
   $cr.line_to($x, $y);
   $cr.line_to($x + $size, $y);
   $cr.close_path;
   $cr.stroke;

   $cr.restore;
}

sub barchart(Cairo::Context $cr, @data, $x is copy, $y, $size) {
   $cr.save;
   $cr.rgb(1.0, 1.0, 1.0);

   my $maxdata = @data.max || 1;
   my $bar-width = $size / (@data.elems || 1);
   my $bar-spacing = $bar-width * 0.1;

   for @data -> $n {
      my $bar-height = ($n / $maxdata) * $size;
      $cr.rectangle($x, $y - $bar-height, $bar-width - $bar-spacing, $bar-height);
      $cr.stroke;
      $x += $bar-width;
   }

   $cr.restore;
}

sub testturtle($width = 400, $height = 600) {
   my $image = Cairo::Image.create(Cairo::FORMAT_ARGB32, $width, $height);
   my $cr = Cairo::Context.new($image);

   $cr.rgb(0.0, 0.0, 0.0);
   $cr.paint;

   $cr.line_width = 2.0;

   barchart($cr, [15, 10, 50, 35, 20], $width * 0.6, $height, $width / 3);
   house($cr, $width / 4, $height / 3, $width / 3);

   $image.write_png('turtle-raku.png');
}

testturtle();

```