{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from typing import Dict, Tuple, List" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "class Grid:\n", " def __init__(self, rows: List):\n", " self._rows = rows\n", "\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "class Solution:\n", " def __init__(self, sensors: Tuple, grid: Grid):\n", " self._sensors = sensors\n", " self._sensors_coor = [ (None,None) for i in self._sensors ]\n", " def setsensor(self, sensor: int, coor: Tuple):\n", " self._sensors_coor[sensor] = coor\n", " def printsolution(self):\n", " pass" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[[1, 1, 0, 0, 1, 0],\n", " [1, 0, 0, 1, 1, 1],\n", " [0, 0, 1, 1, 1, 1],\n", " [1, 1, 1, 1, 1, 1],\n", " [0, 0, 0, 1, 1, 1],\n", " [1, 1, 1, 1, 0, 0]]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g = Grid([[1,1,0,0,1,0], [1,0,0,1,1,1], [0,0,1,1,1,1], [1,1,1,1,1,1], [0,0,0,1,1,1], [1,1,1,1,0,0]])\n", "g._rows" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[(None, None), (None, None), (1, 3), (None, None)]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s = Solution([3,2,2,1], g)\n", "s.setsensor(2,(1,3))\n", "s._sensors_coor" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 1 2 3 4 5 6\n", "1 - - X X - X\n", "2 - X X - - -\n", "3 X X - - - -\n", "4 - - - - - -\n", "5 X X X - - -\n", "6 - - - - X X\n" ] } ], "source": [ "g.printgrid()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "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.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }