Jump to content

craziness!


playdo

Recommended Posts

like i said above binary is 8, however if you take out the 0's after the last 1 in the sequence will it really matter. It ios just a shorter way, though i didnt do it with all of them

 

Do you mean remove the 0's infront of the first 1?

Link to comment
Share on other sites

\ is separator, \\ is space (word separator). Translated, it reads:

 

A <27> a s \ a \ Winner

 

A^zas A W i n n e r. You destroyed the second byte, it's not zeroed, as 27 is the only one not in the character range. It corresponds to Ctrl+Z, aka EOF.

 

P.S. I'm late so I didn't check/recheck anything nor did i have the time to put any tools together, it's done in the mind so don't hold me responsible, mkay? :)

Link to comment
Share on other sites

u dont understans,

if i had written out for example: 0010100, it would be the same as ..................................00101 because if it i wrote it and it ends in a 1, the rest have to be 0's

it's binary

 

ndi, i don't know what u did but it sounds kool, and it's is almost the right outcome

Link to comment
Share on other sites

Code was generated as Bin(Ord(S)). Allow me to be thorough so we can skip this "I think" phase.

 

You take a char, convert it to numbers (ASCII), the write it out as binary. Like this:

 

A

A is 65 in ASCII

65 is 01000001

 

In binary, you convert from right to left, each digit represents 2 to the power of the ID, starting from 0:

 

87654321 << ID

76543210 << power

128 64 32 16 8 4 2 1, 1 is 2 ^0, 2 is 2^ 1, 4 is 2^2, etc, u to 2^7 (128). Then you add:

 

01000001 has bits in the positions 7 and 1. 2^6 is 64, 2^0 is 1. That is 64+1=65. In ASCII, 65 = capital letter a (A).

 

Encoding is done in reverse. It's not really encoding, it's really how it's stored. If you write the text in Notepad, save it, the use a disk editor, it reads as the "code" above.

 

We have the code:

function BinToDec(s: String): Integer;
var
 i: Integer;
begin
 // initialize
 Result := 0;

 // empty string (//) we treat as space.
 if Length(s) = 0 then
   begin
     Result := 32;
     Exit;
   end;

 // translate binary.
 for i := 1 to Length(s) do // for each number
   if s[i] = '1' then // if one (cheating - only in binary)
     Result := Result + Round(Power(2, Length(s) - (i))); // power + result
end;

 

Which does the transformation. Then we process as:

 

 // clear screen so we can reuse the lines when editing the screen.
 Memo1.Lines.Clear;

 // split the string by \
 Tok := TTokenizer.Create(Edit1.Text, '/');

 // for each "split", add explanation to a memo.
 for i := 0 to tok.Count - 1 do
   Memo1.Lines.Add(
     Tok[i] + 'bin = ' +                    // binary
     IntToStr(BinToDec(Tok[i])) + 'dec = "'+// deciman
     chr(BinToDec(Tok[i])) + '"ASCII'       // ASCII
     );

 

The output reads:

01000001bin = 65dec = "A"ASCII

011011bin = 27dec = ""ASCII

01100001bin = 97dec = "a"ASCII

01110011bin = 115dec = "s"ASCII

bin = 32dec = " "ASCII

01000001bin = 65dec = "A"ASCII

bin = 32dec = " "ASCII

01010111bin = 87dec = "W"ASCII

01101001bin = 105dec = "i"ASCII

01101110bin = 110dec = "n"ASCII

01101110bin = 110dec = "n"ASCII

01100101bin = 101dec = "e"ASCII

01110010bin = 114dec = "r"ASCII

 

 

Now that we have code, we can type numbers over it so we see results in real time. Clues by the bad conception that zeros matter at the beginning, I tried at end, thus:

 

01000001bin = 65dec = "A"ASCII

01101100bin = 108dec = "l"ASCII

01100001bin = 97dec = "a"ASCII

01110011bin = 115dec = "s"ASCII

bin = 32dec = " "ASCII

01000001bin = 65dec = "A"ASCII

bin = 32dec = " "ASCII

01010111bin = 87dec = "W"ASCII

01101001bin = 105dec = "i"ASCII

01101110bin = 110dec = "n"ASCII

01101110bin = 110dec = "n"ASCII

01100101bin = 101dec = "e"ASCII

01110010bin = 114dec = "r"ASCII

 

The code reads: "Alas A Winner", with the capitalization[sic]. Grammar included. Now we can move on.

 

Scooby Doo has nothing on me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.