Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old 10-03-2008, 02:45 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Homework For LuLz

Simplify the following Boolean expression. The final expression should (be logically equivalent) have a weight of four (meaning F = a + b where a and b are some literal in the expression in its complimented or uncomplimented form).
' indicates the literals complement
a + b indicates a OR b
ab indicates a AND b


F = y’z’ + x’yz + x’y + xyz + xz’
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #22 (permalink)  
Old 10-03-2008, 07:49 AM
morefood2001's Avatar   
morefood2001 morefood2001 is offline
Guru
 
Join Date: Jan 2008
Location: Western New York
Posts: 1,415
Last Blog:
VPS Hosting with Revie...
Rep Power: 16
morefood2001 is just really nicemorefood2001 is just really nicemorefood2001 is just really nicemorefood2001 is just really nice
Send a message via AIM to morefood2001 Send a message via MSN to morefood2001 Send a message via Yahoo to morefood2001 Send a message via Skype™ to morefood2001
Default Re: Homework For LuLz

@methodz: sorry to steal a question

@John, I believe that the answer is F=y+z'
__________________
Phil Matuskiewicz
My Personal Website My Other Website
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 10-03-2008, 08:37 AM
Datab0x's Avatar   
Datab0x Datab0x is offline
Newbie
 
Join Date: Oct 2008
Posts: 9
Rep Power: 0
Datab0x is on a distinguished road
Default Re: Homework For LuLz

@methodz - if you also do logic help I think I may hit this thread up when I get my next assignment. I dont want someone to program for me, I just find that I take way too long coming up with an attack plan for the projects. So i need help with that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #24 (permalink)  
Old 10-03-2008, 09:19 AM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is online now
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 15
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Homework For LuLz

I'll code my solution and you can just use it as a guide.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #25 (permalink)  
Old 10-03-2008, 12:20 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,276
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default Re: Homework For LuLz

Quote:
Originally Posted by John View Post
Simplify the following Boolean expression. The final expression should (be logically equivalent) have a weight of four (meaning F = a + b where a and b are some literal in the expression in its complimented or uncomplimented form).
' indicates the literals complement
a + b indicates a OR b
ab indicates a AND b


F = y’z’ + x’yz + x’y + xyz + xz’
Quote:
Originally Posted by morefood2001 View Post
@methodz: sorry to steal a question

@John, I believe that the answer is F=y+z'
Odd, I'm getting F=y'z' + yz + x'y + xz', assuming AND binds more strongly than OR.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #26 (permalink)  
Old 10-03-2008, 07:03 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Homework For LuLz

There are several methods to find the solution mine is far from the simplest but it is the most explicit.

