<commit_before>#-*-coding:utf-8-*-

import Message
import GameWorld

class Interface(object):
    def __init__(self):
        self.GameWorld = GameWorld.PKField(self)
        self.PrintMsg = {u'文本':self.PrintTextMsg, u'攻击':self.PrintAttackMsg,
                         u'治疗':self.PrintCureMsg, u'buff':self.PrintBuffMsg,
                         u'unbuff':self.PrintBuffMsg, u'debuff':self.PrintDeBuffMsg,
                         u'undebuff':self.PrintUnBuffMsg, u'pick':self.PrintPickMsg}
        
        name = raw_input('请输入第一个玩家名字：').decode('GBK')
        self.GameWorld.AddPlayerByName(name)
        name = raw_input('请输入第二个玩家名字：').decode('GBK')
        self.GameWorld.AddPlayerByName(name)
        
        for p in self.GameWorld.players:
            self.PrintCharCard(p)
        
    def Play(self):
        self.GameWorld.Play()

    def PrintCharCard(self, player):
        print u"--->玩家：%s"%player.name
        print u"    力量：%s"%player.str
        print u"    敏捷：%s"%player.dex
        print u"    体质：%s"%player.con
        print u"    智力：%s"%player.int
        print u"    感知：%s"%player.wis
        print u"    魅力：%s"%player.cha


    def PrintTextMsg(self, msg):
        print msg.text

    def PrintAttackMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)
        
    def PrintCureMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)

    def PrintBuffMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)

    def PrintUnBuffMsg(self, msg):
        print msg.template%(msg.owner.name, msg.buff.name)

    def PrintDeBuffMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)

    def PrintUnBuffMsg(self, msg):
        print msg.template%(msg.owner.name, msg.debuff.name)

    def PrintPickMsg(self, msg):
        print msg.template%(msg.owner.name, msg.item.name)

if __name__=='__main__':
    game = Interface()
    game.Play()
<commit_msg>The Console Encode and Decode for gbk<commit_after>#-*-coding:utf-8-*-

import Message
import GameWorld

class Interface(object):
    def __init__(self):
        self.GameWorld = GameWorld.PKField(self)
        self.PrintMsg = {u'文本':self.PrintTextMsg, u'攻击':self.PrintAttackMsg,
                         u'治疗':self.PrintCureMsg, u'buff':self.PrintBuffMsg,
                         u'unbuff':self.PrintBuffMsg, u'debuff':self.PrintDeBuffMsg,
                         u'undebuff':self.PrintUnBuffMsg, u'pick':self.PrintPickMsg}
        
        name = raw_input(u'请输入第一个玩家名字：'.encode('gbk')).decode('gbk')
        self.GameWorld.AddPlayerByName(name)
        name = raw_input(u'请输入第二个玩家名字：'.encode('gbk')).decode('gbk')
        self.GameWorld.AddPlayerByName(name)
        
        for p in self.GameWorld.players:
            self.PrintCharCard(p)
        
    def Play(self):
        self.GameWorld.Play()

    def PrintCharCard(self, player):
        print u"--->玩家：%s"%player.name
        print u"    力量：%s"%player.str
        print u"    敏捷：%s"%player.dex
        print u"    体质：%s"%player.con
        print u"    智力：%s"%player.int
        print u"    感知：%s"%player.wis
        print u"    魅力：%s"%player.cha


    def PrintTextMsg(self, msg):
        print msg.text

    def PrintAttackMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)
        
    def PrintCureMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)

    def PrintBuffMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)

    def PrintUnBuffMsg(self, msg):
        print msg.template%(msg.owner.name, msg.buff.name)

    def PrintDeBuffMsg(self, msg):
        print msg.template%(msg.sender.name, msg.action.name, msg.target.name, msg.effect)

    def PrintUnBuffMsg(self, msg):
        print msg.template%(msg.owner.name, msg.debuff.name)

    def PrintPickMsg(self, msg):
        print msg.template%(msg.owner.name, msg.item.name)

if __name__=='__main__':
    game = Interface()
    game.Play()

{'fraction_non_alphanumeric': 0.13434903047091412, 'fraction_numerical': 0.0004616805170821791, 'mean_word_length': 2.2701886792452832, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4587264', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1472, 'n_words': 240}