![]() |
| | #1 |
| Registered User Join Date: Jan 2007
Posts: 18
| 0xDEADBEEF (who can get to it first) Here's the deal: using the hex values: AAAAAAAA CCCCCCCC F0F0F0F0 FF00FF00 FFFF0000 and only the bitwise operators: ~ | & ^ create an expression that comes out to the well-known DEADBEEF I thought maybe we could do it like a contest if anyone's up for it...I don't have an answer yet, (I've been on it for a few hours now, think I might be going in circles...) but hopefully I will soon to check up with anyone that decides to join in Ok, good luck! Oh, yeah, and here's a little refresher on the operators if you need it: http://www.cs.cf.ac.uk/Dave/C/node13.html |
| nine-hundred is offline | |
| | #2 |
| pwns nooblars Join Date: Oct 2005 Location: Portland, Or
Posts: 1,094
| Hmm shouldn't be too hard to figure out a solution, but the solution with the least moves is the key I think. Could just set it up in a program and just have it randomly choose one of the values and one of the operators and do it untill it comes out as 0xDEADBEEF. With how fast processors are it shouldn't take too long heh... going to play with it. |
| Wraithan is offline | |
| | #3 | |
| Just Lurking Join Date: Oct 2002
Posts: 4,990
| With a mere 1 post under your belt, and this thread reeking of an inventive new ploy (kudos to that, however, if that is the case) to have someone else do your homework, I will close this. Feel free to PM a mod or an admin to reconcile this, and it will most happily be reopened. Perhaps you could also post, in this PM, a proposed solution? [edit] Quote:
__________________ 7. It is easier to write an incorrect program than understand a correct one. 40. There are two ways to write error-free programs; only the third one works.* | |
| Dave_Sinkula is offline | |
| | #4 |
| Registered User Join Date: Jan 2007
Posts: 18
| Thanks, sorry about the misunderstanding... for anyone who still wants in, I'm going to be working on it again tonight...didn't get much farther last night than what was posted |
| nine-hundred is offline | |
| | #5 |
| int x = *((int *) NULL); Join Date: Jul 2003 Location: Banks of the River Styx
Posts: 891
| Perhaps the rules should be laid out a little clearer. I second Wraithan, in that fewer operations should be worth more. So you know, this is solvable: I do have a solution (not hard to get once you figure out a few tricks...) that involves: 27 numbers, 17 ANDs, 9 ORs, 10 inverses, and 0 XORs. It's a bit long. =) (Hand crafted, of course.) I also wrote a program to try and brute force every combination, and it checked every combo up to 5 operations using &, |, ^, and any number of ~s, and found nothing. At 450MHz, the six group is going to take a while. (I need to find a way to add in %done or saving, or something...)
__________________ long time; /* know C? */ Unprecedented performance: Nothing ever ran this slow before. Any sufficiently advanced bug is indistinguishable from a feature. Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31. The best way to accelerate an IBM is at 9.8 m/s/s. recursion (re - cur' - zhun) n. 1. (see recursion) |
| Cactus_Hugger is offline | |
| | #6 |
| pwns nooblars Join Date: Oct 2005 Location: Portland, Or
Posts: 1,094
| Well if you do it sequentially, then you should just have to save the last number and last sign for each position. EDIT: Think I am going to go set it up to brute force on my desktop, 2.8ghz and I am not doing much else with it. |
| Wraithan is offline | |
| | #7 | |
| Just Lurking Join Date: Oct 2002
Posts: 4,990
| Quote:
Code: '&' : 16
'(' : 9
')' : 9
'G' : 5
'I' : 5
'O' : 5
'Q' : 3
'^' : 5
'l' : 5
'|' : 1
'~' : 12
I just had to find a solution myself, too. But I stopped short of trying to simplifying it.
__________________ 7. It is easier to write an incorrect program than understand a correct one. 40. There are two ways to write error-free programs; only the third one works.* | |
| Dave_Sinkula is offline | |
| | #8 |
| Registered User Join Date: Jan 2007
Posts: 18
| Meant to post this sooner but couldn't load the site up for some reason or another... I also tried to do it with code randomly inject operators and varaibles, after some frustration, but like you guys I got the the answer by hand first. I ended up with a huge expression and after simplification it came down to (if I counted right) 9 | 10 ~ 13 & and somehow no ^...don't know why that was using the numbers 26 times It could probably be simplified more, but I started going in circles on it and stopped I'm all for who can do it in the fewest steps! If anyone's curious PM me and I can send my solution, but I don't want to ruin it for anyone still going at it! I'm sure there must be a shorter one, I'm going to continue and see if I can get the algorithm for the program to be more successful Happy Hunting |
| nine-hundred is offline | |
| | #9 | |
| Just Lurking Join Date: Oct 2002
Posts: 4,990
| Quote:
DEEEEEEEIt's been way too long, I couldn't even remember Karnaugh maps or Quine-McCluskey until I started searching. But I don't think they apply(?).
__________________ 7. It is easier to write an incorrect program than understand a correct one. 40. There are two ways to write error-free programs; only the third one works.* | |
| Dave_Sinkula is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|