(x + x') => 1
(1 + x) => 1

(1)
F = y’z’ + x’yz + x’y + xyz + xz’
F = y’z’ +yz(x' + x) + x’y + xz’
F = y’z’ +yz + x’y + xz’

(2)
F = y’z’ +yz + x’y + xz’(y + y')
F = y’z’ +yz + x’y + xyz’ + xy'z’

(3)
F = y’z’ +yz + x’y(z + z') + xyz’ + xy'z’
F = y’z’ +yz + x’yz + x’yz' + xyz’ + xy'z’

(4)
F = y’z’ + yz + x’yz + x’yz' + xyz’ + xy'z’
F = y’z’ + (1 + x')yz + x’yz' + xyz’ + xy'z’
F = y’z’ + yz + x’yz' + xyz’ + xy'z’

(5)
F = y’z’ + yz + x’yz' + xyz’ + xy'z’
F = y’z’ + yz + (x’ + x)yz' + xy'z’
F = y’z’ + yz + yz' + xy'z’

(6)
F = y’z’ + yz + yz' + xy'z’
F = yz + yz' + (1 + x)y'z’
F = yz + yz' + y'z’

(7)
F = yz + yz' + y'z’ + yz'

(8)
F = yz + yz' + y'z’ + yz'
F = y(z + z') + yz' + y'z’
F = y + yz' + y'z’

(9)
F = y + yz' + y'z’
F = y + z'(y + y')
F = y + z'

Q.E.D.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #27 (permalink)  
Old 10-03-2008, 08:19 PM
chili5's Avatar   
chili5 chili5 is online now
Code Warrior
 
Join Date: Mar 2008
Age: 15
Posts: 3,598
Rep Power: 31
chili5 is a name known to allchili5 is a name known to allchili5 is a name known to allchili5 is a name known to allchili5 is a name known to allchili5 is a name known to all
Default Re: Homework For LuLz

Wow, I have no idea what the above math is.

If your bored:

Quote:
Have the user guess at random number. Have the computer tell the user either “Higher” or “Lower” until correct. The program will show the total number of guesses. Also, if the user is a moron, tell them so. For example, assume the correct number is 12. If the user inputs 7 and your program informs the user “higher”, if at any later time the user inputs a number of 7 or lower, the program is permitted to call the user a “moron”. Call the user an idiot if they repeat a guessed number.
I haven't tried it yet, but what you come up with would be interesting.
__________________
Emo Philips - "My computer beat me at checkers, but I sure beat it at kickboxing."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #28 (permalink)  
Old 10-04-2008, 12:11 AM
Aereshaa's Avatar   
Aereshaa Aereshaa is offline
Guru
 
Join Date: Apr 2008
Posts: 500
Rep Power: 9
Aereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the rough
Default Re: Homework For LuLz

Since you didn't specify a language, I tried that kind of game in Ruby, the most recent language I've added to my repertoire. This one not only keeps track of maximum and minimum, but leaves the user to deduce them!
Code:
class GuessGame
    def initialize
        @correct = rand(1000) + 1 # Correct guess.
        @max = 1000 # Maximum and minimum for
        @min = 1    # "homing in" on the answer.
        @last = nil # The last guess.
        @guesses = 0
    end
    def guess (x)
        @guesses += 1
        curr = (x - @correct).abs
        if x = @correct
            print "You got it!\n"
        end
        if @last
            lastd = (@last - @correct).abs 
            if lastd < curr
                print "Colder\n"
            elsif lastd > curr
                print "Warmer\n"
                if x > @last && @last > @min 
                    @min = @last # Increase the minimum.
                elsif x < @last && @last < @max
                    @max = @last # Decrease the maximum.
                end  
            end
            if x > @max || x < @min
                print "Idiot!\n" # Problem exists between keyboard and chair.
            end 
        end
        @last = x; # This guess becomes the last guess
    end
    attr_reader :max, :min
end

game = GuessGame.new
continue = true # Continue until the user exits.
while(continue)
    print "Guess: " # Prompt.
    cmd = gets 
    if cmd =~ /exit|quit|bye/i # Exit commands; case insensitive.
        print "See ya!\n"
        exit
#   elsif cmd =~ /max|min/i # For testing.
#       print game.max, "\n", game.min, "\n"
    elsif cmd =~ /^[0-9]+/
        game.guess cmd.to_i
    end 
end
What do you think?

Last edited by Aereshaa; 10-04-2008 at 01:25 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #29 (permalink)  
Old 10-04-2008, 12:25 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,276
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default Re: Homework For LuLz

@chili5: it's formal logic.

@John: I found your solution... non-intuitive so used a Venn-diagram approach: I did a Venn diagram for each of the original 5 pieces, then the union (+) and it's trivial to observe that the result is y+z'
Attached Thumbnails
homework-lulz-ycomp-zcomp.jpg  homework-lulz-xcomp-y-z.jpg  homework-lulz-xcomp-y.jpg  homework-lulz-x-y-z.jpg  homework-lulz-x-zcomp.jpg  

homework-lulz-y-zcomp.jpg  
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #30 (permalink)  
Old 10-04-2008, 01:45 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Homework For LuLz

Quote:
Originally Posted by WingedPanther View Post
@John: I found your solution... non-intuitive so used a Venn-diagram approach: I did a Venn diagram for each of the original 5 pieces, then the union (+) and it's trivial to observe that the result is y+z'
That wasn't actually my solution, but a solution provided my professor. I too find it very non-intuitive. He merely used it as an example to show it is indeed logical, but more importantly, there is a need for a simpler method. And I suppose that method is a Karnaugh map, although I have not studied it yet. When I do dive deeper into this logic, I'm sure your venn-diagrams will make more sense, and you will probably receive a question or two from me along the way.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Homework help - Algorithm complexity Pillager Programming Theory 3 09-08-2008 05:06 PM
I need help for my homework RoyaLTigeR Java Help 2 05-13-2008 03:39 PM
HomeWork Question - VAL() Lop Visual Basic Programming 2 07-11-2007 09:32 AM
Homework Help John Java Help 12 11-02-2006 05:50 AM


All times are GMT -5. The time now is 01:22 PM.

CodeCall