Skip to content

Instantly share code, notes, and snippets.

@JPGITHUB1519
Created March 15, 2018 02:19
Show Gist options
  • Save JPGITHUB1519/529d13e1a870680afd9493a2b1a779ae to your computer and use it in GitHub Desktop.
Save JPGITHUB1519/529d13e1a870680afd9493a2b1a779ae to your computer and use it in GitHub Desktop.
import pygame,sys
from pygame.locals import *
pygame.init()
Ventana = pygame.display.set_mode((560,560))
pygame.display.set_caption("Ajedrez")
Negro = (0,0,0)
Blanco = (255,255,255)
Tablero = []
Columnas = []
Filas = []
class Pieza():
def __init__(self,nombre,color):
self.Nombre = nombre
self.Color = color
def Mover():
pass
class Peon(Pieza):
def __init__(self,nombre,color):
Parent.__init__(self,nombre,color)
if self.Color == "Blanco":
pass
def Mover():
pass
class Caballo(Pieza):
def __init__(self,nombre,color):
Parent.__init__(self,nombre,color)
def Mover():
pass
class Reina(Pieza):
def __init__(self,nombre,color):
Parent.__init__(self,nombre,color)
def Mover():
pass
def DibujarTablero(Ventana,Dimension):
global Tablero
global Columnas
global Filas
Color = 0
for Fila in range(8):
for Columna in range(8):
X,Y = Fila * Dimension, Columna * Dimension
Columnas = [X,Y]
Filas.append(Columnas)
Columnas = []
if Color % 2 == 0:
pygame.draw.rect(Ventana,Negro,(X,Y,Dimension,Dimension))
else:
pygame.draw.rect(Ventana,Blanco,(X,Y,Dimension,Dimension))
Color += 1
Color += 1
Tablero.append(Filas)
Filas = []
while True:
for evento in pygame.event.get():
if evento.type == QUIT:
pygame.quit()
sys.exit()
DibujarTablero(Ventana,70)
pygame.display.update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment