示例#1
0
for fName in sys.argv[1:] :
  f = file( fName )
  results = pickle.load( f )
  
  if isinstance( results, tuple ):
    results = key_vote_lib.computeMachs( results )
  
  key_vote_lib.countLost( results, scores )
  
  # for the individual ratios
  ratios.append( key_vote_lib.computeScores( key_vote_lib.countLost( results ) ) )
  
  f.close()
  
ratio = key_vote_lib.computeScores( scores )

sigma = {}
total = 0
for k in ratio.keys() :
  sum2 = 0
  for r in ratios :
    sum2 += math.pow( r[k] - ratio[k], 2 )
  s = math.sqrt( sum2 / len(ratios) )
  sigma[k] = s
  total += s

key_vote_lib.printScores( sigma, hands )
key_vote_lib.printStdOut()
key_vote_lib.printStdOut( u"Différence totale: " + str( total ) )
key_vote_lib.printKbdScores( sigma )
示例#2
0
  
  if isinstance( results, tuple ):
    results = key_vote_lib.computeMachs( results )
  
  key_vote_lib.countLost( results, scores )
  nbOfVotes += len( results )
  
  f.close()
  
ratio = key_vote_lib.computeScores( scores )

# load the results to compare to the mean
singleResults = pickle.load( file( sys.argv[1] ) )
if isinstance( singleResults, tuple ):
  singleResults = key_vote_lib.computeMachs( singleResults )
singleScores = key_vote_lib.countLost( singleResults )
singleRatio = key_vote_lib.computeScores( singleScores )

# now, for the all the scores, compute the diff to the mean
singleDiff = {}
total = 0
for k, v in singleRatio.iteritems() :
  diff = abs( v - ratio[k] )
  singleDiff[k] = diff
  total += diff

key_vote_lib.printScores( singleDiff, hands )
key_vote_lib.printStdOut()
key_vote_lib.printStdOut( u"Différence totale: " + str( total ) )
key_vote_lib.printKbdScores( singleDiff )
示例#3
0
          
          if res == "Q":
            run = False
            break
          elif res == "C":
            nbOfSearch = 0
            key_vote_lib.printStdOut( u'Continue à chercher' )
          elif res == "A":
            key_vote_lib.cancelDuel(results, hands)
          elif res == 'T':
            key_vote_lib.cancelDuels(results, hands)
          else:
            key_vote_lib.printStdOut( u'Erreur dans le programme !' )
          
          key_vote_lib.printStdOut()
  
  pickle.dump( results, file( resultFile, "w" ) )
  
  # affichage des résultats
  
  key_vote_lib.printStdOut()
  # key_vote_lib.printStdOut( u'Vos votes :' )
  
  # calcul des matchs perdus/total pour chaque touche
  scores = key_vote_lib.computeScores( key_vote_lib.countLost( results ) )
  
  # affichage du résultat
  key_vote_lib.printScores( scores, hands )
  key_vote_lib.printKbdScores( scores )
  key_vote_lib.readResult( u'appuyez sur Entrée pour quitter' )
示例#4
0
          elif ires == 2 or res == TEST: # le caractère est moins bon que le milieu
            max = middle-1 # le maximum est avant le milieu
            if max < min:
              results[handID].insert(middle, (c,)) # insertion après le milieu
            matchs[pair] = 2
          elif ires == 0: # les caractères sont aussi bons
            results[handID][middle] += (c,) # on ajoute au milieu
            max = min-1 # fin du test de ce caractère
            matchs[pair] = 0
        
        pickle.dump( matchs, file( resultFile, "w" ) )
        pickle.dump( results, file( sortedResultFile, "w" ) )
        
      untested.pop(0) # on supprime le caractère de l'array
    

  # génère les duels comme dans la version de base
  base_results = key_vote_lib.computeMachs( results )

  # affichage des résultats
  key_vote_lib.printStdOut()
  # key_vote_lib.printStdOut( u'Vos votes :' )
  
  # calcul des matchs perdus/total pour chaque touche
  scores = key_vote_lib.computeScores( key_vote_lib.countLost( base_results ) )
  
  # affichage du résultat
  key_vote_lib.printScores( scores,kbd )
  key_vote_lib.printKbdScores( scores )
  key_vote_lib.readResult( u'appuyez sur Entrée pour quitter' )
示例#5
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys, pickle, key_vote_lib

hands = key_vote_lib.chooseKbd()
scores = {}
nbOfVotes = 0

for fName in sys.argv[1:] :
  f = file( fName )
  results = pickle.load( f )
  
  if isinstance( results, tuple ):
    results = key_vote_lib.computeMachs( results )
  
  key_vote_lib.countLost( results, scores )
  nbOfVotes += len( results )
  
  f.close()
  
print nbOfVotes, "votes."
ratio = key_vote_lib.computeScores( scores )
key_vote_lib.printScores( ratio, hands )