Avatar billede fredand Forsker
27. november 2006 - 08:41 Der er 3 kommentarer og
1 løsning

Logic-problem

Hello!

This is actuallay a databas problem with triggiers that we are stucked with.

How ever, to find a new approach we try to look at the problem from a different angle.

So now I hope some one could give us some input.

Imagin this.

A blind man guards a door. His mission is to open and close the door for different groups of mute people.

Each group of people can consist of 1 or n number of people.

In each group the first man knocks on the door so the blind man knows when to open.

Each person in a group can only tell if he is the first person to enter the door, by knockin the door, of the group or if he is not the first. No one can tell if he is the last.

An extra problem is that different groups of people can arrive at the same time and then enter mixed with an other group.

How ever each person has some sort of a sign that the connects him to one specific group.

The problem now is how shall the blind man know when to close the door?

If ha waits some time and try to close then he risk to close the door too soon and a just a part of a group manage to get in.

Therfore using the time is not a suitable solution.

Best regards
Fredrik
Avatar billede jakoba Nybegynder
27. november 2006 - 10:38 #1
As you state it, the problem have no solution.
Then again, algoritmically there is no problem. There are clear and definite algorithms for both the blind and the dumbs that allow them to perform their function. The only added stipulation we need is that doorclosing and doorpassing must be 'instantaneous' so it is not possible for a dumb to arriwe while the door is in the process of being closed, and equally impossible for the blind to close the door while somebody is in it.

dumb:
1) arrive at door
2) if closed knock on door
3) if open pass through
4) goto 2.

blind:
a1) if open  close door
a2) if knock open door
a3) goto a1

You will notice that the 'grouping' of people arriving is entirely ignored. the only way such grouping can be determined would be through some sort of timed delay, eg: all members in group red go to the red buffer area and are processed together at suitable time intervals.

if the grouping is important, please tell why.

regards JakobA
Avatar billede fredand Forsker
27. november 2006 - 11:37 #2
Hello!

Thanks for your reply!

Yes the gouping is important in a later state that I did not mentioned.

In each group there is only one person that will be allowed see a football game.
If one of the persons in a group got a VIP-card, then pick him to see the football game.
If nobody in the the group got a VIP-card then pick one person in the group randomly to see the footballgame.

Hope you see the point.

I guess there is no way to then to signal to the blind that this is the last person, as I have state it.

Best regards
Fredrik
Avatar billede fredand Forsker
30. december 2006 - 13:39 #3
Please give a svar so I can reward you!
Avatar billede fredand Forsker
29. december 2010 - 21:05 #4
I close this one since it is old!

Best regards
Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

IT-JOB

AL Sydbank A/S (tidligere Arbejdernes Landsbank)

Tech Lead til Datacenter Operations

Capgemini Danmark A/S

IGNITE Graduate Program 2026

Politiets Efterretningstjeneste

Teamledere til PETs indhentningsafdeling