Skip to main content
added 73 characters in body
Source Link
2501
  • 738
  • 3
  • 6

C, 889 874 bytes

char*s="The other day,\0I met a bear,\0A great big bear,\0Oh way out there.\0He looked at me,\0I looked at him,\0He sized up me,\0I sized up him.\0He said to me,\0\"Why don't you run?\0I see you ain't,\0Got any gun.\"\0I says to him,\0\"That's a good idea.\"\0\"Now legs get going,\0get me out of here!\"\0And so I ran,\0Away from there,\0But right behind me,\0Was that bear.\0In front of me,\0There was a tree,\0A great big tree,\0Oh glory be!\0The lowest branch,\0Was ten feet up,\0So I thought I'd jump,\0And trust my luck.\0And so I jumped,\0Into the air,\0But I missed that branch,\0A way up there.\0Now don't you fret,\0And don't you frown,\0I Caught that branch,\0On the way back down!\0This is the end,\0There aint no more,\0Unless I see,\0That bear once more.\0",*p,*w;i;f(){for(w=p=s;*p;++i%4||puts(""),p=(i+4)%8?p+=strlen(p)+1:w,w=i%8?w:p)i%8>3||puts(p),puts(p);}

Compile with enabled signed integers wrap-around(-fwrapv).

This is needed because function answers must produce repeated output on subsequent calls, and the function could conceivably be called repeatedly until global variable i isn't resetoverflows. Since the code only cares about the whether the remainder of division i by 4 and 8 is 0, it doesn't matter what the actual value of i is as long as it is left divisible by 48 after the function returns (and of course it is left divisible by 8).

See it work here.

C, 889 874 bytes

char*s="The other day,\0I met a bear,\0A great big bear,\0Oh way out there.\0He looked at me,\0I looked at him,\0He sized up me,\0I sized up him.\0He said to me,\0\"Why don't you run?\0I see you ain't,\0Got any gun.\"\0I says to him,\0\"That's a good idea.\"\0\"Now legs get going,\0get me out of here!\"\0And so I ran,\0Away from there,\0But right behind me,\0Was that bear.\0In front of me,\0There was a tree,\0A great big tree,\0Oh glory be!\0The lowest branch,\0Was ten feet up,\0So I thought I'd jump,\0And trust my luck.\0And so I jumped,\0Into the air,\0But I missed that branch,\0A way up there.\0Now don't you fret,\0And don't you frown,\0I Caught that branch,\0On the way back down!\0This is the end,\0There aint no more,\0Unless I see,\0That bear once more.\0",*p,*w;i;f(){for(w=p=s;*p;++i%4||puts(""),p=(i+4)%8?p+=strlen(p)+1:w,w=i%8?w:p)i%8>3||puts(p),puts(p);}

Compile with enabled signed integers wrap-around(-fwrapv).

This is needed because function answers must produce repeated output on subsequent calls, and the global variable i isn't reset. Since the code only cares about the remainder of division i by 4, it doesn't matter what the actual value of i is as long as it is left divisible by 4 after the function returns (and of course it is).

See it work here.

C, 889 874 bytes

char*s="The other day,\0I met a bear,\0A great big bear,\0Oh way out there.\0He looked at me,\0I looked at him,\0He sized up me,\0I sized up him.\0He said to me,\0\"Why don't you run?\0I see you ain't,\0Got any gun.\"\0I says to him,\0\"That's a good idea.\"\0\"Now legs get going,\0get me out of here!\"\0And so I ran,\0Away from there,\0But right behind me,\0Was that bear.\0In front of me,\0There was a tree,\0A great big tree,\0Oh glory be!\0The lowest branch,\0Was ten feet up,\0So I thought I'd jump,\0And trust my luck.\0And so I jumped,\0Into the air,\0But I missed that branch,\0A way up there.\0Now don't you fret,\0And don't you frown,\0I Caught that branch,\0On the way back down!\0This is the end,\0There aint no more,\0Unless I see,\0That bear once more.\0",*p,*w;i;f(){for(w=p=s;*p;++i%4||puts(""),p=(i+4)%8?p+=strlen(p)+1:w,w=i%8?w:p)i%8>3||puts(p),puts(p);}

Compile with enabled signed integers wrap-around(-fwrapv).

This is needed because function answers must produce repeated output on subsequent calls, and the function could conceivably be called repeatedly until global variable i overflows. Since the code only cares about the whether the remainder of division i by 4 and 8 is 0, it doesn't matter what the actual value of i is as long as it is left divisible by 8 after the function returns (and of course it is left divisible by 8).

See it work here.

added 324 characters in body
Source Link
2501
  • 738
  • 3
  • 6

C, 889889 874 bytes

