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": [
+ ""
+ ],
+ "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