def createList(self, id, name): """ Creates a new `CardList` instance in the `Board`. Stores it in `self.lists` attribute. Parameters: id(str): List id name(str): list name Returns: None """ cardList = CardList(id,name) self.lists[id] = cardList print('Created List :' + id)
def __init__(self): """Initialisation des attributs : * premises : liste de 4 CardList correspondant aux 4 lignes de prémisses; * currently_added : liste de cartes venant d'être ajoutées aux prémisses, et pas encore validées. :return: un objet Proof :rtype: Proof """ self.premises = [CardList() for _ in range(4)] self.currently_added = [] self.__modif = True # modification depuis le dernier appel à npi self.__npi = []
#!/usr/bin/env python #from readtest import * import re from CardList import CardList from Reader import Reader import sys import subprocess import shlex reader = Reader() cardList = CardList() print 'Ready: place a card on top of the reader' while True: try: card = reader.readCard() print 'Read card', card plist = cardList.getPlaylist(card) print 'Playlist', plist if plist != '': subprocess.check_call( ["./haplaylist.sh %s" % plist], shell=True) except KeyboardInterrupt: sys.exit(0) except: pass
#from readtest import * from CardList import CardList from Reader import Reader reader = Reader() cardList = CardList() while True: print 'Place the card in the reader' card = reader.readCard() plist=raw_input('Specify Google Playlist Name-NoSpaces, q to quit') if plist=="q": break cardList.addPlaylist(card, plist) print "Exiting"
#!/usr/bin/env python #from readtest import * import re from CardList import CardList from Reader import Reader import sys import subprocess import os import time reader = Reader() cardList = CardList() print("Ready: place a card on top of the reader") while True: card = reader.readCard() try: print("Read card", card) plist = cardList.getPlaylist(card) print("Playlist", plist) if plist != "": subprocess.check_call(["./haplaylist.sh %s" % plist], shell=True) range(10000) # some payload code time.sleep(0.2) # sane sleep time of 0.1 seconds except OSError as e: print("Execution failed:") range(10000) # some payload code time.sleep(0.2) # sane sleep time of 0.1 seconds
from CardList import CardList #from Reader import Reader from logger import Logger import signal import sys import RPi.GPIO as GPIO from pirc522 import RFID import time #reader = Reader() cardList = CardList() rdr = RFID() continue_reading = True # Capture SIGINT for cleanup when the script is aborted def end_read(signal, frame): global continue_reading print "Ctrl+C captured, ending read." continue_reading = False rdr.cleanup() GPIO.cleanup() sys.exit() # Hook the SIGINT signal.signal(signal.SIGINT, end_read) while continue_reading: print 'Place the card in the reader' rdr.wait_for_tag()
""" self.__to_fcn_npi() self.__clause_list = [] while self.__fcn_npi: if self.__fcn_npi[-1].name == "AND": self.__fcn_npi.pop() continue clause = self.__npi_to_list(self.__get_proposition()) if clause is not None: self.__clause_list.append(clause) return self.__clause_list if __name__ == '__main__': from Proof import Proof from CardList import CardList proof = Proof() proof.premises = [ CardList([Card('A'), Card('THEN'), Card('B'), Card('THEN'), Card('C')]), CardList([Card('NOT'), Card('C')]), CardList(), CardList() ] print(proof.npi) fcn = FCN(proof) print(fcn.clause_list)
def __init__(self): self.battlefield = CardList() self.manapool = CardList() self.Deck = CardList() self.Graveyard = CardList() self.Player = Player()
#from readtest import * from CardList import CardList from Reader import Reader reader = Reader() cardList = CardList() while True: print 'Place the card in the reader' card = reader.readCard() plist=raw_input('Specify Spotify URI, q to quit') if plist=="q": break cardList.addPlaylist(card, plist) print "Exiting"
#from readtest import * from CardList import CardList from Reader import Reader reader = Reader() cardList = CardList() #while True: # print 'Place the card in the reader' # card = reader.readCard() # plist=raw_input('Specify Spotify URI, q to quit') # if plist=="q": # break # cardList.addPlaylist(card, plist) print "Place card to erase" card = reader.readCard() #print card cardList.erasePlaylist(card)
from CardList import CardList from Hand import Hand if __name__ == '__main__': print("Starting Triple Triad Text...") card_list = CardList() card_list.shuffle() card_list.shuffle() hand = Hand() hand.draw_cards(card_list) hand.inspect_hand() class Board: # Board Values # 0 1 2 # 3 4 5 # 6 7 8 def __init__(self, positions=[0, 1, 2, 3, 4, 5, 6, 7, 8]): self._positions = positions def place_card(self, card, position): if isinstance(self.positions[position], int): self.positions[position] = card else: return @property def positions(self): return self.positions