{ "cells": [ { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "import numpy as np\n", "\n", "class Elevator():\n", " def __init__(self, floor=1, capacity=10, people=0, direction=1):\n", " self.floor = floor\n", " self.capacity = capacity\n", " self.people = people\n", " self.direction = direction\n", " \n", " \n", " def change_dir(self):\n", " self.direction = self.direction*(-1)\n", " return(\"The direction has changed\")\n", " \n", " def add_passenger(self):\n", " if self.people < self.capacity:\n", " if passenger.direction == Elevator.direction:\n", " self.people+=1\n", " else:\n", " return(\"Passenger not going the same direction\")\n", " else:\n", " return(\"Elevator is Full!\")\n", " \n", " def scan_floor(self,building):\n", " if building.passengers_no[self.floor,1] != 0:\n", " while building.passengers_no[self.floor,1] > 0 and building.passengers_no[sel]\n" ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "import numpy as np\n", "class Building():\n", " def __init__(self, max_floor = 20, min_floor = 1, people = 0)\n", " self.max_floor = max_floor\n", " self.min_floor = min_floor\n", " self.no_people = people\n", " self.no_floors = max_floor\n", " self.storageArray = [0]*max_floor\n", " \n", " def new_person(self):\n", " self.no_people += 1\n", " self.storageArray[0]+=1\n", " \n", " def person_leave(self):\n", " self.no_people +=(-1)\n", " self.storageArray[0]+=(-1)\n", " def Person_move(self,passenger):\n", " self.storageArray[passenger.end]+=1\n", " self.storageArray[0]+=(-1)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "ename": "SyntaxError", "evalue": "unexpected EOF while parsing (<ipython-input-4-39bd1823d4a0>, line 2)", "output_type": "error", "traceback": [ "\u001b[0;36m File \u001b[0;32m\"<ipython-input-4-39bd1823d4a0>\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m def __init__(self, target_floor, direction, wait_time) :\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unexpected EOF while parsing\n" ] } ], "source": [ "class Passenger():\n", " def __init__(self, target_floor, direction, wait_time) :\n", " " ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (system-wide)", "language": "python", "metadata": { "cocalc": { "description": "Python 3 programming language", "priority": 100, "url": "https://www.python.org/" } }, "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 0 }