예제 #1
0
def Batching():
    networkDataSet = InitDataSet()
    
    startNumSample = input("Start from number of sample: ")
    
    startNumSample = int(startNumSample)
    memberIndexList = [1, 3, 4]
    sampleIndexRange = range(1,6)
    
    for numSample in range(startNumSample, 11000, 1000):
        for memberIndex in memberIndexList:
            print("Current working set: samples/{}/member_{}/".format(numSample, memberIndex))
            input("Enter to continue...\n")
            
            for sampleIndex in sampleIndexRange:
                samplePath = "network\\samples\\{}\\member_{}\\sample_{}\\".format(numSample, memberIndex, sampleIndex)
                nodeMapPath = samplePath + "reduced_map.csv"
                friendListPath = samplePath + "friend_sample.csv"
                twitterListPath = samplePath + "twitter_sample.csv"
                sampleListPath = {}
                sampleListPath["first"] = friendListPath
                sampleListPath["second"] = twitterListPath
                delimiter = "\t"
                nodeMap, reverseMap = Network.ReadMappingCSV(nodeMapPath, delimiter)
                sampleUserTable = Guess.LoadSampleList(sampleListPath)
                
                
                result = Guess.UserLink(
                    networkDataSet["firstNetEdgeList"],
                    networkDataSet["secondNetEdgeList"],
                    nodeMap,
                    sampleUserTable["first"],
                    sampleUserTable["second"]
                )
                
                matchResult = Guess.CheckMatchRate(result, networkDataSet["trueNodeMapping"])
                
                print("Result of {}: {}".format(samplePath, matchResult))
예제 #2
0
 def test_guess_num(self):
     test_param_ans = 10
     test_param_num = 10
     result = Guess.guess_num(test_param_num, test_param_ans)
     self.assertEqual(result, True)
예제 #3
0
 def test_guess_num3(self):  # testing if file guess can take strings
     test_param_ans = 1
     test_param_num = '10'
     result = Guess.guess_num(test_param_num, test_param_ans)
     self.assertEqual(result, False)  # will output error
예제 #4
0
 def test_guess_num2(self):
     test_param_ans = 1
     test_param_num = 10
     result = Guess.guess_num(test_param_num, test_param_ans)
     self.assertEqual(result, False)
예제 #5
0
 def __gamble(self):
     self.__bg.destroy()
     Guess.Guess()
예제 #6
0
import Guess as Game

#playthis = Game.Guess(-1, 3, -1)

for x in range(0, 100):
    playthis = Game.Guess(-1, 0, -1)
    playthis.ai_Play()
예제 #7
0
    def userLink(self):
        filePath = self.getFilePath()
        delimiter = self.getDelimiter()
        sampleFilePath = self.getSampleFilePath()

        Guess.DoUserLink(filePath, sampleFilePath, delimiter)
예제 #8
0
        QApplication.processEvents()

    def getIsInfoLog(self):
        return self.infoCheckBox.checkState()

    def getIsWarnLog(self):
        return self.warnCheckBox.checkState()

    def getIsFatalLog(self):
        return self.fatalCheckBox.checkState()

    def getIsImportantLog(self):
        return self.importantCheckBox.checkState()

    def getIsVerboseLog(self):
        return self.verboseCheckBox.checkState()


if __name__ == '__main__':

    import sys

    ReadConfigure()
    app = QApplication(sys.argv)
    window = MainWindow()
    MessageSystem.Init(window)
    Network.Init(window)
    Guess.Init(window)
    window.show()
    sys.exit(app.exec_())
 def guess_game_correct_guess(self):
     random_value = 5
     guess = 5
     result = Guess.guess_game(random_value, guess)
     self.assertTrue(result)
 def guess_game_invalid_input(self):
     result = Guess.guess_game(5, "11")
     self.assertFalse(result)
 def guess_game_invalid_number(self):
     result = Guess.guess_game(5, 11)
     self.assertFalse(result)
 def guess_game_wrong_guess(self):
     result = Guess.guess_game(5, 0)
     self.assertFalse(result)
예제 #13
0
                samplePath = "network\\samples\\{}\\member_{}\\sample_{}\\".format(numSample, memberIndex, sampleIndex)
                nodeMapPath = samplePath + "reduced_map.csv"
                friendListPath = samplePath + "friend_sample.csv"
                twitterListPath = samplePath + "twitter_sample.csv"
                sampleListPath = {}
                sampleListPath["first"] = friendListPath
                sampleListPath["second"] = twitterListPath
                delimiter = "\t"
                nodeMap, reverseMap = Network.ReadMappingCSV(nodeMapPath, delimiter)
                sampleUserTable = Guess.LoadSampleList(sampleListPath)
                
                
                result = Guess.UserLink(
                    networkDataSet["firstNetEdgeList"],
                    networkDataSet["secondNetEdgeList"],
                    nodeMap,
                    sampleUserTable["first"],
                    sampleUserTable["second"]
                )
                
                matchResult = Guess.CheckMatchRate(result, networkDataSet["trueNodeMapping"])
                
                print("Result of {}: {}".format(samplePath, matchResult))

if __name__ == '__main__':
    ReadConfigure()
    fakeQt = FakeQtWindow()
    Network.Init(fakeQt)
    Guess.Init(fakeQt)
    MessageSystem.Init(fakeQt)
    Batching()
예제 #14
0
    ptype = "一般玩法"
elif ptype == '2':
    ptype = PlayType('2')
    ptype = "限時玩法"
else:
    ptype = PlayType('3')
    ptype = "限次數玩法"

x = int(input(f"請選擇要玩幾位數:"))
while True:
    sure = input(f"確認是否要玩{x}位數的1A2B(請輸入Y/N): ")
    if (sure == 'N' or sure == 'n'):
        x = input(f"請選擇要玩幾位數: ")
        continue
    elif (sure == 'Y' or sure == 'y'):
        ans = Guess.BuildAns(x)
        break
    else:
        sure = input("請輸入Y/N: ")

music = input('輸入-1則不會有背景音樂\n' + '輸入其它的則會撥放以電腦預設的音樂播放程式播放預設音樂\n' +
              '提醒:若要更改預設音樂請將音檔放入game資料夾中並"覆蓋"掉song.mp3檔\n')

if music != '-1':
    os.system("song.mp3")

print("遊戲開始,請開始猜數字:")
startTime = datetime.datetime.now()
breakt = threading.Thread(target=breakTime)
breakt.setDaemon(True)
breakt.start()