Author Topic: Mat to hex  (Read 2512 times)

0 Members and 1 Guest are viewing this topic.

Offline noahbaby94

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 585
  • Rating: +29/-24
    • View Profile
    • My blog
Mat to hex
« on: February 24, 2009, 09:44:46 am »
Can someone tell me what's wrong with my program it converts a matrix to hex.
Code: [Select]
:"?→Str1
:For(A,1,8
:For(B,1,12
:det(29,[A](A,B
:If 1=length(Ans
:"0"+Ans
:Ans+Str1→Str1
:End:End
:det(17,sub(Ans,2,length(Ans)-1→Str1
I'm executing it with this.
Code: [Select]
:identity(4,Str1,0,0,12,8,0,12,0,8,1,0,8,1,0
Strangely if I do this
Code: [Select]
:identity(4,Str1,0,1,12,8,0,12,0,8,1,0,8,1,0
I get it aligned properly but up one.
« Last Edit: February 24, 2009, 09:48:25 am by noahbaby94 »
That's what she said!!!

Offline simplethinker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 695
  • Rating: +16/-5
  • snjwffl
    • View Profile
Re: Mat to hex
« Reply #1 on: February 24, 2009, 01:30:18 pm »
Where is the problem occurring and what exactly is it?

Using your first code chunk
Code: [Select]
:identity(4,Str1,0,0,12,8,0,12,0,8,1,0,8,1,0I don't get a problem, it will fill the map completely/correctly, but the second (the one you're not having problems with)
Code: [Select]
:identity(4,Str1,0,1,12,8,0,12,0,8,1,0,8,1,0Only tiles the bottom row incompletely.

[edit] You could just use det(26 to convert the matrix to a string and then use det(17 to get the binary string.  For all the matrices I tried they both returned the same string.  Nevermind

[another edit] I think I figured out the problem.  You're going 'backwards'.  You're adding your previous string to the end of the new element, so if you're matrix was [[1,2,3]], your program gives "030201?"
« Last Edit: February 24, 2009, 03:12:35 pm by simplethinker »
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky



Chip's Challenge: ħ%