JEJEJe me estoy volviendo adictoa esto mmmmmmmmmm--- maldita programacion aaaaahhhhhh
bueno primero quiero comentar que este es un post rapidito el punto es que me esta llendo de lapatada en la escuela si alguien sabe bien dragamas de lujo se aceptan sugerencias jajjajajo mas facil aguien entiende esto?
For example we can illustrate some cases for which Boolean minimization is
required, we would use Object Pascal language to show such situations in great details,
lets imagine that we have this piece of code:
if (not Flag1 and not Flag2 and not Flag3 and not Flag4)
or (not Flag1 and not Flag2 and Flag3 and not Flag4)
or (not Flag1 and Flag2 and not Flag3 and Flag4)
or (not Flag1 and Flag2 and Flag3 and Flag4)
or (not Flag1 and Flag2 and Flag3 and not Flag4)
or (Flag1 and Flag2 and Flag3 and Flag4)
or (Flag1 and not Flag2 and not Flag3 and Flag4)
or (Flag1 and not Flag2 and Flag3 and not Flag4) then
All FlagX variables (Flag1, Flag2, Flag3, Flag4) as of Boolean data type for short, now
we'll try to do something with this code, first of all we need to substitute FlagX variables
with simple alphabets, Flag1 = A, Flag2 = B, and so on, and = "*", or = "+", not = "|".
We would get following Boolean equation:
|A*|B*|C*|D + |A*|B*C*|D + |A*B*|C*D + |A*B*C*D + |A*B*C*|D + A*B*C*D + A*|B*|C*D + A*|B*C*|D
Now it is the right time to use our little helper, run Karnaugh Minimizer, press "Formula"
button from tools panel, copy & paste our above equation into this form and press "Ok",
Karnaugh Map for this equation is ready for optimization.
Press "Analyze" button that is it, now we have optimized results right to the map, results
are shown as tree of terms, root node would have this equation:
|B*C*|D + B*C*D + |A*B*C + |A*B*D + |A*|B*|D + A*|B*|C*D
In order to optimize the results even more, we can call popup menu on that root node
and choose "Copy optimized" menu item.
After future optimizations whole equation will looks like:
C*(B |@ D)+|A*B*(C+D)+|B*(|A*|D+A*|C*D)
Note: "|@" symbol denote XNOR operator, and you can revert B |@ D fragment
as |B*|D + B*D or it would be (not Flag2 and not Flag4 or Flag2 and Flag4) in Object Pascal.
And this equation is located in clipboard! Paste it to the source code editor and after
you have all symbols reverted back we'll get this piece of code:
if Flag3 and (not Flag2 and not Flag4 or Flag2 and Flag4)
or not Flag1 and Flag2 and (Flag3 or Flag4)
or not Flag2 and (not Flag1 and not Flag4
or Flag1 and not Flag3 and Flag4) then
As we can see the resulted piece of source code is twice as short as its initial
representation, Nice, Isn't it? Now we have neat 4 lines condition instead of 8
lines, that is better than leave all as it is and bypass this problem.
Of course such a complicated conditions as discussed above is very rarely takes
place in the real source code, but it is the way to show, how you can perform
low cost and high quality refactoring using pure logic by yourself.
JAJAJAJAJAJAJAJAAJA la verdad no le entendi ni madres jajajja y se supoene que con esto debo hacer un prgama jejej bueno despues les digo como me fue jajajajajajajaja.
For example we can illustrate some cases for which Boolean minimization is
required, we would use Object Pascal language to show such situations in great details,
lets imagine that we have this piece of code:
if (not Flag1 and not Flag2 and not Flag3 and not Flag4)
or (not Flag1 and not Flag2 and Flag3 and not Flag4)
or (not Flag1 and Flag2 and not Flag3 and Flag4)
or (not Flag1 and Flag2 and Flag3 and Flag4)
or (not Flag1 and Flag2 and Flag3 and not Flag4)
or (Flag1 and Flag2 and Flag3 and Flag4)
or (Flag1 and not Flag2 and not Flag3 and Flag4)
or (Flag1 and not Flag2 and Flag3 and not Flag4) then
All FlagX variables (Flag1, Flag2, Flag3, Flag4) as of Boolean data type for short, now
we'll try to do something with this code, first of all we need to substitute FlagX variables
with simple alphabets, Flag1 = A, Flag2 = B, and so on, and = "*", or = "+", not = "|".
We would get following Boolean equation:
|A*|B*|C*|D + |A*|B*C*|D + |A*B*|C*D + |A*B*C*D + |A*B*C*|D + A*B*C*D + A*|B*|C*D + A*|B*C*|D
Now it is the right time to use our little helper, run Karnaugh Minimizer, press "Formula"
button from tools panel, copy & paste our above equation into this form and press "Ok",
Karnaugh Map for this equation is ready for optimization.
Press "Analyze" button that is it, now we have optimized results right to the map, results
are shown as tree of terms, root node would have this equation:
|B*C*|D + B*C*D + |A*B*C + |A*B*D + |A*|B*|D + A*|B*|C*D
In order to optimize the results even more, we can call popup menu on that root node
and choose "Copy optimized" menu item.
After future optimizations whole equation will looks like:
C*(B |@ D)+|A*B*(C+D)+|B*(|A*|D+A*|C*D)
Note: "|@" symbol denote XNOR operator, and you can revert B |@ D fragment
as |B*|D + B*D or it would be (not Flag2 and not Flag4 or Flag2 and Flag4) in Object Pascal.
And this equation is located in clipboard! Paste it to the source code editor and after
you have all symbols reverted back we'll get this piece of code:
if Flag3 and (not Flag2 and not Flag4 or Flag2 and Flag4)
or not Flag1 and Flag2 and (Flag3 or Flag4)
or not Flag2 and (not Flag1 and not Flag4
or Flag1 and not Flag3 and Flag4) then
As we can see the resulted piece of source code is twice as short as its initial
representation, Nice, Isn't it? Now we have neat 4 lines condition instead of 8
lines, that is better than leave all as it is and bypass this problem.
Of course such a complicated conditions as discussed above is very rarely takes
place in the real source code, but it is the way to show, how you can perform
low cost and high quality refactoring using pure logic by yourself.
JAJAJAJAJAJAJAJAAJA la verdad no le entendi ni madres jajajja y se supoene que con esto debo hacer un prgama jejej bueno despues les digo como me fue jajajajajajajaja.






