diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/__pycache__/Action.cpython-314.pyc b/__pycache__/Action.cpython-314.pyc new file mode 100644 index 0000000..e4bbb55 Binary files /dev/null and b/__pycache__/Action.cpython-314.pyc differ diff --git a/__pycache__/Bouton.cpython-314.pyc b/__pycache__/Bouton.cpython-314.pyc new file mode 100644 index 0000000..ce11508 Binary files /dev/null and b/__pycache__/Bouton.cpython-314.pyc differ diff --git a/__pycache__/Commande.cpython-314.pyc b/__pycache__/Commande.cpython-314.pyc new file mode 100644 index 0000000..d318bc5 Binary files /dev/null and b/__pycache__/Commande.cpython-314.pyc differ diff --git a/__pycache__/ConstanteTouche.cpython-314.pyc b/__pycache__/ConstanteTouche.cpython-314.pyc new file mode 100644 index 0000000..4eb0d1f Binary files /dev/null and b/__pycache__/ConstanteTouche.cpython-314.pyc differ diff --git a/__pycache__/Cube.cpython-314.pyc b/__pycache__/Cube.cpython-314.pyc new file mode 100644 index 0000000..1f2e4b1 Binary files /dev/null and b/__pycache__/Cube.cpython-314.pyc differ diff --git a/__pycache__/Cube1x1.cpython-314.pyc b/__pycache__/Cube1x1.cpython-314.pyc new file mode 100644 index 0000000..497833c Binary files /dev/null and b/__pycache__/Cube1x1.cpython-314.pyc differ diff --git a/__pycache__/CubeGetteur.cpython-314.pyc b/__pycache__/CubeGetteur.cpython-314.pyc new file mode 100644 index 0000000..6e6a189 Binary files /dev/null and b/__pycache__/CubeGetteur.cpython-314.pyc differ diff --git a/__pycache__/InterfaceBoutons.cpython-314.pyc b/__pycache__/InterfaceBoutons.cpython-314.pyc new file mode 100644 index 0000000..6d7d40e Binary files /dev/null and b/__pycache__/InterfaceBoutons.cpython-314.pyc differ diff --git a/__pycache__/Solveur.cpython-314.pyc b/__pycache__/Solveur.cpython-314.pyc new file mode 100644 index 0000000..ee3e2c7 Binary files /dev/null and b/__pycache__/Solveur.cpython-314.pyc differ diff --git a/main.py b/main.py deleted file mode 100644 index 0467fb0..0000000 --- a/main.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -#coding: utf-8 - -''' -Created on 5 mai 2017 - -Copyright 2017 Jean-Marie Mineau, Maxime Keller -This file is part of "ISN's Cube". - - "ISN's Cube" is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - "ISN's Cube" is distributed in the hope that it will be useful and - recreative, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with "ISN's Cube". If not, see . - -@author: , Maxime Keller - - https://www.python.org/ (c'est le language, donc important) - Module principale du programme de Rubicks cube. -''' - -import this # (c'est important aussi) -import pygame -from Cube import Cube -from InterfaceBoutons import InterfaceBoutons - -if __name__ == "__main__": - - pygame.init() - - surfaceCube = pygame.Surface((500, 500)) - screen = pygame.display.set_mode((700, 700)) - pygame.display.set_caption("ISN's Cube") - - cube = Cube(surfaceCube) - interfaceBoutons = InterfaceBoutons(screen, cube) - - while True: - surfaceCube.fill((255,255,255)) - screen.fill((255,255,255)) - cube.run() - screen.blit(surfaceCube, (100,100)) - interfaceBoutons.run() - pygame.display.flip() - pygame.time.wait(25) - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f50e234 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[project] +name = "isn-s-cube" +version = "0.1.0" +description = "A 3D Rubik's Cube with a solver. It's a french A-level Project." +readme = "README.md" +requires-python = ">=3.13" +authors = [ + {name = "Jean-Marie Mineau", email = "isn-cube-1UJE@jean-marie.mineau.eu"}, + {name = "Maxime Keller"}, +] +license = "GPL-3.0-or-later" +dependencies = [ + "pygame==2.6.1", +] + +[project.scripts] +isn-s-cube = "isn_s_cube:main" + +[build-system] +requires = ["uv_build>=0.11.15,<0.12.0"] +build-backend = "uv_build" diff --git a/Action.py b/src/isn_s_cube/Action.py similarity index 100% rename from Action.py rename to src/isn_s_cube/Action.py diff --git a/Bouton.py b/src/isn_s_cube/Bouton.py similarity index 100% rename from Bouton.py rename to src/isn_s_cube/Bouton.py diff --git a/Commande.py b/src/isn_s_cube/Commande.py similarity index 95% rename from Commande.py rename to src/isn_s_cube/Commande.py index b4169e8..f0dd4b7 100644 --- a/Commande.py +++ b/src/isn_s_cube/Commande.py @@ -22,8 +22,8 @@ This file is part of "ISN's Cube". """ import pygame from pygame.locals import * -from ConstanteTouche import * -from Action import Action +from .ConstanteTouche import * +from .Action import Action #pygame.init() @@ -101,4 +101,4 @@ class Commande: # self.orientation[2] = 45 # elif event.key == K_LEFT : # self.orientation[2] = 45 - # self.orientation[0] = 45 \ No newline at end of file + # self.orientation[0] = 45 diff --git a/ConstanteTouche.py b/src/isn_s_cube/ConstanteTouche.py similarity index 100% rename from ConstanteTouche.py rename to src/isn_s_cube/ConstanteTouche.py diff --git a/Cube.py b/src/isn_s_cube/Cube.py similarity index 94% rename from Cube.py rename to src/isn_s_cube/Cube.py index c60839e..414e4ca 100644 --- a/Cube.py +++ b/src/isn_s_cube/Cube.py @@ -25,11 +25,11 @@ This file is part of "ISN's Cube". import pygame from operator import itemgetter from random import choice -from Cube1x1 import Cubie3D -from Action import Action -from CubeGetteur import CubeGetteur -from Commande import Commande -from Solveur import Solver +from .Cube1x1 import Cubie3D +from .Action import Action +from .CubeGetteur import CubeGetteur +from .Commande import Commande +from .Solveur import Solver ROUGE, ORANGE, JAUNE, BLANC, VERT, BLEU = (255,0,0), (255,130,20), (255,255,20), (255,255,255), (0,255,0), (0,0,255) @@ -183,4 +183,4 @@ if __name__ == "__main__": pygame.image.save(screen,"./img/pasDeTrie.png") prendreImage = False - \ No newline at end of file + diff --git a/Cube1x1.py b/src/isn_s_cube/Cube1x1.py similarity index 100% rename from Cube1x1.py rename to src/isn_s_cube/Cube1x1.py diff --git a/CubeGetteur.py b/src/isn_s_cube/CubeGetteur.py similarity index 100% rename from CubeGetteur.py rename to src/isn_s_cube/CubeGetteur.py diff --git a/InterfaceBoutons.py b/src/isn_s_cube/InterfaceBoutons.py similarity index 91% rename from InterfaceBoutons.py rename to src/isn_s_cube/InterfaceBoutons.py index b788d6d..41b23af 100644 --- a/InterfaceBoutons.py +++ b/src/isn_s_cube/InterfaceBoutons.py @@ -24,7 +24,10 @@ Interface de boutons fait à la va vite. """ import pygame -from Bouton import Boutons +from .Bouton import Boutons + +from pathlib import Path +IMG_FOLDER = Path(__file__).parent / "img" def addAction(cube, action): @@ -32,8 +35,8 @@ def addAction(cube, action): cube.action.actions.append(action) -CARACTS_BOUTONS = [[(100,30), "img/B1.png", addAction, ["ALEA"]], - [(400,30), "img/B2.png", addAction, ["SOLVE"]], +CARACTS_BOUTONS = [[(100,30), IMG_FOLDER / "B1.png", addAction, ["ALEA"]], + [(400,30), IMG_FOLDER / "B2.png", addAction, ["SOLVE"]], [(100,600), None, addAction, ["B CW"]], [(500,600), None, addAction, ["B ACW"]], [(200,600), None, addAction, ["AV CW"]], diff --git a/Solveur.py b/src/isn_s_cube/Solveur.py similarity index 100% rename from Solveur.py rename to src/isn_s_cube/Solveur.py diff --git a/src/isn_s_cube/__init__.py b/src/isn_s_cube/__init__.py new file mode 100644 index 0000000..e7d74ae --- /dev/null +++ b/src/isn_s_cube/__init__.py @@ -0,0 +1,25 @@ +import pygame +from .Cube import Cube +from .InterfaceBoutons import InterfaceBoutons + + +def main() -> None: + import this # (c'est important aussi) + + pygame.init() + + surfaceCube = pygame.Surface((500, 500)) + screen = pygame.display.set_mode((700, 700)) + pygame.display.set_caption("ISN's Cube") + + cube = Cube(surfaceCube) + interfaceBoutons = InterfaceBoutons(screen, cube) + + while True: + surfaceCube.fill((255, 255, 255)) + screen.fill((255, 255, 255)) + cube.run() + screen.blit(surfaceCube, (100, 100)) + interfaceBoutons.run() + pygame.display.flip() + pygame.time.wait(25) diff --git a/img/B1.png b/src/isn_s_cube/img/B1.png similarity index 100% rename from img/B1.png rename to src/isn_s_cube/img/B1.png diff --git a/img/B2.png b/src/isn_s_cube/img/B2.png similarity index 100% rename from img/B2.png rename to src/isn_s_cube/img/B2.png diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..a55f020 --- /dev/null +++ b/uv.lock @@ -0,0 +1,29 @@ +version = 1 +revision = 3 +requires-python = ">=3.13" + +[[package]] +name = "isn-s-cube" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "pygame" }, +] + +[package.metadata] +requires-dist = [{ name = "pygame", specifier = "==2.6.1" }] + +[[package]] +name = "pygame" +version = "2.6.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/49/cc/08bba60f00541f62aaa252ce0cfbd60aebd04616c0b9574f755b583e45ae/pygame-2.6.1.tar.gz", hash = "sha256:56fb02ead529cee00d415c3e007f75e0780c655909aaa8e8bf616ee09c9feb1f", size = 14808125, upload-time = "2024-09-29T13:41:34.698Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e1/91/718acf3e2a9d08a6ddcc96bd02a6f63c99ee7ba14afeaff2a51c987df0b9/pygame-2.6.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ae6039f3a55d800db80e8010f387557b528d34d534435e0871326804df2a62f2", size = 13090765, upload-time = "2024-09-29T14:27:02.377Z" }, + { url = "https://files.pythonhosted.org/packages/0e/c6/9cb315de851a7682d9c7568a41ea042ee98d668cb8deadc1dafcab6116f0/pygame-2.6.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2a3a1288e2e9b1e5834e425bedd5ba01a3cd4902b5c2bff8ed4a740ccfe98171", size = 12381704, upload-time = "2024-09-29T14:27:10.228Z" }, + { url = "https://files.pythonhosted.org/packages/9f/8f/617a1196e31ae3b46be6949fbaa95b8c93ce15e0544266198c2266cc1b4d/pygame-2.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:27eb17e3dc9640e4b4683074f1890e2e879827447770470c2aba9f125f74510b", size = 13581091, upload-time = "2024-09-29T11:30:27.653Z" }, + { url = "https://files.pythonhosted.org/packages/3b/87/2851a564e40a2dad353f1c6e143465d445dab18a95281f9ea458b94f3608/pygame-2.6.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c1623180e70a03c4a734deb9bac50fc9c82942ae84a3a220779062128e75f3b", size = 14273844, upload-time = "2024-09-29T11:40:04.138Z" }, + { url = "https://files.pythonhosted.org/packages/85/b5/aa23aa2e70bcba42c989c02e7228273c30f3b44b9b264abb93eaeff43ad7/pygame-2.6.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef07c0103d79492c21fced9ad68c11c32efa6801ca1920ebfd0f15fb46c78b1c", size = 13951197, upload-time = "2024-09-29T11:40:06.785Z" }, + { url = "https://files.pythonhosted.org/packages/a6/06/29e939b34d3f1354738c7d201c51c250ad7abefefaf6f8332d962ff67c4b/pygame-2.6.1-cp313-cp313-win32.whl", hash = "sha256:3acd8c009317190c2bfd81db681ecef47d5eb108c2151d09596d9c7ea9df5c0e", size = 10249309, upload-time = "2024-09-29T11:10:23.329Z" }, + { url = "https://files.pythonhosted.org/packages/7e/11/17f7f319ca91824b86557e9303e3b7a71991ef17fd45286bf47d7f0a38e6/pygame-2.6.1-cp313-cp313-win_amd64.whl", hash = "sha256:813af4fba5d0b2cb8e58f5d95f7910295c34067dcc290d34f1be59c48bd1ea6a", size = 10620084, upload-time = "2024-09-29T11:48:51.587Z" }, +]