Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
MC: The Coach's Nightmare
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Joe Horn  
View profile   Translate to Translated (View Original)
 More options 1 Nov, 02:21
Newsgroups: comp.sys.hp48
From: Joe Horn <joeh...@holyjoe.net>
Date: Sat, 31 Oct 2009 19:21:38 -0700 (PDT)
Local: Sun 1 Nov 2009 02:21
Subject: MC: The Coach's Nightmare
Mini-Challenge: Write an RPL program to solve the following coach's
nightmare.  It sounds complicated, but it's not.

True story:  A coach attended one of our weekly EduCALC HP 48
Programming Classes (long, long ago, just down the street).  He told
us that he had been given the daunting task of creating a game
schedule for his league.  "It's too complicated!" he said. "I'm having
nightmares over it!"

Here's the scoop: The league was made up of N teams.  The entire game
schedule for the league was to cover exactly N days (not necessarily
contiguous, but call them Day 1 through Day N for simplicity's sake).
Every team (call them Team 1 through Team N) had to play every other
team exactly once.  Multiple games can happen on any one day, but each
team cannot play more than one game on any one day.  Every team had to
have at least one day (a "bye day") on which they played no game.

During the following week, I wrote a program that input the number of
teams in the league (N), and the numbers of any two teams, and output
the day of those teams' game.  For example, an input of 8, 3, and 5 (8
teams in the league, Team 3 and Team 5), might output that their game
is on Day 2.  If the same team number was used for both teams, then
the day number returned was that team's bye day.  For example, if
teams 3 and 3 are input, it might output day 6, meaning that team 3's
bye day is Day 6.  I eagerly anticipated his reaction to my brilliant
program at the next class.

He didn't come back.  I was totally bummed.  I never saw him again.  I
hope that he solved his own nightmare, which turned out to be quite
simple.  In any case, my program is still in my HP 48, for old times'
sake.

Your programming mini-challenge, if you choose to accept it, is to
write a program that solves The Coach's Nightmare.  Shortest program
wins the usual MC virtual prize.  Beat my program (27.5 bytes) for a
real prize.  Unhint: Renaming the teams or days to 0 through N-1 is
not allowed.

Happy Programming!

-Joe-


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wes  
View profile   Translate to Translated (View Original)
 More options 1 Nov, 14:59
Newsgroups: comp.sys.hp48
From: Wes <wjltemp...@yahoo.com>
Date: Sun, 1 Nov 2009 06:59:24 -0800 (PST)
Local: Sun 1 Nov 2009 14:59
Subject: Re: MC: The Coach's Nightmare
On Nov 1, 5:21 am, Joe Horn <joeh...@holyjoe.net> wrote:

I think I _may_ have a solution, but so as to not kill the contest,
I'll just post the INFO for now and send the program to Joe.

size: 22.5 bytes
crc: # 5247h

-wes


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ddoherty03  
View profile   Translate to Translated (View Original)
 More options 2 Nov, 04:28
Newsgroups: comp.sys.hp48
From: ddoherty03 <ddohert...@gmail.com>
Date: Sun, 1 Nov 2009 20:28:13 -0800 (PST)
Local: Mon 2 Nov 2009 04:28
Subject: Re: MC: The Coach's Nightmare
Dear Joe,

What fun.  Here's my cut after a blind alley through list-land.  This
is my first attempt at any
MC.

<< + SWAP MOD 1 + >>

Thanks for the MC's.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ddoherty03  
View profile   Translate to Translated (View Original)
 More options 2 Nov, 05:14
Newsgroups: comp.sys.hp48
From: ddoherty03 <ddohert...@gmail.com>
Date: Sun, 1 Nov 2009 21:14:57 -0800 (PST)
Local: Mon 2 Nov 2009 05:14
Subject: Re: MC: The Coach's Nightmare
Amendment,

I got 22 as the size in filer, but doing the BYTES command gave me

32 bytes
# 5247h

I'm new to this, so I'm not sure what is the official measure.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Horn  
View profile   Translate to Translated (View Original)
 More options 2 Nov, 12:54
