Can you solve the computer virus riddle? - James Tanton

1,157,802 views ・ 2021-10-19

TED-Ed


Por favor, faça duplo clique nas legendas em inglês abaixo para reproduzir o vídeo.

Tradutor: Ana Sofia Ferreira Revisora: Margarida Ferreira
00:06
Your antivirus squad is up against a particularly sadistic bit
0
6788
4208
O teu esquadrão antivírus enfrenta um código malicioso
00:10
of malicious code that’s hijacked your mainframe.
1
10996
3208
particularmente sádico que invadiu o teu computador central.
00:14
What you’ve learned from other infected systems— right before they went dark—
2
14579
4292
O que aprendemos com outros sistemas infetados, mesmo antes de se apagarem,
00:18
is that it likes to toy with antivirus agents in a very peculiar way.
3
18871
5083
é que gostam de brincar com os agentes antivírus de forma muito peculiar.
00:24
It corrupts one of the 4 disks that run your mainframe,
4
24538
3625
Este corrompe um dos quatro discos que põem em funcionamento o computador,
00:28
represented by lights showing which are on and which off.
5
28163
3625
representado por luzes que mostram quais estão ligados e desligados.
00:32
Then it selects one member of the antivirus squad— this’ll be you—
6
32412
4500
Depois escolhe um membro do esquadrão antivírus, que serás tu,
00:36
and brings them into the mainframe.
7
36912
2167
e leva-o até ao computador central.
00:39
It tells them which disk it corrupted,
8
39079
2375
Diz-lhe qual o disco que está corrompido,
00:41
allows the agent to switch a single disk on or off,
9
41454
4500
permite ao agente ligar ou desligar um só disco,
00:45
then immediately de-rezzes the agent.
10
45954
3083
e depois dizima o agente imediatamente.
00:49
Your squad can make an all-out attack to break into the mainframe
11
49579
3625
O teu esquadrão pode fazer um ataque total para invadir o computador central
00:53
and destroy one disk before they’re wiped out.
12
53204
3167
e destruir um disco antes de ser eliminado.
00:56
If they destroy the corrupted one, the malware will be defeated.
13
56537
3584
Se destruírem o que está corrompido, o vírus será derrotado.
01:00
Any others, and the virus will erase the entire system.
14
60121
3708
Se for qualquer outro, o vírus vai eliminar todo o sistema.
01:04
The lights are only visible within the mainframe,
15
64413
2708
As luzes só são visíveis dentro do computador central,
01:07
so you won’t know until you get there which, if any, are on.
16
67121
4125
portanto não sabes quais, ou se alguma, estão ligadas até lá chegares.
01:11
How can you communicate, with your single action,
17
71621
3250
Como podes comunicar, com a tua ação única,
01:14
which of the 4 disks has been corrupted?
18
74871
2583
qual dos quatro discos foi corrompido?
01:17
Pause here to figure it out for yourself. Answer in 3
19
77454
2709
Pausa aqui se quiseres descobrir por ti mesmo
Resposta em 3
01:20
Answer in 2
20
80163
2500
Resposta em 2
01:22
Answer in 1
21
82663
2583
Resposta em 1
01:25
The setting is a big clue for one solution.
22
85329
3250
O cenário é uma grande pista para uma das soluções.
01:28
Using binary code— the base two numbering system that only uses 1s and 0s—
23
88579
5667
Usando o código binário
— o sistema numérico de base dois que usa apenas 1 e 0 —
01:34
we can represent each of the 4 disks with a 2-bit binary number
24
94538
4500
podemos representar cada um dos 4 discos com um número binário de 2 bits
01:39
ranging from 00 for zero to 11 for three.
25
99038
4416
de 00 para zero a 11 para três.
01:44
What we’re looking for now is some sort of mathematical operation
26
104163
4041
O que procuramos agora é uma operação matemática
01:48
that can take the lit disks as input, and give the corrupted disk as an output.
27
108204
5709
que possa usar os discos iluminados como entrada
e dê os discos corrompidos como saída.
01:54
Let’s consider one possibility.
28
114496
1917
Vamos considerar uma possibilidade.
01:56
Say that the corrupted disk was this one,
29
116413
2708
Digamos que o disco corrompido era este
01:59
and when you come in, no lights are on.
30
119121
2917
e que, quando chegaste, não havia luzes acesas.
02:02
You could turn 11 on to indicate that disk.
31
122288
4000
Podias acender o 11 para indicar esse disco.
02:06
Okay, what if you came in and 11 was already on?
32
126954
4000
E se, quando chegaste, o 11 já estivesse aceso?
02:11
You have to switch one light.
33
131329
1875
Tens de acender uma luz.
02:13
Which seems like the most innocuous to change?
34
133621
2875
Qual parece o mais inócuo para mudar?
02:16
Probably 00, in that if you were to add 00 and 11,
35
136788
4916
Provavelmente o 00, porque, se adicionares 00 e 11,
02:21
you’d still get 11.
36
141704
1709
ficas na mesma com 11.
02:24
So maybe the key is to think of addition of binary numbers,
37
144288
4333
Então talvez a solução seja pensar na adição de números binários,
02:28
with the sum of the lit disks communicating the corrupted disk number.
38
148621
4583
com a soma dos discos acesos a comunicar o número do disco corrompido.
02:33
This works great, until we start with a different hypothetical.
39
153496
4000
Isto funciona bem até começarmos com uma hipótese diferente.
02:37
What if 00 was the corrupted disk, and 01 and 10 were on?
40
157496
5542
E se o 00 fosse o disco corrompido, e o 01 e o 10 estivessem acesos?
02:43
Here, the sum of the lit disks is 11.
41
163329
3459
Aqui, a soma dos discos acesos é 11.
02:46
But we need to change this to a sum of 00 with the flip of one switch.
42
166788
5583
Mas temos de mudar isto para uma soma do 00 com a mudança de uma das luzes.
02:53
We have four options: turning switch 00 on gives us 11.
43
173163
4750
Temos quatro opções: acendermos o 00 dá 11.
02:58
Turning 01 off takes us back to 10,
44
178121
3292
Se apagarmos o 01 dá novamente 10,
03:01
and turning 10 off gives 01.
45
181413
3750
e se apagarmos o 10 dá 01.
03:05
None of those work.
46
185163
1791
Nenhum destes funciona.
03:06
Turning switch 11 on gives us 110 by standard binary addition.
47
186954
5834
Acender o 11 dá 110 segundo a adição binária convencional.
03:12
But we don’t really want three digit numbers.
48
192788
2750
Mas não queremos números com três dígitos.
03:15
So what if— to keep the result a two digit number—
49
195621
3542
E se, para mantermos o resultado como um número com dois dígitos,
03:19
we break the rules a bit and let this sum equal 22.
50
199163
4458
quebrarmos um pouco as regras e deixarmos a soma ser 22?
03:23
That’s not a binary number, but if we regard 2s as the same as 0s,
51
203829
4792
Não é um número binário, mas se considerarmos os 2 como zeros,
03:28
that does indicate the correct disk.
52
208621
2625
isso não indica o disco correto.
03:31
So this suggests a strategy:
53
211871
2375
Então isto sugere uma estratégia:
03:34
look at the sum of all the lighted disks we see,
54
214246
3667
vejamos a soma de todos os discos acesos que vemos,
03:37
regarding 2s as 0s.
55
217913
2375
encarando os 2 como zeros.
03:40
If it’s already the correct result, flip 00,
56
220288
3458
Se já estiver o resultado certo, acendemos o 00,
03:43
and if not, find the switch that will make the sum correct.
57
223746
3917
e, se não, encontramos a luz que vai tornar a soma correta.
03:48
You can see for yourself that any starting configuration
58
228079
3250
Podes ver por ti mesmo que qualquer configuração inicial
03:51
can sum to any number from 00 to 11 with a flip of a switch.
59
231329
5334
pode somar qualquer número de 00 a 11 alterando um dos interruptores.
03:56
The reason this works is related to a concept called parity.
60
236871
4417
O motivo pelo qual isto funciona relaciona-se com o conceito de paridade.
04:01
Parity tells you whether a given value is even or odd.
61
241663
4208
A paridade diz-nos se um determinado valor é par ou impar.
04:06
In this case, the values whose parity we’re considering
62
246538
3375
Neste caso, os valores cuja paridade estamos a considerar
04:09
are the number of 1s in each digit place of our binary sums.
63
249913
4875
são o número de 1s em cada lugar de dígito das nossas somas binárias.
04:14
And that’s why we can say that 2 and 0, both even numbers,
64
254996
4333
E é por isso que podemos dizer que 2 e 0, ambos números pares,
04:19
can be treated as equivalents.
65
259329
2417
podem ser tratados como equivalentes.
04:22
By adding or subtracting 00, 01, 10, or 11,
66
262329
5792
Adicionando ou subtraindo 00, 01, 10 ou 11,
04:28
we can change the parity of either, both, or neither digit,
67
268121
4667
podemos mudar a paridade de um, de ambos ou de nenhum dígito,
04:32
and create the disk number we want.
68
272788
2625
e criar o número de disco que quisermos.
04:36
What’s incredible about this solution is that it works for any mainframe
69
276121
4208
O que é incrível nesta solução é que funciona em qualquer computador
04:40
whose disks are a power of two.
70
280329
2417
cujos discos sejam uma potência de dois.
04:43
With 64 you could turn each activated disk into a 6-bit binary number
71
283163
5625
Com 64, podemos transformar qualquer disco ativado num número binário de 6 bits
04:48
and sum the 1s in each column,
72
288788
2458
e adicionar os 1s em cada coluna,
04:51
regarding any even sum as the same as 0 and any odd sum as 1.
73
291246
5958
encarando qualquer soma par como 0 e qualquer soma impar como 1.
04:57
1,048,576 disks would be daunting, but entirely doable.
74
297621
6958
1 048 576 discos seria assustador, mas perfeitamente exequível.
Felizmente, o nosso computador central é muito mais pequeno.
05:05
Luckily, your mainframe is much smaller.
75
305038
2500
05:07
You make the valiant sacrifice and your team rushes in,
76
307538
3500
Fazes o valente sacrifício e a tua equipa apressa-se,
05:11
destroying the corruption and freeing the system.
77
311038
3125
destruindo a corrupção e libertando o sistema.
Sobre este site

Este sítio irá apresentar-lhe vídeos do YouTube que são úteis para a aprendizagem do inglês. Verá lições de inglês ensinadas por professores de primeira linha de todo o mundo. Faça duplo clique nas legendas em inglês apresentadas em cada página de vídeo para reproduzir o vídeo a partir daí. As legendas deslocam-se em sincronia com a reprodução do vídeo. Se tiver quaisquer comentários ou pedidos, por favor contacte-nos utilizando este formulário de contacto.

https://forms.gle/WvT1wiN1qDtmnspy7