{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "\n", "def hCurve(n,x,y,win):\n", " if n > 0:\n", " aCurve(n-1,x,y,win)\n", " goSouth(x,y,win)\n", " hCurve(n-1,x,y,win)\n", " goEast(x,y,win)\n", " hCurve(n-1,x,y,win)\n", " goNorth(x,y,win)\n", " bCurve(n-1,x,y,win)\n", "\n", "def aCurve(n,x,y,win):\n", " if n > 0:\n", " hCurve(n-1,x,y,win)\n", " goEast(x,y,win)\n", " aCurve(n-1,x,y,win)\n", " goSouth(x,y,win)\n", " aCurve(n-1,x,y,win)\n", " goWest(x,y,win)\n", " cCurve(n-1,x,y,win)\n", "\n", "def find_length(n,w):\n", " # return the length of segment whill will allow curve of size in to fit \n", " # a canvas of width = w\n", " return ??\n", "\n", "def main():\n", " n = int(sys.argv[1])\n", " WIDTH = 1024\n", " HEIGHT = 1024\n", " win = Graphics...... \n", " length = find_length(n,WIDTH)\n", " hCurve(n,14,14,length,win)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "length(0) = 0\n", "length(n) = 4 * length(n-1) + 3\n", "\n", "length(n) = 4 * length(n-1) + 3\n", " = 4 * (4 * length(n-2) + 3) + 3\n", " = ...\n", "\n", "\n", "\n", "length(n) = 4**n - 1\n", "\n", "Recurrence relations\n", "\n", "n length\n", "----------\n", "0 0\n", "1 3\n", "2 15\n", "3 63\n", "\n", "\n", "n = 3 \n", "7 segments\n", "\n", "n= 4\n", "15 segments" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "int x;\n", "x = 22;\n", "\n", "\n", "int *p;\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "s = SupplierNode(\"s12\",\"Jones\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "1301, 1302, 2510\n", "\n", "2720 (Shiraj Pokharel), \n", "3320 (Peng Wang, Weeks, Ashok) leads to 4320, 4330, .....\n", "3210 (???) has least impact on future classes\n" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }