Jeu Paste

  • Auteur de la discussion Auteur de la discussion Skallex
  • Date de début Date de début
#define BOOST_NO_CXX11_SCOPED_ENUMS
#include<boost/filesystem.hpp>
#undef BOOST_NO_CXX11_SCOPED_ENUMS
 
Code:
        lCopyTo:
        memory[instr->argument] = *sp;
        goto lBegin;

        lCopyFrom:
        *sp = memory[instr->argument];
        goto lBegin;

        lCopyToStorage:
        *memory.data() = *sp;
        goto lBegin;

        lCopyFromStorage:
        *sp = *memory.data();
        goto lBegin;

        lBitshiftRight:
        (*sp) >>= instr->argument;
        goto lBegin;

        lBitshiftLeft:
        (*sp) <<= instr->argument;
        goto lBegin;

        lBitshiftRightOnce:
        (*sp) >>= 1;
        goto lBegin;

        lBitshiftLeftOnce:
        (*sp) <<= 1;
        goto lBegin;

        lNot:
        *sp = ~(*sp);
        goto lBegin;

        lXor:
        (*sp) ^= *(memory.data());
        goto lBegin;

        lAnd:
        (*sp) &= *(memory.data());
        goto lBegin;

        lOr:
        (*sp) |= *(memory.data());
        goto lBegin;
@ZeroDay bitch please
 
Code:
        lCopyTo:
        memory[instr->argument] = *sp;
        goto lBegin;

        lCopyFrom:
        *sp = memory[instr->argument];
        goto lBegin;

        lCopyToStorage:
        *memory.data() = *sp;
        goto lBegin;

        lCopyFromStorage:
        *sp = *memory.data();
        goto lBegin;

        lBitshiftRight:
        (*sp) >>= instr->argument;
        goto lBegin;

        lBitshiftLeft:
        (*sp) <<= instr->argument;
        goto lBegin;

        lBitshiftRightOnce:
        (*sp) >>= 1;
        goto lBegin;

        lBitshiftLeftOnce:
        (*sp) <<= 1;
        goto lBegin;

        lNot:
        *sp = ~(*sp);
        goto lBegin;

        lXor:
        (*sp) ^= *(memory.data());
        goto lBegin;

        lAnd:
        (*sp) &= *(memory.data());
        goto lBegin;

        lOr:
        (*sp) |= *(memory.data());
        goto lBegin;
@ZeroDay bitch please
Pamal
Mais

Code:
# -*- coding: utf-8 -*-
import Tkinter, time, random, shelve
shel = shelve.open("GoL")
pointeurShel = "0"
longueurAttente = 100
pointeurInit = 7
while pointeurInit > 0:
    x1 = random.randint(0, 200) #génération des nv coordonnées
    y1 = random.randint(0, 200)
    x2 = x1
    y2 = y1
    pointeurInit = str(pointeurInit)
    shel[pointeurInit] = x1, y1, x2, y2 #stockage dans la clé X
    pointeurInit = int(pointeurInit)
    pointeurInit -= 1
def affichage2():
    global pointeurShel, longueurAttente
    continuer = True

    pointeurShel = int(pointeurShel) #changement de clé
    pointeurShel += 1 # idem
  
    can1.delete("all") #effacement du can1
    longlist = shel.keys() #on regarde le nombre de clés utilisées
    longlist = len(longlist) #idem
    print "longlist :"
    print longlist
    pointeurEtat = 0 #pointe quelle clé va etre positionnée
    while pointeurEtat < longlist and continuer==True:
        pointeurEtat = str(pointeurEtat)
        print pointeurEtat
        x1 = shel[pointeurEtat][0] #on charge les valeurs
        y1 = shel[pointeurEtat][1]
        x2 = shel[pointeurEtat][2]
        y2 = shel[pointeurEtat][3]
        verifHaut = y1 - 1
        verifBas = y2 + 1
        verifGauche = x1 - 1
        verifDroite = x2 + 1
        pointeurVerif = str(longlist-1)
        while pointeurVerif > 0:
            pointeurVerif = str(pointeurVerif)
            print "ping"
            if shel[pointeurVerif][1] == verifHaut:
                longlist += 1
                shel[str(longlist)] == x1+1, y1-1, x2+1, y2-1
            if shel[pointeurVerif][3] == verifBas:
                longlist += 1
                shel[str(longlist)] == x1+1, y1-1, x2+1, y2-1
            if shel[pointeurVerif][0] == verifGauche:
                longlist += 1
                shel[str(longlist)] == x1+1, y1-1, x2+1, y2-1
            if shel[pointeurVerif][2] == verifDroite:
                longlist += 1
                shel[str(longlist)] == x1+1, y1-1, x2+1, y2-1
            pointeurVerif = int(pointeurVerif)
            pointeurVerif -= 1
        direction = random.randint(0,3) #choix de la direction
        if direction == 0: # droite
            x1 += 1
            x2 += 1
        elif direction == 1: #gauche
            x1 -= 1
            x2 -= 1
        elif direction == 2: # haut
            y1 -= 1
            y2 -= 1
        elif direction == 3: #bas
            y1 +=1
            y2 += 1
        if x1 < 0 or x2 < 0 or y2 < 0 or y2 < 0:
            x1, x2, y1, y2 = 10, 10, 10 , 10
        shel[pointeurEtat] = x1, y1, x2, y2
        can1.create_rectangle(x1, y1, x2, y2, fill="blue", outline="blue")
        pointeurEtat = int(pointeurEtat)
        pointeurEtat += 1
  
    can1.after(longueurAttente, affichage2)

fen1 = Tkinter.Tk()
can1 = Tkinter.Canvas(fen1, height=200, width=200)
can1.pack()
bout1 = Tkinter.Button(fen1, text="Quitter", command=fen1.quit)
bout1.pack()

can1.after(1000, affichage2)
  
fen1.mainloop()

fen1.destroy()
shel.close()
Moi même je comprends à moitié ce que j'ai fait par moment u_u
Pas que le programme soit vraiment compliqué en soit, les fonctions sont easy, mais la logique générale m'échappe de plus en plus é_è
 
  • J'aime
Reactions: Asu