char*d[]={"That bear once more.","Unlesschar*s="The Iother see,"day,"There\0I aintmet noa more,"bear,"This\0A isgreat thebig end,"bear,"On the\0Oh way backout down!","Ithere.\0He Caughtlooked thatat branch,"me,"And\0I don'tlooked youat frown,"him,"Now\0He don'tsized youup fret,"me,"A\0I waysized up therehim.","But I\0He missedsaid thatto branch,"me,"Into\0\"Why thedon't air,","Andyou sorun?\0I Isee jumped,","Andyou trustain't,\0Got myany luckgun.","So I\"\0I thoughtsays I'dto jump,"him,"Was\0\"That's tena feetgood up,","Theidea.\"\0\"Now lowestlegs branch,"get going,"Oh\0get gloryme beout of here!","A\"\0And greatso bigI tree,"ran,"There was\0Away afrom tree,"there,"In\0But frontright ofbehind me,","Was\0Was that bear.","But\0In rightfront behindof me,","Away\0There fromwas there,"a tree,"And\0A sogreat Ibig ran,"tree,"get me out\0Oh ofglory herebe!\"","\"Now legs\0The getlowest going,"branch,"\"That's\0Was aten goodfeet idea.\""up,"I\0So saysI tothought him,"I'd jump,"Got\0And anytrust gunmy luck.\"","I\0And seeso youI ain't,"jumped,"\"Why don't\0Into youthe run?"air,"He\0But saidI tomissed me,"that branch,"I\0A sizedway up himthere.","He\0Now sizeddon't upyou me,"fret,"I\0And lookeddon't atyou him,"frown,"He\0I lookedCaught atthat me,"branch,"Oh\0On the way outback there.","Adown!\0This greatis bigthe bear,"end,"I\0There metaint ano bearmore,"\0Unless I see,"The\0That otherbear dayonce more.\0","*p,};t;i;f*w;i;f(){for(i=80;i--;i%4||putsw=p=s;*p;++i%4||puts(""),p=(i+4)puts%8?p+=strlen(d[t=i/8*4+i%4]p)+1:w,i%8<4||putsw=i%8?w:p)i%8>3||puts(d[t]p),puts(p);}

Compile with enabled signed integers wrap-around(-fwrapv).

This is needed because function answers must produce repeated output on subsequent calls, and the global variable i isn't reset. Since the code only cares about the remainder of division i by 4, it doesn't matter what the actual value of i is as long as it is left divisible by 4 after the function returns (and of course it is).

See it work herework here.

C, 889 bytes

char*d[]={"That bear once more.","Unless I see,","There aint no more,","This is the end,","On the way back down!","I Caught that branch,","And don't you frown,","Now don't you fret,","A way up there.","But I missed that branch,","Into the air,","And so I jumped,","And trust my luck.","So I thought I'd jump,","Was ten feet up,","The lowest branch,","Oh glory be!","A great big tree,","There was a tree,","In front of me,","Was that bear.","But right behind me,","Away from there,","And so I ran,","get me out of here!\"","\"Now legs get going,","\"That's a good idea.\"","I says to him,","Got any gun.\"","I see you ain't,","\"Why don't you run?","He said to me,","I sized up him.","He sized up me,","I looked at him,","He looked at me,","Oh way out there.","A great big bear,","I met a bear,","The other day,",};t;i;f(){for(i=80;i--;i%4||puts(""))puts(d[t=i/8*4+i%4]),i%8<4||puts(d[t]);}

See it work here.

C, 889 874 bytes

char*s="The other day,\0I met a bear,\0A great big bear,\0Oh way out there.\0He looked at me,\0I looked at him,\0He sized up me,\0I sized up him.\0He said to me,\0\"Why don't you run?\0I see you ain't,\0Got any gun.\"\0I says to him,\0\"That's a good idea.\"\0\"Now legs get going,\0get me out of here!\"\0And so I ran,\0Away from there,\0But right behind me,\0Was that bear.\0In front of me,\0There was a tree,\0A great big tree,\0Oh glory be!\0The lowest branch,\0Was ten feet up,\0So I thought I'd jump,\0And trust my luck.\0And so I jumped,\0Into the air,\0But I missed that branch,\0A way up there.\0Now don't you fret,\0And don't you frown,\0I Caught that branch,\0On the way back down!\0This is the end,\0There aint no more,\0Unless I see,\0That bear once more.\0",*p,*w;i;f(){for(w=p=s;*p;++i%4||puts(""),p=(i+4)%8?p+=strlen(p)+1:w,w=i%8?w:p)i%8>3||puts(p),puts(p);}

Compile with enabled signed integers wrap-around(-fwrapv).

This is needed because function answers must produce repeated output on subsequent calls, and the global variable i isn't reset. Since the code only cares about the remainder of division i by 4, it doesn't matter what the actual value of i is as long as it is left divisible by 4 after the function returns (and of course it is).

See it work here.

Source Link
2501
  • 738
  • 3
  • 6

C, 889 bytes

char*d[]={"That bear once more.","Unless I see,","There aint no more,","This is the end,","On the way back down!","I Caught that branch,","And don't you frown,","Now don't you fret,","A way up there.","But I missed that branch,","Into the air,","And so I jumped,","And trust my luck.","So I thought I'd jump,","Was ten feet up,","The lowest branch,","Oh glory be!","A great big tree,","There was a tree,","In front of me,","Was that bear.","But right behind me,","Away from there,","And so I ran,","get me out of here!\"","\"Now legs get going,","\"That's a good idea.\"","I says to him,","Got any gun.\"","I see you ain't,","\"Why don't you run?","He said to me,","I sized up him.","He sized up me,","I looked at him,","He looked at me,","Oh way out there.","A great big bear,","I met a bear,","The other day,",};t;i;f(){for(i=80;i--;i%4||puts(""))puts(d[t=i/8*4+i%4]),i%8<4||puts(d[t]);}

See it work here.