diff --git "a/GPT4_game.ipynb" "b/GPT4_game.ipynb"
new file mode 100644--- /dev/null
+++ "b/GPT4_game.ipynb"
@@ -0,0 +1,983 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "view-in-github",
+ "colab_type": "text"
+ },
+ "source": [
+ ""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# GPTWorld Golf\n",
+ "\n",
+ "The goal of this exercise is to write a prompt that can solve the movement of an AI in a grid world using prompting. You need to avoid walls, pick up a key, and then reach the goal.\n",
+ "\n",
+ "You will need to use use OpenAI Key to run the exercise. You can get it here: \n",
+ "\n",
+ "https://platform.openai.com/account/api-keys"
+ ],
+ "metadata": {
+ "id": "jcICcfZw7KTt"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ai_key = \"TODO-FILL-IN\""
+ ],
+ "metadata": {
+ "id": "OxdK7rk46MfM"
+ },
+ "execution_count": null,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 44,
+ "metadata": {
+ "id": "gKzCE5A7aGWY"
+ },
+ "outputs": [],
+ "source": [
+ "%%capture\n",
+ "!sudo apt-get install libcairo2-dev\n",
+ "!pip install -U git+https://github.com/chalk-diagrams/chalk openai pycairo tiktoken"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "This cell can be ignored. It just imports the necessary libraries and sets up a prompt call. \n"
+ ],
+ "metadata": {
+ "id": "lCZ-Wfkn7x0C"
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "id": "RWUExPo7Y8-O"
+ },
+ "outputs": [],
+ "source": [
+ "\n",
+ "from dataclasses import dataclass\n",
+ "from chalk import *\n",
+ "from colour import Color\n",
+ "import inspect\n",
+ "import os\n",
+ "import openai\n",
+ "from typing import List, Tuple, Optional\n",
+ "from enum import Enum\n",
+ "import io\n",
+ "from IPython.display import Image\n",
+ "from contextlib import redirect_stdout\n",
+ "import imageio\n",
+ "import tiktoken\n",
+ "openai.api_key = ai_key\n",
+ "tab = \" \"\n",
+ "\n",
+ "def start(prompt):\n",
+ " out = \"\"\n",
+ " for chunk in openai.ChatCompletion.create(\n",
+ " model=\"gpt-4\",\n",
+ " messages=[{\n",
+ " \"role\": \"user\",\n",
+ " \"content\": prompt,\n",
+ " \n",
+ " }],\n",
+ " stream=True,\n",
+ " temperature= 0\n",
+ " ):\n",
+ "\n",
+ " content = chunk[\"choices\"][0].get(\"delta\", {}).get(\"content\")\n",
+ " if content is not None:\n",
+ " out += content\n",
+ " print(content, end=\"\")\n",
+ " yield out\n",
+ " yield out\n",
+ "\n",
+ "def num_tokens_from_string(string: str, encoding_name: str=\"gpt-4\") -> int:\n",
+ " \"\"\"Returns the number of tokens in a text string.\"\"\"\n",
+ " encoding = tiktoken.encoding_for_model(encoding_name)\n",
+ " num_tokens = len(encoding.encode(string))\n",
+ " return num_tokens"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Game Code\n",
+ "\n",
+ "This code creates a mini-game to play. It takes place on a hexagon. You are represented by a circle. You need to first pick up a key represented by a triangle. You finally need to make it to the cross to finish the game. The actions show each of the directions you can move.\n",
+ "\n"
+ ],
+ "metadata": {
+ "id": "LMTjwXdD7v-I"
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "![image.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAL4AAAEACAYAAAANw8wsAAAgAElEQVR4Ae19B3wVVdr+Qy/Si0qo0gm9E6oEWGnBb1Fwv/UP7K4K2IJShEWRgIgBQYrrssDfQnBXhBVcQu8dQu+hBFgwhN57/37PXA7MnZmbO0nu3Htn7jm/XzJ3Zk59zjPnvO973jkDyCARkAhIBCQCEgGJgERAIiARkAg4CYFMqsZ0ATBcdS5/SgSchsCnAGaxUVlVLSsIoLLqXP6UCDgNAXJcCZnFD3mUCIQSApL4odTbsq1PEFCLOk8u8sfY14EP27ldkicSAVshMG4h0O+fxlX2SHxGz6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UMrPvZypHdktRLi6tMjXwKhd+g3fwJouQmVwLayzeJlGG27BW70EOVvpwbNaw/Oayb94fmW03ergY9nAlz4GdHFZf1wXmvNt0i8/hi/HfjwR+DCNWBQJ+DDdvqXYcznap+Yjic+u0K4P7/aAKDFQ2vms093+b6mXBehMn/jDkBdJ1RCSBBfdGYodaxos5kjB4JQGwwcK+Ob6XAZJ3QRkMQP3b4P6ZZL4od094du4yXxQ7fvQ7rlkvgh3f2h23hJ/NDt+5BuuSR+SHd/6DZeEj90+z6kWy6JH9LdH7qNl8QP3b4P6ZZL4od094du4yXxQ7fvQ7rlkvgh3f2h23hJ/NDt+5BuuUe35J82AjvdNwQOaaBk4+2HQGKK5zp7JP7WowD/ZJAIOBEBKeo4sVdlm7wiIInvFSIZwYkIqPfV4d5YLzixkbJNEoHHCPDz6eckGhIBiYBEQCIgEZAISAQkAhIBiYDzEPg/5VbQzqj+HNMAAAAASUVORK5CYII=)"
+ ],
+ "metadata": {
+ "id": "YxeLc-oD8Y7V"
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 54,
+ "metadata": {
+ "id": "Fv3eTRKiV2ZB"
+ },
+ "outputs": [],
+ "source": [
+ "# Possible Actions\n",
+ "class Actions(Enum):\n",
+ " UPRIGHT = \"UR\"\n",
+ " RIGHT = \"R\"\n",
+ " DOWNRIGHT = \"DR\"\n",
+ " DOWNLEFT = \"DL\"\n",
+ " LEFT = \"L\"\n",
+ " UPLEFT = \"UL\"\n",
+ " PICKUP = \"Pickup\"\n",
+ "\n",
+ "# Movements\n",
+ "change = { \n",
+ " Actions.UPRIGHT : (-1, 1), \n",
+ " Actions.RIGHT : (0, 2), \n",
+ " Actions.DOWNRIGHT : (1, 1), \n",
+ " Actions.DOWNLEFT : (1, -1), \n",
+ " Actions.LEFT : (0, -2), \n",
+ " Actions.UPLEFT : (-1, -1), \n",
+ " Actions.PICKUP : (0, 0), \n",
+ "}\n",
+ "change_str = {action.value: change[action] for action in Actions}\n",
+ "def add(a, b):\n",
+ " return a[0] + b[0], a[1] + b[1]\n",
+ "\n",
+ "@dataclass\n",
+ "class Board:\n",
+ " grid: List[str]\n",
+ " player_pos: Tuple[int, int]\n",
+ " flag_pos: Tuple[int, int]\n",
+ " wall_pos:List[Tuple[int, int]]\n",
+ " key_pos:Optional[Tuple[int, int]]\n",
+ "\n",
+ " def move(self, action: Actions) -> 'Board':\n",
+ " \"Move by creating a new board.\"\n",
+ " d_m = change[action] \n",
+ " if action == Actions.PICKUP:\n",
+ " if self.player_pos == self.key_pos:\n",
+ " return Board(self.grid, self.player_pos, self.flag_pos, self.wall_pos, None)\n",
+ " else:\n",
+ " return self\n",
+ " \n",
+ " new_player_pos = add(self.player_pos, d_m)\n",
+ " # Out of bounds\n",
+ " if new_player_pos[0] < 0 or new_player_pos[0] >= len(self.grid):\n",
+ " return self\n",
+ " if new_player_pos[1] < 0 or new_player_pos[1] >= len(self.grid[0]):\n",
+ " return self\n",
+ " # Can't move through walls\n",
+ " if self.grid[new_player_pos[0]][new_player_pos[1]] == 'W':\n",
+ " return self\n",
+ " \n",
+ " new_grid = [row[:] for row in self.grid] # Create a copy of the grid\n",
+ " new_grid[self.player_pos[0]][self.player_pos[1]] = '.'\n",
+ " new_grid[new_player_pos[0]][new_player_pos[1]] = '@'\n",
+ " return Board(new_grid, new_player_pos, self.flag_pos, self.wall_pos, self.key_pos)\n",
+ " \n",
+ " def __str__(self) -> str:\n",
+ " return '\\n'.join(''.join(row) for i, row in enumerate(self.grid))\n",
+ "\n",
+ " @classmethod\n",
+ " def create_empty_board(cls, size: Tuple[int, int], key_pos, flag_pos, init, wall_pos) -> 'Board':\n",
+ " grid = [['.' if i % 2 == j % 2 else \" \" for i in range(size[1])] for j in range(size[0])]\n",
+ " player_pos = init\n",
+ " flag_pos = flag_pos\n",
+ " grid[player_pos[0]][player_pos[1]] = '@'\n",
+ " grid[flag_pos[0]][flag_pos[1]] = 'P'\n",
+ " grid[key_pos[0]][key_pos[1]] = 'K'\n",
+ " for pos in wall_pos:\n",
+ " grid[pos[0]][pos[1]] = 'W'\n",
+ " return cls(grid, player_pos, flag_pos, wall_pos, key_pos)\n",
+ "\n",
+ "class Game:\n",
+ " def __init__(self, init, flag, walls, key, boundary):\n",
+ " \"Create the version of the game that the AI sees.\"\n",
+ " self.boundary = boundary\n",
+ " self.board = Board.create_empty_board(boundary, key, flag, init, walls)\n",
+ " self.original = self.board\n",
+ " self.actions = []\n",
+ "\n",
+ " def move(self, action):\n",
+ " self.board = self.board.move(action)\n",
+ " self.actions.append(action)\n",
+ "\n",
+ " @property\n",
+ " def walls(self):\n",
+ " return self.board.wall_pos\n",
+ "\n",
+ " def __repr__(self) -> str:\n",
+ " walls = \",\".join(map(str, self.board.wall_pos))\n",
+ " return f\"Game(init={self.board.player_pos}, flag={self.board.flag_pos}, walls= {self.board.wall_pos}, boundary= {self.boundary}, key= {self.board.key_pos})\"\n",
+ "\n",
+ "# This is the version of move that the AI can see.\n",
+ "def move(game, action, old_pos):\n",
+ " # ACTIONS (must be legal)\n",
+ " game.move(Actions(action))\n",
+ " offset = change_str[action]\n",
+ " pos = (old_pos[0] + offset[0], old_pos[1] + offset[1])\n",
+ " assert 0 <= pos[0] < game.boundary[0]\n",
+ " assert 0 <= pos[1] < game.boundary[1]\n",
+ " assert pos not in game.walls\n",
+ " if action == \"PU\":\n",
+ " assert pos == game.key\n",
+ " return pos"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "We can look at the board by drawing it. "
+ ],
+ "metadata": {
+ "id": "PDOcPiQq8u_Y"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "def draw_board(grid, num=0):\n",
+ " hex = regular_polygon(6, 1).rotate_by(1/12).line_width(0.5).fill_color(Color(\"white\"))\n",
+ " w = hex.get_envelope().width\n",
+ " canvas = empty()\n",
+ " for r, b in enumerate(grid):\n",
+ " def show(v):\n",
+ " if v == \".\":\n",
+ " return hex\n",
+ " if v == \"@\":\n",
+ " return hex + circle(0.35).fill_color(Color(\"red\")) \n",
+ " if v == \"P\":\n",
+ " x = rectangle(0.25, 0.7).fill_color(Color(\"blue\")).line_width(0)\n",
+ " return hex + (x.rotate_by(0.25/2) + x.rotate_by(-0.25/2))\n",
+ " if v == \"K\":\n",
+ " return hex + triangle(0.75).fill_color(Color(\"purple\"))\n",
+ " if v == \"W\":\n",
+ " return hex.fill_color(Color(\"black\"))\n",
+ " if v ==\" \":\n",
+ " return hex\n",
+ " row = hcat(show(v) for i, v in enumerate(b[1 if r %2 else 0::2]))\n",
+ " canvas += row.translate(w * 0.5 if r%2 else 0, 1.5 * r)\n",
+ " canvas = canvas.center_xy().frame(0.5)\n",
+ " canvas = rectangle(canvas.get_envelope().width, canvas.get_envelope().height).line_width(0.5).fill_color(Color(\"orange\")) + canvas\n",
+ " canvas.render(f\"pic{num}.png\", 256)\n",
+ " return canvas\n",
+ "\n"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 221
+ },
+ "id": "Ic7WgOTi8uF1",
+ "outputId": "4dc07cb9-9e5f-4d28-d4ea-470ad4b13141"
+ },
+ "execution_count": 76,
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(6.196152422706634, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 9.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-6.196152422706634, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -9.0), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, -3.098076211353317,\n",
+ " 0.0, 1.0, -4.5)), diagram2=Compose(envelope=, diagram1=ApplyTransform(transform=Affine(1.0, 0.0, -1.7320508075688776,\n",
+ " 0.0, 1.0, -3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Empty(), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 1.7320508075688779,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[ArcSegment(angle=0, dangle=-90, t=Affine(1.0, 0.0, -1.0,\n",
+ " 0.0, 1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, 1.0, 0.0,\n",
+ " -1.0, 0.0, 1.0)), ArcSegment(angle=0, dangle=-90, t=Affine(-1.0, 0.0, 1.0,\n",
+ " 0.0, -1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, -1.0, 0.0,\n",
+ " 1.0, 0.0, -1.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.35, 0.0, 0.35,\n",
+ " 0.0, 0.35, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 3.464101615137756,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 1.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 3.464101615137756,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 4.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 6.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 3.464101615137756,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865476, 0.7071067811865475, -0.33587572106361,\n",
+ " -0.7071067811865475, 0.7071067811865476, -0.1590990257669732)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865474, -0.7071067811865477, 0.15909902576697327,\n",
+ " 0.7071067811865477, 0.7071067811865474, -0.33587572106361))))))))), diagram2=Empty()))"
+ ],
+ "image/svg+xml": "\n"
+ },
+ "metadata": {},
+ "execution_count": 76
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "game = Game(boundary=(5, 5), key=(0, 2), flag=(4, 4), init=(0, 0), walls=[(2, 2)])\n",
+ "display(draw_board(game.board.grid))\n",
+ "move(game, \"DR\", (0,0))\n",
+ "display(draw_board(game.board.grid))"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 424
+ },
+ "id": "nqgPKLu0AMhU",
+ "outputId": "19e4c6d0-b792-4a34-f4c4-81902974c346"
+ },
+ "execution_count": 78,
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ "Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(6.196152422706634, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 9.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-6.196152422706634, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -9.0), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, -3.098076211353317,\n",
+ " 0.0, 1.0, -4.5)), diagram2=Compose(envelope=, diagram1=ApplyTransform(transform=Affine(1.0, 0.0, -1.7320508075688776,\n",
+ " 0.0, 1.0, -3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Empty(), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[ArcSegment(angle=0, dangle=-90, t=Affine(1.0, 0.0, -1.0,\n",
+ " 0.0, 1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, 1.0, 0.0,\n",
+ " -1.0, 0.0, 1.0)), ArcSegment(angle=0, dangle=-90, t=Affine(-1.0, 0.0, 1.0,\n",
+ " 0.0, -1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, -1.0, 0.0,\n",
+ " 1.0, 0.0, -1.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.35, 0.0, 0.35,\n",
+ " 0.0, 0.35, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 1.7320508075688779,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.75, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.37499999999999983, -0.649519052838329), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.37500000000000033, 0.6495190528383288), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.375, 0.21650635094610973))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 3.464101615137756,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 1.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 3.464101615137756,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 4.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 6.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 3.464101615137756,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865476, 0.7071067811865475, -0.33587572106361,\n",
+ " -0.7071067811865475, 0.7071067811865476, -0.1590990257669732)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865474, -0.7071067811865477, 0.15909902576697327,\n",
+ " 0.7071067811865477, 0.7071067811865474, -0.33587572106361))))))))), diagram2=Empty()))"
+ ],
+ "image/svg+xml": "\n"
+ },
+ "metadata": {}
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ "Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(6.196152422706634, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 9.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-6.196152422706634, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -9.0), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, -3.098076211353317,\n",
+ " 0.0, 1.0, -4.5)), diagram2=Compose(envelope=, diagram1=ApplyTransform(transform=Affine(1.0, 0.0, -1.7320508075688776,\n",
+ " 0.0, 1.0, -3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Empty(), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 1.7320508075688779,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.75, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.37499999999999983, -0.649519052838329), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.37500000000000033, 0.6495190528383288), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.375, 0.21650635094610973))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 3.464101615137756,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 1.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[ArcSegment(angle=0, dangle=-90, t=Affine(1.0, 0.0, -1.0,\n",
+ " 0.0, 1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, 1.0, 0.0,\n",
+ " -1.0, 0.0, 1.0)), ArcSegment(angle=0, dangle=-90, t=Affine(-1.0, 0.0, 1.0,\n",
+ " 0.0, -1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, -1.0, 0.0,\n",
+ " 1.0, 0.0, -1.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.35, 0.0, 0.35,\n",
+ " 0.0, 0.35, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 3.464101615137756,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 4.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 6.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 2.598076211353317,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 3.464101615137756,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865476, 0.7071067811865475, -0.33587572106361,\n",
+ " -0.7071067811865475, 0.7071067811865476, -0.1590990257669732)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865474, -0.7071067811865477, 0.15909902576697327,\n",
+ " 0.7071067811865477, 0.7071067811865474, -0.33587572106361))))))))), diagram2=Empty()))"
+ ],
+ "image/svg+xml": "\n"
+ },
+ "metadata": {}
+ }
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Prompt Code\n",
+ "\n",
+ "The puzzle is to write prompt code to make the model accomplish this task. We have provided some scaffolding code for you. The code creates:\n",
+ "\n",
+ "* A header for describing the game. \n",
+ "* A function `make_fun` that shows the AI how to move in code. \n",
+ "* A footer to describe the final game board that you want the mode to solve. \n",
+ "\n",
+ "You can fill this in a watch how the model moves around."
+ ],
+ "metadata": {
+ "id": "PhqF9af5_jvh"
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 102,
+ "metadata": {
+ "id": "jFf7TCOJaVHX"
+ },
+ "outputs": [],
+ "source": [
+ "\n",
+ "def make_fun(board, actions):\n",
+ " \"This function generates python code for few-shot examples\"\n",
+ " out = tab + \"p = \" + str(board.player_pos)\n",
+ " for i, action in enumerate(actions):\n",
+ " new_board = board.move(action)\n",
+ " out += f\"\"\"\n",
+ " # print(new_board) <- uncomment if you want to see the movement.\n",
+ " # TODO ADD CODE\n",
+ " p = move(b, \"{action.value}\", p) # TODO ADD CODE\"\"\"\n",
+ " board = new_board\n",
+ " return out\n",
+ "\n",
+ "ex = 0\n",
+ "def prompt(game):\n",
+ " \"\"\"\n",
+ " You should fill these sections out to teach the AI how to play the game.\n",
+ " \"\"\"\n",
+ " print(f\"\"\"\n",
+ "# TODO: DESCRIBE THE GAME\n",
+ "\n",
+ "# TODO: DESCRIBE THE ACTIONS\n",
+ "change_str = {change_str}\n",
+ "\n",
+ "{inspect.getsource(move)}\n",
+ "\"\"\")\n",
+ "\n",
+ " def example(game, actions):\n",
+ " \"\"\"\n",
+ " This code makes a few shot example. You don't need to edit it.\n",
+ " \"\"\"\n",
+ " global ex\n",
+ " ex += 1\n",
+ " print(f\"\"\"\n",
+ "#-------------\n",
+ "# EXAMPLE:\n",
+ "def example{ex}():\n",
+ " b = {repr(game)} \n",
+ "{make_fun(game.board, actions)}\n",
+ " return b\n",
+ "# ------------\n",
+ "\"\"\")\n",
+ "\n",
+ " # Create a few shot example \n",
+ " board = Game(boundary=(3, 3), key=(1, 1), flag=(2, 2), init=(0, 0), walls=[(2, 0)])\n",
+ " actions = [Actions.DOWNRIGHT, Actions.PICKUP, Actions.DOWNRIGHT]\n",
+ " example(board, actions)\n",
+ "\n",
+ " # Test case\n",
+ " print(f\"\"\"\n",
+ "# ----\n",
+ "# TODO: ADD any custom example code\n",
+ "#---\n",
+ "# TODO: FINAL description.\n",
+ "\n",
+ "# Contraints for this function:\", {repr(game)}\n",
+ "# Please fill this in with code like the examples above (do not provide a description):\n",
+ "# \n",
+ "# The following function `my_example` instantiates a GameBoard called b with these constraints.\n",
+ "\n",
+ "\"\"\") \n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "This code lets you make a game and see the output for a prompt for that game. There are easy, medium, and hard games. "
+ ],
+ "metadata": {
+ "id": "-iecyV7nAbFT"
+ }
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# Easy\n",
+ "game = Game(boundary=(3, 3), key=(1, 1), flag=(2, 2), init=(0, 0), walls=[])\n",
+ "\n",
+ "# Medium\n",
+ "#game = Game(boundary=(5, 5), key=(3, 1), flag=(4, 4), init=(0, 0), walls=[(1, 1)])\n",
+ "\n",
+ "# Hard\n",
+ "#game = Game(boundary=(8, 15), key=(3, 1), flag=(7, 13), init=(0, 0), walls=[(2, 2), (1, 1), (5, 3), (1, 11), (5, 5), (6, 6), (6, 10), (2, 6), (4, 12)])\n",
+ "\n",
+ "f = io.StringIO()\n",
+ "with redirect_stdout(f):\n",
+ " ex = 0\n",
+ " prompt(game)\n",
+ "my_prompt = f.getvalue()\n",
+ "print(my_prompt)"
+ ],
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "cOneYFok_OMe",
+ "outputId": "97080186-7322-4ba9-b500-095fb39071aa"
+ },
+ "execution_count": 103,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "\n",
+ "# TODO: DESCRIBE THE GAME\n",
+ "\n",
+ "# TODO: DESCRIBE THE ACTIONS\n",
+ "change_str = {'UR': (-1, 1), 'R': (0, 2), 'DR': (1, 1), 'DL': (1, -1), 'L': (0, -2), 'UL': (-1, -1), 'Pickup': (0, 0)}\n",
+ "\n",
+ "def move(game, action, old_pos):\n",
+ " # ACTIONS (must be legal)\n",
+ " game.move(Actions(action))\n",
+ " offset = change_str[action]\n",
+ " pos = (old_pos[0] + offset[0], old_pos[1] + offset[1])\n",
+ " assert 0 <= pos[0] < game.boundary[0]\n",
+ " assert 0 <= pos[1] < game.boundary[1]\n",
+ " assert pos not in game.walls\n",
+ " if action == \"PU\":\n",
+ " assert pos == game.key\n",
+ " return pos\n",
+ "\n",
+ "\n",
+ "\n",
+ "#-------------\n",
+ "# EXAMPLE:\n",
+ "def example1():\n",
+ " b = Game(init=(0, 0), flag=(2, 2), walls= [(2, 0)], boundary= (3, 3), key= (1, 1)) \n",
+ " p = (0, 0)\n",
+ " # print(new_board) <- uncomment if you want to see the movement.\n",
+ " # TODO ADD CODE\n",
+ " p = move(b, \"DR\", p) # TODO ADD CODE\n",
+ " # print(new_board) <- uncomment if you want to see the movement.\n",
+ " # TODO ADD CODE\n",
+ " p = move(b, \"Pickup\", p) # TODO ADD CODE\n",
+ " # print(new_board) <- uncomment if you want to see the movement.\n",
+ " # TODO ADD CODE\n",
+ " p = move(b, \"DR\", p) # TODO ADD CODE\n",
+ " return b\n",
+ "# ------------\n",
+ "\n",
+ "\n",
+ "# ----\n",
+ "# TODO: ADD any custom example code\n",
+ "#---\n",
+ "# TODO: FINAL description.\n",
+ "\n",
+ "# Contraints for this function:\", Game(init=(0, 0), flag=(2, 2), walls= [], boundary= (3, 3), key= (1, 1))\n",
+ "# Please fill this in with code like the examples above (do not provide a description):\n",
+ "# \n",
+ "# The following function `my_example` instantiates a GameBoard called b with these constraints.\n",
+ "\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 105,
+ "metadata": {
+ "id": "LONWUsBLjOHo",
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 1000
+ },
+ "outputId": "472afd19-48c1-4924-cabd-639b5e2ad298"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "def my_example():\n",
+ " b = Game(init=(0, 0), flag=(2, 2), walls=[], boundary=(3, 3), key=(1, 1))\n",
+ " p = (0, 0)\n",
+ "\n"
+ ]
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ "Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(4.464101615137756, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 6.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-4.464101615137756, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -6.0), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, -2.232050807568878,\n",
+ " 0.0, 1.0, -3.0)), diagram2=Compose(envelope=, diagram1=ApplyTransform(transform=Affine(1.0, 0.0, -0.8660254037844389,\n",
+ " 0.0, 1.0, -1.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Empty(), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[ArcSegment(angle=0, dangle=-90, t=Affine(1.0, 0.0, -1.0,\n",
+ " 0.0, 1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, 1.0, 0.0,\n",
+ " -1.0, 0.0, 1.0)), ArcSegment(angle=0, dangle=-90, t=Affine(-1.0, 0.0, 1.0,\n",
+ " 0.0, -1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, -1.0, 0.0,\n",
+ " 1.0, 0.0, -1.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.35, 0.0, 0.35,\n",
+ " 0.0, 0.35, 0.0))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 1.5), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.75, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.37499999999999983, -0.649519052838329), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.37500000000000033, 0.6495190528383288), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.375, 0.21650635094610973))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 1.7320508075688779,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865476, 0.7071067811865475, -0.33587572106361,\n",
+ " -0.7071067811865475, 0.7071067811865476, -0.1590990257669732)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865474, -0.7071067811865477, 0.15909902576697327,\n",
+ " 0.7071067811865477, 0.7071067811865474, -0.33587572106361))))))))), diagram2=Empty()))"
+ ],
+ "image/svg+xml": "\n"
+ },
+ "metadata": {}
+ },
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ " p = move(b, \"DR\", p)\n"
+ ]
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ "Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(4.464101615137756, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 6.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-4.464101615137756, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -6.0), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(1.0, 0.0, -2.232050807568878,\n",
+ " 0.0, 1.0, -3.0)), diagram2=Compose(envelope=, diagram1=ApplyTransform(transform=Affine(1.0, 0.0, -0.8660254037844389,\n",
+ " 0.0, 1.0, -1.5), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Empty(), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 1.7320508075688779,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844389,\n",
+ " 0.0, 1.0, 1.5), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[ArcSegment(angle=0, dangle=-90, t=Affine(1.0, 0.0, -1.0,\n",
+ " 0.0, 1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, 1.0, 0.0,\n",
+ " -1.0, 0.0, 1.0)), ArcSegment(angle=0, dangle=-90, t=Affine(-1.0, 0.0, 1.0,\n",
+ " 0.0, -1.0, 0.0)), ArcSegment(angle=0, dangle=-90, t=Affine(0.0, -1.0, 0.0,\n",
+ " 1.0, 0.0, -1.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=None, line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.35, 0.0, 0.35,\n",
+ " 0.0, 0.35, 0.0))))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " 0.0, 1.0, 3.0), diagram=Compose(envelope=, diagram1=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 0.8660254037844388,\n",
+ " 0.0, 1.0, 0.0), diagram=ApplyTransform(transform=Affine(1.0, 0.0, 0.0,\n",
+ " -0.0, 1.0, 0.0), diagram=Empty()))), diagram2=ApplyTransform(transform=Affine(1.0, 0.0, 1.7320508075688779,\n",
+ " 0.0, 1.0, 0.0), diagram=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, -0.8660254037844386), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.4999999999999998, -0.8660254037844387), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-1.0, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.5000000000000004, 0.8660254037844384), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.5000000000000001, 0.8660254037844386), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(-0.5, 0.8660254037844387))]), style=Style(line_width_=(, 0.5), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.8660254037844387, 0.49999999999999994, 0.0,\n",
+ " -0.49999999999999994, 0.8660254037844387, 0.0)), diagram2=Compose(envelope=, diagram1=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865476, 0.7071067811865475, -0.33587572106361,\n",
+ " -0.7071067811865475, 0.7071067811865476, -0.1590990257669732)), diagram2=Primitive(shape=Path(loc_trails=[Located(trail=Trail(segments=[Segment(offset=Vec2(0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, 0.7), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(-0.25, 0.0), origin=Vec2(0.0, 0.0)), Segment(offset=Vec2(0.0, -0.7), origin=Vec2(0.0, 0.0))], closed=True), location=Vec2(0.0, 0.0))]), style=Style(line_width_=(, 0), line_color_=None, fill_color_=, fill_opacity_=None, dashing_=None, output_size=None), transform=Affine(0.7071067811865474, -0.7071067811865477, 0.15909902576697327,\n",
+ " 0.7071067811865477, 0.7071067811865474, -0.33587572106361))))))))), diagram2=Empty()))"
+ ],
+ "image/svg+xml": "\n