Skip to content

Instantly share code, notes, and snippets.

@ChOkO08
Last active December 24, 2016 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChOkO08/eaf2304418e610c794ba92a63aab47eb to your computer and use it in GitHub Desktop.
Save ChOkO08/eaf2304418e610c794ba92a63aab47eb to your computer and use it in GitHub Desktop.
different_and_notorious_alignment
"""
different_and_notorious_alignment
[PT-BR]
Acesse o servidor em 54.175.35.248:8001
"""
#coding:utf-8
import socket
def countDiff(x,y):
diffz = 0
tamX = len(x)
tamY = len(y)
for i in xrange(tamX):
if (x[i] == 'A' and y[i] == 'T') or (x[i] == 'G' and y[i] == 'C'):
pass
else:
print '\t[%s] != [%s]' % (x[i],y[i])
diffz+=1
return diffz
host="54.175.35.248"
port=8001
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((host,port))
r = s.recv(4096)
#print '[DEBUG]\n%s\n' % r
x = r.split(' ')[-2].replace(':','')
s.send(x+"\n")
print '[<] %s\n[>] %s' % (x,x)
print '-------------------------------'
for i in xrange(100):
print '[ ROUND #%s ]' % i
r = ''
r = s.recv(1024)
print '[<] %s' % r
x = r.split('Stage')[1].split(' ')[5]
y = r.split('Stage')[1].split(' ')[9]
ans = str(countDiff(x,y))
s.send(ans+"\n")
print '[>] %s' % ans
print '-----------------------------'
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment