-
Notifications
You must be signed in to change notification settings - Fork 13
/
code.py
89 lines (62 loc) · 2.42 KB
/
code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#This code was written by Raymond Cheung
#No one is allowed to modify this code
#if you have any questions about it, I can be emailed at [email protected]
#This is a bot that with automated behavior to run independantly on Magic the Gathering: Online
#DEPENDENCIES
#used in controller to set time of transaction for recording
path_to_bot = "c:/users/darkray16/desktop/my dropbox/mtgobot/"
from datetime import datetime
import sys
path_to_bot = ""
sys.path.append(path_to_bot)
import model
import view
import controller
exec(open(path_to_bot "ini.py", "rb").read())
class Bot(object):
#this is at the highest level and owns all other classes
#its a wrapper class that will encompass every other class
__single = None
def __init__(self):
#no more than one instance is needed at a time
if Bot.__single:
raise ErrorHandler("Bot class cannot be instantiated more than once")
Bot.__single = self
self.primary_controller = controller.MainController()
def main(self):
#run when script starts
self.primary_controller.startup()
def do_function(self):
self.primary_controller.trade_mode()
class Customer(object):
def __init__(self, name):
#set the name of customer upon initialization
self.name = name
def set_name(self, name):
#Set the name of the customer, e.g. their screen name
self.name = name
def get_name(self):
#Get the name of the customer, e.g. their screen name
return self.name
def set_mode(self, mode):
#find whether customer wants to buy or sell
self.mode = mode
def get_mode(self):
return self.mode
class RecordToFile(object):
#this object will write the transaction to a file
#it will take care of opening, writing, and reading transaction history
def __init__(self, transaction):
self.__record = transaction
def open_record(self, filename):
#wrapper function for open file
pass
def write_record(self):
#write the record property to an already opened file
pass
def read_record(self, file):
#read an already opened file
pass
#run the bot
Bot_App = Bot()
Bot_App.do_function()