Rabu, 21 Desember 2016

Rabu, 11 Mei 2016

Scope v1.1

There are changes in Scope definition.

For a statement: Predicate(x,y), there are 3 kind of Scope :
1. One-to-one deterministic relation.
    Example : Pet(x,y) means that x have y as pet.
x has possible values : {Norwegian,Dane,Brit,German,Swede}
y has possible values : {Bird,Dog,Horse,Cat,Fish}
    
    One-to-one relation means that each x only have one y value that different from other (x,y) pairs
    Example :
    If Pet(Norwegian,Bird) is true, then other x values cannot have Bird as y value,
    so Pet(Dane,Bird) is false, Pet(Brit,Bird) is false, Pet(German,Bird) is false,
    Pet(Swede,Bird) is false. Also if x = Norwegian, then the only y value that make the statement true     is Bird, so Pet(Norwegian,Dog) is false, Pet(Norwegian,Horse) is false, 
    Pet(Norwegian,Cat) is false, Pet(Norwegian,Fish) is false.
    
    Deterministic means that if only one pair is left in the unused scope (Unused scope is a scope 
    having values that haven't been used in Fact list, Fact list is a list that contains all true statements) 
    then the pair will become Fact.
    Example :
    If Pet(Norwegian,Bird) is true, Pet(Dane,Dog) is true, Pet(Brit, Horse) is true, and
    Pet(German,Cat) is true, then the unused scope is 
    Pet(x,y),
    x : {Swede}
    y : {Fish}
    Because the unused scope have only one pair of (x,y) values and the Scope is deterministic, then
    the unused scope will be converted to Fact : Pet(Swede,Fish) is true.

 2. One-to-one nondeterministic relation.
     Example : LeftSide(x,y) means that x's house is on the left of y's house.
      x: {Norwegian,Dane,Brit,German,Swede}
y: {Norwegian,Dane,Brit,German,Swede}
    One-to-one relation is already explained before in number 1.
    So if LeftSide(Norwegian, Dane) is true, then LeftSide(Norwegian, Norwegian) is false,
    LeftSide(Norwegian,Brit) is false, LeftSide(Norwegian,German) is false,
    LeftSide(Norwegian,Swede) is false, LeftSide(Dane, Dane) is false,
    LeftSide(Brit, Dane) is false, LeftSide(German, Dane) is false,
    LeftSide(Swede, Dane) is false.

    Nondeterministic means that if only one pair is left in the unused scope, the pair will not
    become Fact.
    Example :
    If LeftSide(Norwegian, Dane) is true, LeftSide(Dane, Brit) is true, 
    LeftSide(Brit, German) is true, LeftSide(German, Swede) is true, then the unused scope is
    LeftSide(x,y)
    x : {Swede}
    y : {Norwegian}
    Because the unused scope have only one pair of (x,y) values and the Scope is nondeterministic,
    then the unused scope won't be converted to Fact.

3. Many-to-many relation.
    Example : LivesNext(x,y) means that x live next to y (either on the left side or the right side)
     x: {Norwegian,Dane,Brit,German,Swede}
y: {Norwegian,Dane,Brit,German,Swede}
    Many-to-many relation means that each x value can have one or more y value as (x,y) pair,
    and also each y value can have one or more x value as (x,y) pair.
    Example :
    If LivesNext(Norwegian, Dane) is true, then LivesNext(Norwegian, Brit) can be true
    or LivesNext(German, Dane) can be true.


I'm back (to blogging) !

Well, it has been a long time not to blog, it's already 8 years passed.

I've got the logic puzzle website, http://www.logic-puzzles.org/

So far I just got 5 puzzles from the website that can be solved by my application.



Jumat, 09 Mei 2008

Illustration of Einstein Quiz (Part VI)

Position
Nationality
HouseColor
Beverage
Cigar
Pets

From the statement :

- The person who smokes Pall Mall rears birds.

We know that the Brit smokes Pall Mall, so :

- The Brit rears birds


Position
Nationality
HouseColor
Beverage
Cigar
Pets

From the statement :

- The man who keeps horses lives next to the man who smokes Dunhill.

We know that Norwegian smokes Dunhill, and his neighbor is the Dane

So :

- The Dane keeps horses


Position
Nationality
HouseColor
Beverage
Cigar
Pets

From the statement :

- The man who smokes Blend lives next to the one who keeps cats.

We know that the man who smokes Blend is the Dane.

He lives between two neighbors, they are Norwegian & Brit.

The Brit keeps birds as pets.

So the other neighbor, as the statement says, keeps cats.

- The Norwegian keeps cats


Position
Nationality
HouseColor
Beverage
Cigar
Pets

So we know that the empty slot of the pets, is FISH!

Position
Nationality
HouseColor
Beverage
Cigar
Pets

And the answer of the riddle :

WHO KEEPS FISH?

is :

The German keeps Fish :)

Try this demo application of puzzle workout (quite working for the puzzle above)

http://www.geocities.com/anda198/PuzzleWorkout.zip