2016 xmas puzzle (1)

L D[AR2P#0.0]

Lifetime Supporting Member
Join Date
Nov 2006
Location
UK
Posts
6,693
Here's a simple puzzle to get your brain cells ready for another puzzle I have brewing.

Code:
I have three files on my computer:

AllOnes.txt
AllZeros.txt
OnesAndZeroes.txt

Each file contains either all ones, all zeroes, or ones and zeroes as characters
and all of the files have been misnamed.
You can read one character from one of the files.
Which file do you read the character from and how do you subsequently
rename the files so they correctly match their contents?
Answers by pm
 
Because ALL the files are misnamed, read OnesAndZeros.
If it's 0 then it must be the AllZeros file.
If it's 1 then it must be the AllOnes file.
So if it's 0 then Rename it to AllZeros, rename AllOnes to OnesAndZeros and finally rename AllZeros to AllOnes.
 
With the limitation of only reading 1 character from just 1 of the 3 files. I don't see any way to know how to name them. you would have a 50% chance either way.
if the character was a zero the file could be either Allzero or Onesandzero
if the character was a one the file could be either Allones or Onesandzerro
no way to know how the correct file name
 
With the limitation of only reading 1 character from just 1 of the 3 files. I don't see any way to know how to name them. you would have a 50% chance either way.
if the character was a zero the file could be either Allzero or Onesandzero
if the character was a one the file could be either Allones or Onesandzerro
no way to know how the correct file name

The hint is that they are ALL misnamed.
 
I think I get what JaxGTO is saying. No file is correct.
Initial Observastions
File 1 = OnesandZero
File 2 = Zero
File 3 = Ones.

Read File1.
If character = 1, then File 1 = Ones.
File 2 Cannot be Zero since it was wrong, and cannot be Ones since File1=Ones. Sor File 2 must be OnesandZeros.
File 3 cannot be Ones and cannot be OnesandZeros so must be Zeros
 
Last edited:
I think I get what JaxGTO is saying. No file is correct.
Initial Observastions
File 1 = OnesandZero
File 2 = Zero
File 3 = Ones.

Read File1.
If character = 1, then File 1 = Ones.
File 2 Cannot be Zero since it was wrong, and cannot be Ones since File1=Ones. Sor File 2 must be OnesandZeros.
File 3 cannot be Ones and cannot be OnesandZeros so must be Zeros was not corr

Exactly!
 
ASSuming that in the file OnesAndZeros, the digits are 101010:

Step One:

Look at the SECOND character of the file named OnesAndZeros. If it's a 0, and the name OnesAndZeros cannot apply, then it cannot be AllOnes so it is AllZeros. If it is a 1 and the name OnesAndZeros cannot apply, then it is AllOnes.

Step 2:
Since you know the name of THAT file, the remaining 2 files must be either OnesAndZeros or the obverse of the one you known the name of. Since neither can be NAMED by it's contents, the file NAMED for the obverse of the one you found MUST be OnesAndZeros.

Step 3: the remaining file is named the opposite of the digit you read.
 
Read Char from OnesAndZeros.txt

If Char ="0" Then
rename AllOnes.txt to OnesAndZeros.txt
rename AllZeroes.txt to AllOnes.txt
rename OnesAndZeros.txt to AllZeros.txt
Else
rename AllOnes.txt to AllZeros.txt
rename AllZeroes.txt to OnesAndZeros.txt
rename OnesAndZeros.txt to AllOnes.txt
End IF

Nick
 

Similar Topics

Match the words to the numbers. No flashing involved. Answers by pm 1. Adam 2. Eve 3. Kant 4. Midas 5. Graham 6. Caliban 7. Sirius 8. Augustus...
Replies
3
Views
2,411
After the warm up puzzle, here's another to keep the grey matter busy. As is the tradition, a flashing output is involved! Answers by pm please...
Replies
8
Views
5,070
Greetings, How can I create some structure tags that are similar to the ones seen in SIMATIC WinCC Tag Management section? Or does Citect SCADA...
Replies
0
Views
1,171
Greetings, How should I refer the variables that come from Unity Pro as tags in Citect SCADA 2016? For instance, I want to import some tags...
Replies
4
Views
1,950
Hello all, Work has a copy of citec scada so as a side project i have been trying to set it up and running. I have hit a bit of a wall with...
Replies
2
Views
1,335
Back
Top Bottom