Newsgroups: comp.sys.hp48
From: Joe Horn <joeh...@holyjoe.net>
Date: Mon, 2 Nov 2009 04:54:50 -0800 (PST)
Local: Mon 2 Nov 2009 12:54
Subject: Re: MC: The Coach's Nightmare

ddoherty03 wrote:
> I got 22 as the size in filer, but doing the BYTES command gave me
> 32 bytes
> # 5247h
> I'm new to this, so I'm not sure what is the official measure.
> << + SWAP MOD 1 + >>

Put the program itself (not its name) on the stack and then execute
the BYTES command.  Since << >> is always 10 bytes, and the other
commands in your program are 2.5 bytes each, it looks like it should
return 22.5 bytes, same as Wes above in this thread.

-Joe-


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ddoherty03  
View profile   Translate to Translated (View Original)
 More options 2 Nov, 13:59
Newsgroups: comp.sys.hp48
From: ddoherty03 <ddohert...@gmail.com>
Date: Mon, 2 Nov 2009 05:59:14 -0800 (PST)
Local: Mon 2 Nov 2009 13:59
Subject: Re: MC: The Coach's Nightmare
Yep.  22.5 bytes, #5247h.  Undoubtedly same as Wes.

Thanks, Joe.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Horn  
View profile   Translate to Translated (View Original)
 More options 2 Nov, 22:00
Newsgroups: comp.sys.hp48
From: Joe Horn <joeh...@holyjoe.net>
Date: Mon, 2 Nov 2009 14:00:22 -0800 (PST)
Local: Mon 2 Nov 2009 22:00
Subject: Re: MC: The Coach's Nightmare
I highly doubt that 22.5 bytes can be beaten, so Wes wins his choice
of an HP 8s or 10s, no shipping or handling fee.

Yes, Wes submitted the same program as ddoherty03 (but earlier),
namely << + SWAP MOD 1 + >>.  Wes also wrote that the output becomes
"more logical" by making the progam two commands longer: << + 2 - SWAP
MOD 1 + >> and that's exactly the program that I had in mind when
posting the mini-challenge.

Here's a tougher challenge: If System RPL is allowed, this mini-
challenge can be solved in SIX BYTES!  Go for it; you have nothing
else to do.  ;-)

-Joe-


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Horn  
View profile   Translate to Translated (View Original)
 More options 2 Nov, 22:08
Newsgroups: comp.sys.hp48
From: Joe Horn <joeh...@holyjoe.net>
Date: Mon, 2 Nov 2009 14:08:29 -0800 (PST)
Local: Mon 2 Nov 2009 22:08
Subject: Re: MC: The Coach's Nightmare

> If System RPL is allowed, this mini-
> challenge can be solved in SIX BYTES!

Oops, not true.  The flash pointer that I had in mind doesn't add the
1 at the end, thus violating the rule that the first day number can't
be zero.  Sorry.  The flash pointer is ^QAddMod, which is essentially
<< UNROT + SWAP MOD >>.  Input: team, team, size of league (all as
integers!); output: game day or bye day (base zero).

-Joe-


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wes  
View profile   Translate to Translated (View Original)
 More options 3 Nov, 15:54
Newsgroups: comp.sys.hp48
From: Wes <wjltemp...@yahoo.com>
Date: Tue, 3 Nov 2009 07:54:21 -0800 (PST)
Local: Tues 3 Nov 2009 15:54
Subject: Re: MC: The Coach's Nightmare
On Nov 3, 1:08 am, Joe Horn <joeh...@holyjoe.net> wrote:

> > If System RPL is allowed, this mini-
> > challenge can be solved in SIX BYTES!

> Oops, not true.  The flash pointer that I had in mind doesn't add the
> 1 at the end, thus violating the rule that the first day number can't
> be zero.  Sorry.  The flash pointer is ^QAddMod, which is essentially
> << UNROT + SWAP MOD >>.  Input: team, team, size of league (all as
> integers!); output: game day or bye day (base zero).

> -Joe-

Almost as small using reals

::
  %+SWAP
  %MOD
  %1+
;

-wes


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google