오늘 하루 2시간 동안 짠 건데 좀 많이 부족해 보이네요 살 좀 붙여야겠다

과제.. 인것도 있음, 내가 좋아하는 걸로 제출하면 그래도 동기부여가 꾸준히 될 줄 알고 하고 있는데

동기부여보다는 내가 사랑하는 것들을 하다커녕 그냥 마음만 아픈데요???

 

처음 구조를 잡은 것 

class World_line_alpha:
    def __init__(self, labomen, microwave, crt_tv, divergence_meter):
        self.labomen = labomen
        self.microwave = microwave
        self.crt_tv = crt_tv
        self.divergence_meter = divergence_meter

    def send_message():


    def send_message_to_change_divergence_meter(self, labomen):
        if self.microwave.is_on and self.Crt_tv.is_on :
            print(f"{labomen}: I want to send change the world")
            self.labomen.send_message(self.microwave)

    def labomen():
        print(f'My name is {labomen}')

# Without the self parameter, the method wouldn't know which instance's attributes to modify or access.
# The use of self helps Python distinguish between attributes of different instances of the same class.

class Microwave:
    def __init__(self):
        self.is_on = False

    def turn_on(self):
        self.is_on = True
        print("Microwave is now on")

    def turn_off(self):
        self.is_on = False
        print("Microwave is now off")

    def receive_message(self, message):
        if self.is_on and self.CRT_TV.is_on :
            print(f"Received message: {message}")
            self.divergence_meter.change_value()
        else:
            print("No message. You will get a nice food.")

class Crt_tv:
    def __init__(self):
        self.is_on = False
   
    def turn_on(self):
        self.is_on = True
        print("The CRT TV is now on")

    def turn_off(self):
        self.is_on = False
        print("The CRT TV is now off")

class DivergenceMeter:
    def __init__(self):
        self.value = 0.571040

    def change_value(self):
        self.value += 1
        print(f"Divergence Meter changed to {self.value}")



# Scenario -------------------
microwave = Microwave()
divergence_meter = DivergenceMeter()
World_line_alpha = World_line_alpha(labomen, microwave, divergence_meter)

microwave.turn_on()
Crt_tv.turn_on()
World_line_alpha.send_message_while_microwave_on
 

오류가 여럿 보여서 구조를 좀 더 달리생각했습니다. 

그리고 뼈대를 수정을 좀 했어요

나머지 살 붙이는 건 아무래도 내일 해야 할 거 같네요.


class Labotory:
    def __init__(self, name, Idnumber, origin):
        self.name = name
        self.number = Idnumber
        self.origin = origin
     
    def lntroduce(self, name):
        print(f'My name is {name}')
   
    #def __str__(self):
        #return f"
    #TEST
Labomen =[Labotory("Okabe_rintarou", "001", "Japan"),
    Labotory("Shiina_Mayuuri", "002", "Japan"),
    Labotory("Hashida_itarrum", "003", "Japan"),
    Labotory("Makise_Kurisu","004", "America" ),
    Labotory("Kiryu_moeka", "005", "Spoiler"),
    Labotory("Urushibara_ruka","006", "Japan"),
    Labotory("Feiris_nyannyan","007","Japan"),
    Labotory("Amane_Suzuha","008", "Spoiler"),
    Labotory("Hiyajou_maho","009","Spoiler")]


   

class Microwave:
    def __init__(self):
        self.is_on = False

    def turn_on(self):
        self.is_on = True
        print("Microwave is now on")

    def turn_off(self):
        self.is_on = False
        print("Microwave is now off")

class CrtTv:
    def __init__(self):
        self.is_on = False
   
    def turn_on(self):
        self.is_on = True
        print("The CRT TV is now on")

    def turn_off(self):
        self.is_on = False
        print("The CRT TV is now off")

class DivergenceMeter:
    def __init__(self):
        self.value = 0.571040

    def change_value(self):
        self.value += 1
        print(f"Divergence Meter changed to {self.value}")


class GameStory:
    def __init__(self, labomen, microwave, crt_tv):
        self.labomen = labomen
        self.microwave = microwave
        self.crt_tv = crt_tv
        self.divergence_meter = []

    def send_message_to_change_divergence_meter(self):
        if self.microwave.is_on and self.crtTv.is_on:
            print(f"{self.labomen.name}: I want to change the world")
            self.crt_tv.receive_message("World change request")
            self.divergence_meter.append()
        else:
            print("Seems like nothing has changed.....")
   
   

# Create instances
microwave = Microwave()
crt_tv = CrtTv()

# Instantiate GameStory with the first Labotory instance
game_story = GameStory(Labomen[0], microwave, crt_tv)

# Call the method on the GameStory instance
game_story.send_message_to_change_divergence_meter()
 

+ Recent posts