I created with my boyfriend a game to play with him when we are far from each other I already miss him he plans to go to Normandy this weekend but I don't want him to that s too bad what am I going to do ??? dunno dunno I am still crying I want to cry I want to hug him but he wants to code this shitty I don't even like! what a nightmare! no I am kidding I am 100% happy and fine please take care of yourself you're worth it bye bye kitties

This commit is contained in:
alexandre 2020-03-04 23:22:31 +01:00 committed by Pierre-Olivier Mercier
commit da29b8fc1b
4 changed files with 157 additions and 0 deletions

26
opale/board.py Normal file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 22:23:56 2020
@author: AlexandreMouchel
"""
class Board():
def __init__(self):
self.chasseresse = []
self.dragonCorail = []
self.pearl = []
self.witch = []
self.dragonPetrified = []
self.golem = []
self.guardian = []
self.horser = []
self.city = []
self.underTheBoard = []
self.roundCity = 0
def isFinished(self):
return self.roundCity >= 3

69
opale/carte.py Normal file
View File

@ -0,0 +1,69 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 22:33:46 2020
@author: AlexandreMouchel
"""
class Card():
def __init__(self, score):
self.score = score
def __repr__(self):
return type(self).__name__ + "(%d)"%self.score
class Chasseresse(Card):
def __init__(self, score):
Card.__init__(self, score)
class DragonCorail(Card):
def __init__(self, score):
Card.__init__(self, score)
class Pearl(Card):
def __init__(self, score):
Card.__init__(self, score)
class Witch(Card):
def __init__(self, score):
Card.__init__(self, score)
class DragonPetrified(Card):
def __init__(self, score):
Card.__init__(self, score)
class Golem(Card):
def __init__(self, score):
Card.__init__(self, score)
class Guardian(Card):
def __init__(self, score):
Card.__init__(self, score)
class Horser(Card):
def __init__(self, score):
Card.__init__(self, score)
class City(Card):
def __init__(self):
Card.__init__(self, 0)

15
opale/game.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 22:20:15 2020
@author: AlexandreMouchel
"""
class Game():
def __init__(self):
self.board = Board()
self.player1 = Player()
self.player2 = Player()
self.round = 0

47
opale/player.py Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 22:32:32 2020
@author: AlexandreMouchel
"""
import random
from carte import *
class Player():
def __init__(self):
self.pioche = []
self.défausse = []
self.main = []
self.dragonPetrified = False
# we are creating the deck
self.pioche += [City() for i in range(6)]
self.pioche += [Chasseresse(1 if i % 3 else 2) for i in range(6)]
self.pioche += [DragonCorail(3 if i % 2 else i) for i in range(1, 5)]
self.pioche += [Pearl((i+2)//2) for i in range(7)]
self.pioche += [Witch(i%2+1) for i in range(4)]
self.pioche += [DragonPetrified(2) for i in range(5)]
self.pioche += [Golem(i+1) for i in range(3)]
self.pioche += [Horser(2 if i == 0 else 1) for i in range(5)]
self.pioche += [Guardian(1) for i in range(6)]
self.pioche += [Guardian(2) for i in range(3)]
self.pioche += [Guardian(3) for i in range(1)]
random.shuffle(self.pioche)
def pick(self):
for i in range((6 if self.dragonPetrified else 5) - len(self.main)):
self.main.append(self.pioche.pop())
nde = Player()
print(len(nde.pioche))
nde.pick()
nde.dragonPetrified = True
nde.pick()
print(len(nde.pioche))
print(nde.main)