Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Rhyme_Game

Name: Anonymous 2012-10-26 21:06

Haskell

A group of friends are standing in a circle, playing a game. They proceed around the circle, chanting a rhyme and pointing at the next person (clockwise) on each word. When the rhyme finishes whoever speaks the last word leaves the circle. They then start again, pointing where they left off, and the game continues until only one person is left.


For example, suppose there are six friends (numbered 1 to 6) standing around the circle and the rhyme is "Eenee, Meenee, Mainee, Mo!". The first person to leave the circle is number 4, followed by 2 then 1, 3 and 6. Number 5 is left.


Sample run
Number of friends: 7
Words in rhyme: 3
Number 4 is left


Part 1

Write a program that inputs two numbers (each between 1 and 1000 inclusive), the first being n, the number of friends, and the second the number of words in the rhyme. The output should be the number of the last person left. You should assume that the friends are numbered (clockwise) from 1 to n, and that the count begins at person 1.

Part 2

12 friends stand in a circle and use a rhyme with 5 words. In what order do they leave the circle? In other words display the number of the person as they leave.

Name: Anonymous 2012-10-26 21:50

Rhymes are for fucking assfaggots

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List