This commit is contained in:
Kseninia Mikhaylova 2024-05-17 16:05:19 +03:00
commit bf16f392b8
15 changed files with 360 additions and 269 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.venv
poetry.lock
files/*
.vscode/

View File

@ -1,39 +1,4 @@
[
{
"label": "annotations",
"importPath": "__future__",
"description": "__future__",
"isExtraImport": true,
"detail": "__future__",
"documentation": {}
},
{
"label": "os",
"kind": 6,
"isExtraImport": true,
"importPath": "os",
"description": "os",
"detail": "os",
"documentation": {}
},
{
"label": "site",
"kind": 6,
"isExtraImport": true,
"importPath": "site",
"description": "site",
"detail": "site",
"documentation": {}
},
{
"label": "sys",
"kind": 6,
"isExtraImport": true,
"importPath": "sys",
"description": "sys",
"detail": "sys",
"documentation": {}
},
{
"label": "json",
"kind": 6,
@ -132,6 +97,15 @@
"detail": "gyp.common",
"documentation": {}
},
{
"label": "os",
"kind": 6,
"isExtraImport": true,
"importPath": "os",
"description": "os",
"detail": "os",
"documentation": {}
},
{
"label": "posixpath",
"kind": 6,
@ -275,6 +249,15 @@
"detail": "code",
"documentation": {}
},
{
"label": "sys",
"kind": 6,
"isExtraImport": true,
"importPath": "sys",
"description": "sys",
"detail": "sys",
"documentation": {}
},
{
"label": "hashlib",
"kind": 6,
@ -1613,6 +1596,22 @@
"detail": "django.db",
"documentation": {}
},
{
"label": "migrations",
"importPath": "django.db",
"description": "django.db",
"isExtraImport": true,
"detail": "django.db",
"documentation": {}
},
{
"label": "models",
"importPath": "django.db",
"description": "django.db",
"isExtraImport": true,
"detail": "django.db",
"documentation": {}
},
{
"label": "models",
"importPath": "django.db",
@ -1797,105 +1796,6 @@
"detail": "django.core.wsgi",
"documentation": {}
},
{
"label": "cv2",
"kind": 6,
"isExtraImport": true,
"importPath": "cv2",
"description": "cv2",
"detail": "cv2",
"documentation": {}
},
{
"label": "numpy",
"kind": 6,
"isExtraImport": true,
"importPath": "numpy",
"description": "numpy",
"detail": "numpy",
"documentation": {}
},
{
"label": "bin_dir",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "bin_dir = os.path.dirname(abs_file)\nbase = bin_dir[: -len(\"bin\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"interactive-table-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "base",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "base = bin_dir[: -len(\"bin\") - 1] # strip away the bin part from the __file__, plus the path separator\n# prepend bin to PATH (this file is inside the bin directory)\nos.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"interactive-table-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "os.environ[\"PATH\"]",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "os.environ[\"PATH\"] = os.pathsep.join([bin_dir, *os.environ.get(\"PATH\", \"\").split(os.pathsep)])\nos.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"interactive-table-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "os.environ[\"VIRTUAL_ENV\"]",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "os.environ[\"VIRTUAL_ENV\"] = base # virtual env is right above bin directory\nos.environ[\"VIRTUAL_ENV_PROMPT\"] = \"interactive-table-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "os.environ[\"VIRTUAL_ENV_PROMPT\"]",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "os.environ[\"VIRTUAL_ENV_PROMPT\"] = \"interactive-table-py3.10\" or os.path.basename(base) # noqa: SIM222\n# add the virtual environments libraries to the host python import mechanism\nprev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "prev_length",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "prev_length = len(sys.path)\nfor lib in \"../lib/python3.10/site-packages\".split(os.pathsep):\n path = os.path.realpath(os.path.join(bin_dir, lib))\n site.addsitedir(path.decode(\"utf-8\") if \"\" else path)\nsys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "sys.path[:]",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]\nsys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "sys.real_prefix",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "sys.real_prefix = sys.prefix\nsys.prefix = base",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "sys.prefix",
"kind": 5,
"importPath": ".venv.bin.activate_this",
"description": ".venv.bin.activate_this",
"peekOfCode": "sys.prefix = base",
"detail": ".venv.bin.activate_this",
"documentation": {}
},
{
"label": "_Known",
"kind": 6,
@ -8439,6 +8339,15 @@
"detail": "back.api.migrations.0006_product_image2_product_image3",
"documentation": {}
},
{
"label": "Migration",
"kind": 6,
"importPath": "back.api.migrations.0007_floorplan_alter_product_image1_alter_product_image2_and_more",
"description": "back.api.migrations.0007_floorplan_alter_product_image1_alter_product_image2_and_more",
"peekOfCode": "class Migration(migrations.Migration):\n dependencies = [\n ('api', '0006_product_image2_product_image3'),\n ]\n operations = [\n migrations.CreateModel(\n name='FloorPlan',\n fields=[\n ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),\n ('title', models.CharField(max_length=200)),",
"detail": "back.api.migrations.0007_floorplan_alter_product_image1_alter_product_image2_and_more",
"documentation": {}
},
{
"label": "ApiConfig",
"kind": 6,
@ -8708,68 +8617,5 @@
"peekOfCode": "def main():\n \"\"\"Run administrative tasks.\"\"\"\n os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'back.settings')\n try:\n from django.core.management import execute_from_command_line\n except ImportError as exc:\n raise ImportError(\n \"Couldn't import Django. Are you sure it's installed and \"\n \"available on your PYTHONPATH environment variable? Did you \"\n \"forget to activate a virtual environment?\"",
"detail": "back.manage",
"documentation": {}
},
{
"label": "img",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "img = cv2.imread(\n \"/home/arizona/projects/svs_tech/demo-int-table/admin_front/assets/img/plan.png\"\n)\n(h, w) = img.shape[:2]\nt = 1600\nimg = cv2.resize(img, (t, int((h/w) * t)))\ngray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\ngray = 255 - gray\ngray = cv2.blur(gray, (8, 1))\ngray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]",
"detail": "test",
"documentation": {}
},
{
"label": "t",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "t = 1600\nimg = cv2.resize(img, (t, int((h/w) * t)))\ngray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\ngray = 255 - gray\ngray = cv2.blur(gray, (8, 1))\ngray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]\ncontours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)\nfor cnt in contours:\n area = cv2.contourArea(cnt)\n if area > 150000 and area < 500000:",
"detail": "test",
"documentation": {}
},
{
"label": "img",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "img = cv2.resize(img, (t, int((h/w) * t)))\ngray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\ngray = 255 - gray\ngray = cv2.blur(gray, (8, 1))\ngray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]\ncontours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)\nfor cnt in contours:\n area = cv2.contourArea(cnt)\n if area > 150000 and area < 500000:\n cv2.drawContours(img, [cnt], 0, (255, 0, 0), 2)",
"detail": "test",
"documentation": {}
},
{
"label": "gray",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\ngray = 255 - gray\ngray = cv2.blur(gray, (8, 1))\ngray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]\ncontours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)\nfor cnt in contours:\n area = cv2.contourArea(cnt)\n if area > 150000 and area < 500000:\n cv2.drawContours(img, [cnt], 0, (255, 0, 0), 2)\ncv2.imshow(\"img\", img)",
"detail": "test",
"documentation": {}
},
{
"label": "gray",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "gray = 255 - gray\ngray = cv2.blur(gray, (8, 1))\ngray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]\ncontours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)\nfor cnt in contours:\n area = cv2.contourArea(cnt)\n if area > 150000 and area < 500000:\n cv2.drawContours(img, [cnt], 0, (255, 0, 0), 2)\ncv2.imshow(\"img\", img)\ncv2.waitKey()",
"detail": "test",
"documentation": {}
},
{
"label": "gray",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "gray = cv2.blur(gray, (8, 1))\ngray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]\ncontours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)\nfor cnt in contours:\n area = cv2.contourArea(cnt)\n if area > 150000 and area < 500000:\n cv2.drawContours(img, [cnt], 0, (255, 0, 0), 2)\ncv2.imshow(\"img\", img)\ncv2.waitKey()",
"detail": "test",
"documentation": {}
},
{
"label": "gray",
"kind": 5,
"importPath": "test",
"description": "test",
"peekOfCode": "gray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]\ncontours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)\nfor cnt in contours:\n area = cv2.contourArea(cnt)\n if area > 150000 and area < 500000:\n cv2.drawContours(img, [cnt], 0, (255, 0, 0), 2)\ncv2.imshow(\"img\", img)\ncv2.waitKey()",
"detail": "test",
"documentation": {}
}
]

2
back/.gitignore vendored
View File

@ -89,6 +89,6 @@ local_settings.py
.env
db.sqlite3
migrations/00*
api/migrations/00*
files/*

View File

@ -6,7 +6,7 @@ djangorestframework==3.15.1 ; python_version >= "3.10" and python_version < "4.0
mslex==1.2.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32"
pillow==10.3.0 ; python_version >= "3.10" and python_version < "4.0"
psutil==5.9.8 ; python_version >= "3.10" and python_version < "4.0"
psycopg2==2.9.9 ; python_version >= "3.10" and python_version < "4.0"
psycopg2-binary==2.9.9 ; python_version >= "3.10" and python_version < "4.0"
python-dotenv==1.0.1 ; python_version >= "3.10" and python_version < "4.0"
sqlparse==0.5.0 ; python_version >= "3.10" and python_version < "4.0"
taskipy==1.12.2 ; python_version >= "3.10" and python_version < "4.0"

View File

@ -18,6 +18,7 @@ services:
- ./files:/app/files
networks:
- network
- dev
front:
build:
@ -32,6 +33,7 @@ services:
condition: service_healthy
networks:
- network
- dev
nginx:
image: nginx:1.25
@ -50,7 +52,14 @@ services:
- ./nginx/conf.d:/etc/nginx/conf.d
networks:
- network
- dev
networks:
network:
driver: bridge
dev:
driver: bridge
ipam:
config:
- subnet: 10.66.0.0/16
gateway: 10.66.0.1

View File

@ -7,6 +7,7 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
Game: typeof import('./src/components/Game.vue')['default']
Home: typeof import('./src/components/Home.vue')['default']
IMdi3dRotation: typeof import('~icons/mdi/3d-rotation')['default']
IMdiCard: typeof import('~icons/mdi/card')['default']
@ -17,5 +18,7 @@ declare module 'vue' {
IMdiVideo3d: typeof import('~icons/mdi/video3d')['default']
Projects: typeof import('./src/components/Projects.vue')['default']
RandomIcon: typeof import('./src/components/RandomIcon.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}

View File

@ -9,6 +9,7 @@
"version": "0.0.0",
"dependencies": {
"@fireworks-js/vue": "^2.10.7",
"@vueuse/components": "^10.9.0",
"@vueuse/core": "^10.9.0",
"pinia": "^2.1.7",
"reset-css": "^5.0.2",
@ -950,6 +951,41 @@
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.25.tgz",
"integrity": "sha512-k0yappJ77g2+KNrIaF0FFnzwLvUBLUYr8VOwz+/6vLsmItFp51AcxLL7Ey3iPd7BIRyWPOcqUjMnm7OkahXllA=="
},
"node_modules/@vueuse/components": {
"version": "10.9.0",
"resolved": "https://registry.npmjs.org/@vueuse/components/-/components-10.9.0.tgz",
"integrity": "sha512-BHQpA0yIi3y7zKa1gYD0FUzLLkcRTqVhP8smnvsCK6GFpd94Nziq1XVPD7YpFeho0k5BzbBiNZF7V/DpkJ967A==",
"dependencies": {
"@vueuse/core": "10.9.0",
"@vueuse/shared": "10.9.0",
"vue-demi": ">=0.14.7"
}
},
"node_modules/@vueuse/components/node_modules/vue-demi": {
"version": "0.14.7",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz",
"integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==",
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vueuse/core": {
"version": "10.9.0",
"resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.9.0.tgz",

View File

@ -10,6 +10,7 @@
},
"dependencies": {
"@fireworks-js/vue": "^2.10.7",
"@vueuse/components": "^10.9.0",
"@vueuse/core": "^10.9.0",
"pinia": "^2.1.7",
"reset-css": "^5.0.2",

View File

@ -0,0 +1,151 @@
<script setup lang="ts">
import { ref } from 'vue';
import { UseDraggable } from '@vueuse/components';
import { type Position } from '@vueuse/core';
import { random_сolor, shuffle_array, getRandomIntInclusive } from '../helpers';
import icon1 from '~icons/mdi/square';
import icon1_o from '~icons/mdi/square-outline';
import icon2 from '~icons/mdi/triangle';
import icon2_o from '~icons/mdi/triangle-outline';
import icon3 from '~icons/mdi/circle';
import icon3_o from '~icons/mdi/circle-outline';
import icon4 from '~icons/mdi/hexagon';
import icon4_o from '~icons/mdi/hexagon-outline';
const icons_list = [
icon1,
icon1_o,
icon2,
icon2_o,
icon3,
icon3_o,
icon4,
icon4_o,
]
const colors = ref([
random_сolor(),
random_сolor(),
random_сolor(),
random_сolor(),
])
const icons = [
{
id: 1, fill: 0, outline: 1,
},
{
id: 2, fill: 2, outline: 3,
},
{
id: 3, fill: 4, outline: 5,
},
{
id: 4, fill: 6, outline: 7,
},
]
const source_icons = ref(shuffle_array(icons))
const target_icons = ref(shuffle_array(icons))
const active_drag = ref<string | null>(null)
const dragStart = (_: Position, event: PointerEvent) => {
const element = event.currentTarget
if (element instanceof HTMLElement && element.dataset.id) {
active_drag.value = element.dataset.id
}
}
const dragEnd = (position: Position, _: PointerEvent) => {
const target = document.elementsFromPoint(position.x, position.y).find(el => el.className == 'target-item')
if (target instanceof HTMLElement && target.dataset.id) {
const targetId = target.dataset.id
const sourceId = active_drag.value
if (targetId == sourceId) {
success.value.push(parseInt(targetId))
}
}
}
const componentKey = ref(0)
const success = ref<number[]>([])
const updateGame = () => {
success.value = []
componentKey.value += 1
source_icons.value = shuffle_array(icons)
target_icons.value = shuffle_array(icons)
colors.value = [random_сolor(), random_сolor(), random_сolor(), random_сolor()]
}
const coor = (n: number) => {
let x = 0
let y = 0
const groups = [
{ x: [100, 1400], y: [100, 300] },
{ x: [1400, 1600], y: [100, 800] },
{ x: [100, 1600], y: [700, 800] },
{ x: [100, 200], y: [100, 800] },
]
const d = groups[n]
x = getRandomIntInclusive(d.x[0], d.x[1])
y = getRandomIntInclusive(d.y[0], d.y[1])
return { x, y }
}
</script>
<template>
<div class="game" :key="componentKey">
<div class="target">
<span class="target-item" v-for="item in target_icons" :data-id="item.id">
<component :is="success.includes(item.id) ? icons_list[item.fill] : icons_list[item.outline]"
:style="{ 'color': colors[item.id - 1] }"></component>
</span>
</div>
<UseDraggable v-for="item in source_icons" class="source-item" :data-id="item.id"
:initial-value="coor(getRandomIntInclusive(1, 3))" :on-start="dragStart" :on-end="dragEnd">
<component v-if="!success.includes(item.id)" :is="icons_list[item.fill]"
:style="{ 'color': colors[item.id - 1] }" :ref="item.ref"></component>
</UseDraggable>
<div class="links" v-if="success.length >= icons.length">
<RouterLink to="/">На главную</RouterLink>
<RouterLink to="/game" @click="updateGame">Еще раз</RouterLink>
</div>
</div>
</template>
<style scoped lans="scss">
.game {
position: fixed;
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.target {
display: flex;
width: 100%;
justify-content: center;
gap: 2rem;
}
.target-item {
font-size: 12rem;
}
.source-item {
font-size: 7rem;
position: absolute;
}
.links {
display: flex;
flex-direction: column;
font-size: 5rem;
align-items: center;
gap: 1rem;
}
.links a {
text-decoration: none;
color: black;
}
</style>

View File

@ -12,6 +12,9 @@
<li>
<RouterLink to="projects">Проекты</RouterLink>
</li>
<li>
<RouterLink to="game">Игра</RouterLink>
</li>
<li>
<a href="https://timesheet.kustarshina.ru/">Табель рабочего времени</a>
</li>

View File

@ -3,3 +3,25 @@ export const getRandomIntInclusive = (min: number, max: number) => {
const maxFloored = Math.floor(max);
return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled); // The maximum is inclusive and the minimum is inclusive
}
export const shuffle_array = (array: any[]) => {
let currentIndex = array.length;
// While there remain elements to shuffle...
while (currentIndex != 0) {
// Pick a remaining element...
let randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex--;
// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]];
}
return array
}
export const random_сolor = () => {
const r = () => Math.floor(200 * Math.random());
return `rgb(${r()}, ${r()}, ${r()})`;
}

View File

@ -7,10 +7,12 @@ import './assets/main.scss'
import App from './App.vue'
import Home from './components/Home.vue'
import Projects from './components/Projects.vue'
import Game from './components/Game.vue'
const routes = [
{ path: '/', component: Home },
{ path: '/projects', component: Projects },
{ path: '/game', component: Game },
]
const router = createRouter({

91
poetry.lock generated
View File

@ -289,25 +289,84 @@ files = [
test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"]
[[package]]
name = "psycopg2"
name = "psycopg2-binary"
version = "2.9.9"
description = "psycopg2 - Python-PostgreSQL Database Adapter"
optional = false
python-versions = ">=3.7"
files = [
{file = "psycopg2-2.9.9-cp310-cp310-win32.whl", hash = "sha256:38a8dcc6856f569068b47de286b472b7c473ac7977243593a288ebce0dc89516"},
{file = "psycopg2-2.9.9-cp310-cp310-win_amd64.whl", hash = "sha256:426f9f29bde126913a20a96ff8ce7d73fd8a216cfb323b1f04da402d452853c3"},
{file = "psycopg2-2.9.9-cp311-cp311-win32.whl", hash = "sha256:ade01303ccf7ae12c356a5e10911c9e1c51136003a9a1d92f7aa9d010fb98372"},
{file = "psycopg2-2.9.9-cp311-cp311-win_amd64.whl", hash = "sha256:121081ea2e76729acfb0673ff33755e8703d45e926e416cb59bae3a86c6a4981"},
{file = "psycopg2-2.9.9-cp312-cp312-win32.whl", hash = "sha256:d735786acc7dd25815e89cc4ad529a43af779db2e25aa7c626de864127e5a024"},
{file = "psycopg2-2.9.9-cp312-cp312-win_amd64.whl", hash = "sha256:a7653d00b732afb6fc597e29c50ad28087dcb4fbfb28e86092277a559ae4e693"},
{file = "psycopg2-2.9.9-cp37-cp37m-win32.whl", hash = "sha256:5e0d98cade4f0e0304d7d6f25bbfbc5bd186e07b38eac65379309c4ca3193efa"},
{file = "psycopg2-2.9.9-cp37-cp37m-win_amd64.whl", hash = "sha256:7e2dacf8b009a1c1e843b5213a87f7c544b2b042476ed7755be813eaf4e8347a"},
{file = "psycopg2-2.9.9-cp38-cp38-win32.whl", hash = "sha256:ff432630e510709564c01dafdbe996cb552e0b9f3f065eb89bdce5bd31fabf4c"},
{file = "psycopg2-2.9.9-cp38-cp38-win_amd64.whl", hash = "sha256:bac58c024c9922c23550af2a581998624d6e02350f4ae9c5f0bc642c633a2d5e"},
{file = "psycopg2-2.9.9-cp39-cp39-win32.whl", hash = "sha256:c92811b2d4c9b6ea0285942b2e7cac98a59e166d59c588fe5cfe1eda58e72d59"},
{file = "psycopg2-2.9.9-cp39-cp39-win_amd64.whl", hash = "sha256:de80739447af31525feddeb8effd640782cf5998e1a4e9192ebdf829717e3913"},
{file = "psycopg2-2.9.9.tar.gz", hash = "sha256:d1454bde93fb1e224166811694d600e746430c006fbb031ea06ecc2ea41bf156"},
{file = "psycopg2-binary-2.9.9.tar.gz", hash = "sha256:7f01846810177d829c7692f1f5ada8096762d9172af1b1a28d4ab5b77c923c1c"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c2470da5418b76232f02a2fcd2229537bb2d5a7096674ce61859c3229f2eb202"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c6af2a6d4b7ee9615cbb162b0738f6e1fd1f5c3eda7e5da17861eacf4c717ea7"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:75723c3c0fbbf34350b46a3199eb50638ab22a0228f93fb472ef4d9becc2382b"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:83791a65b51ad6ee6cf0845634859d69a038ea9b03d7b26e703f94c7e93dbcf9"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0ef4854e82c09e84cc63084a9e4ccd6d9b154f1dbdd283efb92ecd0b5e2b8c84"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ed1184ab8f113e8d660ce49a56390ca181f2981066acc27cf637d5c1e10ce46e"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d2997c458c690ec2bc6b0b7ecbafd02b029b7b4283078d3b32a852a7ce3ddd98"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:b58b4710c7f4161b5e9dcbe73bb7c62d65670a87df7bcce9e1faaad43e715245"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:0c009475ee389757e6e34611d75f6e4f05f0cf5ebb76c6037508318e1a1e0d7e"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8dbf6d1bc73f1d04ec1734bae3b4fb0ee3cb2a493d35ede9badbeb901fb40f6f"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-win32.whl", hash = "sha256:3f78fd71c4f43a13d342be74ebbc0666fe1f555b8837eb113cb7416856c79682"},
{file = "psycopg2_binary-2.9.9-cp310-cp310-win_amd64.whl", hash = "sha256:876801744b0dee379e4e3c38b76fc89f88834bb15bf92ee07d94acd06ec890a0"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ee825e70b1a209475622f7f7b776785bd68f34af6e7a46e2e42f27b659b5bc26"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1ea665f8ce695bcc37a90ee52de7a7980be5161375d42a0b6c6abedbf0d81f0f"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:143072318f793f53819048fdfe30c321890af0c3ec7cb1dfc9cc87aa88241de2"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c332c8d69fb64979ebf76613c66b985414927a40f8defa16cf1bc028b7b0a7b0"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7fc5a5acafb7d6ccca13bfa8c90f8c51f13d8fb87d95656d3950f0158d3ce53"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:977646e05232579d2e7b9c59e21dbe5261f403a88417f6a6512e70d3f8a046be"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b6356793b84728d9d50ead16ab43c187673831e9d4019013f1402c41b1db9b27"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:bc7bb56d04601d443f24094e9e31ae6deec9ccb23581f75343feebaf30423359"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:77853062a2c45be16fd6b8d6de2a99278ee1d985a7bd8b103e97e41c034006d2"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:78151aa3ec21dccd5cdef6c74c3e73386dcdfaf19bced944169697d7ac7482fc"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-win32.whl", hash = "sha256:dc4926288b2a3e9fd7b50dc6a1909a13bbdadfc67d93f3374d984e56f885579d"},
{file = "psycopg2_binary-2.9.9-cp311-cp311-win_amd64.whl", hash = "sha256:b76bedd166805480ab069612119ea636f5ab8f8771e640ae103e05a4aae3e417"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:8532fd6e6e2dc57bcb3bc90b079c60de896d2128c5d9d6f24a63875a95a088cf"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b0605eaed3eb239e87df0d5e3c6489daae3f7388d455d0c0b4df899519c6a38d"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f8544b092a29a6ddd72f3556a9fcf249ec412e10ad28be6a0c0d948924f2212"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2d423c8d8a3c82d08fe8af900ad5b613ce3632a1249fd6a223941d0735fce493"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e5afae772c00980525f6d6ecf7cbca55676296b580c0e6abb407f15f3706996"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e6f98446430fdf41bd36d4faa6cb409f5140c1c2cf58ce0bbdaf16af7d3f119"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:c77e3d1862452565875eb31bdb45ac62502feabbd53429fdc39a1cc341d681ba"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:cb16c65dcb648d0a43a2521f2f0a2300f40639f6f8c1ecbc662141e4e3e1ee07"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:911dda9c487075abd54e644ccdf5e5c16773470a6a5d3826fda76699410066fb"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:57fede879f08d23c85140a360c6a77709113efd1c993923c59fde17aa27599fe"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-win32.whl", hash = "sha256:64cf30263844fa208851ebb13b0732ce674d8ec6a0c86a4e160495d299ba3c93"},
{file = "psycopg2_binary-2.9.9-cp312-cp312-win_amd64.whl", hash = "sha256:81ff62668af011f9a48787564ab7eded4e9fb17a4a6a74af5ffa6a457400d2ab"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2293b001e319ab0d869d660a704942c9e2cce19745262a8aba2115ef41a0a42a"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:03ef7df18daf2c4c07e2695e8cfd5ee7f748a1d54d802330985a78d2a5a6dca9"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a602ea5aff39bb9fac6308e9c9d82b9a35c2bf288e184a816002c9fae930b77"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8359bf4791968c5a78c56103702000105501adb557f3cf772b2c207284273984"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:275ff571376626195ab95a746e6a04c7df8ea34638b99fc11160de91f2fef503"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:f9b5571d33660d5009a8b3c25dc1db560206e2d2f89d3df1cb32d72c0d117d52"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:420f9bbf47a02616e8554e825208cb947969451978dceb77f95ad09c37791dae"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:4154ad09dac630a0f13f37b583eae260c6aa885d67dfbccb5b02c33f31a6d420"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a148c5d507bb9b4f2030a2025c545fccb0e1ef317393eaba42e7eabd28eb6041"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-win32.whl", hash = "sha256:68fc1f1ba168724771e38bee37d940d2865cb0f562380a1fb1ffb428b75cb692"},
{file = "psycopg2_binary-2.9.9-cp37-cp37m-win_amd64.whl", hash = "sha256:281309265596e388ef483250db3640e5f414168c5a67e9c665cafce9492eda2f"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:60989127da422b74a04345096c10d416c2b41bd7bf2a380eb541059e4e999980"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:246b123cc54bb5361588acc54218c8c9fb73068bf227a4a531d8ed56fa3ca7d6"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:34eccd14566f8fe14b2b95bb13b11572f7c7d5c36da61caf414d23b91fcc5d94"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:18d0ef97766055fec15b5de2c06dd8e7654705ce3e5e5eed3b6651a1d2a9a152"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d3f82c171b4ccd83bbaf35aa05e44e690113bd4f3b7b6cc54d2219b132f3ae55"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ead20f7913a9c1e894aebe47cccf9dc834e1618b7aa96155d2091a626e59c972"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ca49a8119c6cbd77375ae303b0cfd8c11f011abbbd64601167ecca18a87e7cdd"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:323ba25b92454adb36fa425dc5cf6f8f19f78948cbad2e7bc6cdf7b0d7982e59"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:1236ed0952fbd919c100bc839eaa4a39ebc397ed1c08a97fc45fee2a595aa1b3"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:729177eaf0aefca0994ce4cffe96ad3c75e377c7b6f4efa59ebf003b6d398716"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-win32.whl", hash = "sha256:804d99b24ad523a1fe18cc707bf741670332f7c7412e9d49cb5eab67e886b9b5"},
{file = "psycopg2_binary-2.9.9-cp38-cp38-win_amd64.whl", hash = "sha256:a6cdcc3ede532f4a4b96000b6362099591ab4a3e913d70bcbac2b56c872446f7"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:72dffbd8b4194858d0941062a9766f8297e8868e1dd07a7b36212aaa90f49472"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:30dcc86377618a4c8f3b72418df92e77be4254d8f89f14b8e8f57d6d43603c0f"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:31a34c508c003a4347d389a9e6fcc2307cc2150eb516462a7a17512130de109e"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:15208be1c50b99203fe88d15695f22a5bed95ab3f84354c494bcb1d08557df67"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1873aade94b74715be2246321c8650cabf5a0d098a95bab81145ffffa4c13876"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a58c98a7e9c021f357348867f537017057c2ed7f77337fd914d0bedb35dace7"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4686818798f9194d03c9129a4d9a702d9e113a89cb03bffe08c6cf799e053291"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:ebdc36bea43063116f0486869652cb2ed7032dbc59fbcb4445c4862b5c1ecf7f"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:ca08decd2697fdea0aea364b370b1249d47336aec935f87b8bbfd7da5b2ee9c1"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ac05fb791acf5e1a3e39402641827780fe44d27e72567a000412c648a85ba860"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-win32.whl", hash = "sha256:9dba73be7305b399924709b91682299794887cbbd88e38226ed9f6712eabee90"},
{file = "psycopg2_binary-2.9.9-cp39-cp39-win_amd64.whl", hash = "sha256:f7ae5d65ccfbebdfa761585228eb4d0df3a8b15cfb53bd953e713e09fbb12957"},
]
[[package]]
@ -392,4 +451,8 @@ files = [
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
<<<<<<< HEAD
content-hash = "1c57908ec6786460241b91a63e9b1e30eb78d340264c8e798eaa35041f9bc9f6"
=======
content-hash = "12eafe363191a2fa6620d9db98c1628ddf831034842d5d0a68cb88fcd2176d13"
>>>>>>> bx-434-game

View File

@ -3,8 +3,13 @@ name = "interactive-table"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
<<<<<<< HEAD
readme = "README.md"
package-mode=false
=======
readme = "readme.md"
package-mode = false
>>>>>>> bx-434-game
[tool.poetry.dependencies]
python = "^3.10"
@ -14,9 +19,13 @@ taskipy = "^1.12.2"
django-cors-headers = "^4.3.1"
pillow = "^10.3.0"
python-dotenv = "^1.0.1"
<<<<<<< HEAD
psycopg2 = "^2.9.9"
opencv-python = "^4.9.0.80"
potracer = "^0.0.4"
=======
psycopg2-binary = "^2.9.9"
>>>>>>> bx-434-game
[build-system]

55
test.py
View File

@ -1,55 +0,0 @@
import cv2
import numpy as np
# def image_resize(image, width = None, height = None, inter = cv2.INTER_AREA):
# # initialize the dimensions of the image to be resized and
# # grab the image size
# dim = None
# (h, w) = image.shape[:2]
# # if both the width and height are None, then return the
# # original image
# if width is None and height is None:
# return image
# # check to see if the width is None
# if width is None:
# # calculate the ratio of the height and construct the
# # dimensions
# r = height / float(h)
# dim = (int(w * r), height)
# # otherwise, the height is None
# else:
# # calculate the ratio of the width and construct the
# # dimensions
# r = width / float(w)
# dim = (width, int(h * r))
# # resize the image
# resized = cv2.resize(image, dim, interpolation = inter)
# # return the resized image
# return resized
img = cv2.imread(
"/home/arizona/projects/svs_tech/demo-int-table/admin_front/assets/img/plan.png"
)
(h, w) = img.shape[:2]
t = 1600
img = cv2.resize(img, (t, int((h/w) * t)))
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = 255 - gray
gray = cv2.blur(gray, (8, 1))
gray = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)[1]
contours, hierarchy = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
for cnt in contours:
area = cv2.contourArea(cnt)
if area > 150000 and area < 500000:
cv2.drawContours(img, [cnt], 0, (255, 0, 0), 2)
cv2.imshow("img", img)
cv2.waitKey()