Hey members, especially coders of D3Scene!
Hereby I want to announce a special event that'll take place on D3Scene for the next 10 days [Until 19th of May, 2013].
What is this all about?
You will have to edit a .c file (Yes, it's about coding in C but any coder will be able to solve the coding part) which has a few tasks to solve, rated from 1 to 4 (1 being the easiest, 4 the most difficult task).
The tasks will be based on bit-operations to you'll be required to know about HEX, Binary and Decimal systems.
Now the problem is not really to solve the tasks, but to manage it with as little operations as possible [I will provide an example at the end to show you what an operation means].
So you might now ask how to proceed and why to do this. Well, easy answer:
You can try to be better than me and my solution. I'll show you my code in the end plus how many operations it took me!
If enough people participate I'll throw some prizes in! :)
Alright, enough talking. Here's the code you'll have to edit:
Here is an example on how it has to look like:
This is how to solve it:
Notice that I only used operations that were legit. If there is no '-' listed you're not allowed to use it, obviously (Would come in handy in some tasks though..).
It took me exactly ONE (1) operation (~).
Using '=' or declaring variables doesn't count as operation.
Another example:
The return will be 2 and there was one operation (>>) used!
I hope that helped you on your way and now: Go ahead and solve the tasks! :)
Rules:
- When you're done PM me your code
- It's not allowed to call any other functions within or from outside of each function.
- Only use operations that are stated to be allowed!
- Have fun! :)
Here's a list of how many operations it took me to solve the tasks:
bitNor: 3
negate: 2
isEqual: 2
isNonNegative: 2
reverseBytes: 12
multFiveEights: 6
abs: 4
logicalNeg: 6
Come at me brooo! ;)
In case this is too easy for you I have some more tasks that are very difficult to solve.
Hereby I want to announce a special event that'll take place on D3Scene for the next 10 days [Until 19th of May, 2013].
What is this all about?
You will have to edit a .c file (Yes, it's about coding in C but any coder will be able to solve the coding part) which has a few tasks to solve, rated from 1 to 4 (1 being the easiest, 4 the most difficult task).
The tasks will be based on bit-operations to you'll be required to know about HEX, Binary and Decimal systems.
Now the problem is not really to solve the tasks, but to manage it with as little operations as possible [I will provide an example at the end to show you what an operation means].
So you might now ask how to proceed and why to do this. Well, easy answer:
You can try to be better than me and my solution. I'll show you my code in the end plus how many operations it took me!
If enough people participate I'll throw some prizes in! :)
Alright, enough talking. Here's the code you'll have to edit:
Here is an example on how it has to look like:
This is how to solve it:
Notice that I only used operations that were legit. If there is no '-' listed you're not allowed to use it, obviously (Would come in handy in some tasks though..).
It took me exactly ONE (1) operation (~).
Using '=' or declaring variables doesn't count as operation.
Another example:
The return will be 2 and there was one operation (>>) used!
I hope that helped you on your way and now: Go ahead and solve the tasks! :)
Rules:
- When you're done PM me your code
- It's not allowed to call any other functions within or from outside of each function.
- Only use operations that are stated to be allowed!
- Have fun! :)
Here's a list of how many operations it took me to solve the tasks:
bitNor: 3
negate: 2
isEqual: 2
isNonNegative: 2
reverseBytes: 12
multFiveEights: 6
abs: 4
logicalNeg: 6
Come at me brooo! ;)
In case this is too easy for you I have some more tasks that are very difficult to solve.