logo Sign In

ricarleite

User Group
Members
Join date
9-Apr-2004
Last activity
21-Aug-2020
Posts
6,592

Post History

Post
#88656
Topic
The Things We Hate And Love Thread .
Time
Things I hate: even thought I've worked non-stop for 2 weeks and hardly got some sleep because I had so much stuff to do, I'm low on money, with a terrible headache from all the stress I've gone through, and I don't have anywhee to go on this saturday night. Oh well, cest la vie.

Chaltab: I'd consider changing this signature, might offend someone. The term "jap" is considered offensive.
Post
#88640
Topic
Sequels that should never be...
Time
Quote

Originally posted by: TheSessler
Pink Panther


I strongly recomend it... as I recomend every Peter Sellers movie (specially Dr Strangelove and The Party).

"I'd like to rent a 'rum' "
"A what?"

"Kato...? Where are you my little yellow friend..."

"Does your dog bite?"
"No..."
"Hello, little doggy..." *dogs bites clouseu's hand* "you said your dog didn't bite"
"That's not my dog."

*clouseu destroys a piano *
"That was a valuable piano!" (or something like that)
"Not anymore."
Post
#88569
Topic
Riddles
Time
I tried to think of a recursive algorithm to solve the riddle but I wasn't able to. It would be something like:

b = 0;

function PrisonerRiddle(a, b){

//a = status of the lamp
//b = number of days

b = b + 1;

if b < 100 then PrisonerRiddle(a, b);
else

//do stuff

//the solution would be something like:
if a == 0 then print("I am the last prisoner!");

end if

}



Come to think of it, I think I can do it creating threads for the prisoners, and all of them accessing the function. Which brings me to another riddle proposed by a "operating systems" profesor back in college, which I've solved by programming threads in Java. It's an easy one, and it goes like this:

Imagine that there are five filosofers sitting on a round table, each with a plate with spaghetti on it. These filosofers eat the spaghetti using 2 forks at the same time. Now, between each plate there is only one fork, so that a filosofer can see his plate, a fork on the left side, and a fork on the right side. OK? Now, every filosofer will start eating his spaghetti at a random time, eat it for a random time, and stop eating it at a random time, the proceed to eat again, ad infinitum. When a filosofer decides to eat the spaghetti, he'll reach for BOTH forks and proceed to eat. The problem is, if a filosofer grabs a fork, let's say, on his left side, the filosofer to his left can't grab his RIGHT fork, get it? Now, if a filosofer wants to eat, and he can't get both of his right and left forks, he'll just stay there, waiting for the fork. Unfortunally, this can lead to a lock up if every filosofer grabs one fork. Now, you gotta decide a special rule so that this scenario never happens, and the filosofers never lock up.