编辑代码

# coding:utf-8
#JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
print("Hello world!   -  python.jsrun.net .")```python
import random

class AI:
    def __init__(self):
        self.performance = 0
    
    def adjust(self, feedback):
        self.performance += feedback
    
    def generate_action(self):
        # 根据自身表现随机生成一个动作
        if self.performance > 0:
            action = random.choice(['A', 'B', 'C'])
        else:
            action = random.choice(['X', 'Y', 'Z'])
        return action

# 创建一个AI实例
ai = AI()

while True:
    # 生成一个动作
    action = ai.generate_action()
    print("AI选择的动作:", action)
    
    # 用户输入反馈,1表示满意,-1表示不满意
    feedback = int(input("请给出你对AI表现的评价(1表示满意,-1表示不满意):"))
    
    # 根据反馈调整AI的表现
    ai.adjust(feedback)
    print("AI的表现评价得分:", ai.performance)
    
    # 判断是否继续循环
    choice = input("是否继续测试?(Y/N)")
    if choice == 'N':
        break
```