Thanksgiving Feast

27

Tomorrow, November 23rd, is Thanksgiving Day in the United States. To prepare, you need to cook up some ASCII turkeys. However, since you're late in planning, you need a program (or function) to help you with how many birds you need to prepare.

      .---.   _
    .'     './ )
   /   _   _/ /\
 =(_____) (__/_/==
===================

The turkeys you found are rather on the small side, so you've figured out the following ratios -- one turkey will feed:

  • four people who only like white meat and three people who only like dark meat
  • or seven people who don't care either way
  • or a combination thereof.

Meaning, there are a total of 4 servings of white meat and 3 servings of dark meat in any given turkey. Further, you can't purchase and cook a partial turkey.

For example, for 3 people who only like white meat, 6 people who only like dark meat, and 3 people who don't care, you'll need two turkeys. That gives 8 servings of white and 6 servings of dark, which is enough to satisfy everyone and have some leftover white meat:

      .---.   _         .---.   _
    .'     './ )      .'     './ )
   /   _   _/ /\     /   _   _/ /\
 =(_____) (__/_/== =(_____) (__/_/==
=====================================

For 20 people who don't care, you'll need three turkeys, and have either a little bit of white or dark leftover:

      .---.   _         .---.   _         .---.   _
    .'     './ )      .'     './ )      .'     './ )
   /   _   _/ /\     /   _   _/ /\     /   _   _/ /\
 =(_____) (__/_/== =(_____) (__/_/== =(_____) (__/_/==
=======================================================

And so on.

Rules

  • The three inputs can be in any order you choose, and in any convenient format. Please indicate in your answer how the input is taken.
  • There will never be a requirement for more than 25 turkeys (so a maximum of 175 people to feed).
  • Leading/trailing newlines or other whitespace are optional, provided that the characters line up appropriately.
  • Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
  • Output can be to the console, returned as a list of strings, returned as a single string, etc.
  • Standard loopholes are forbidden.
  • This is so all usual golfing rules apply, and the shortest code (in bytes) wins.

AdmBorkBork

Posted 2017-11-22T16:50:51.767

Reputation: 41 581

your ratios don't quite make sense to me - you seem to imply that the 7 people who don't care only get the leftovers, but seem to write that a turkey can feed 3+4+7 = 14 people (or that one turkey might only be enough to feed 3 dark meat eaters). – dzaima – 2017-11-22T17:28:11.297

@dzaima From the examples, it seems that one turkey has 4 servings of white meat and 3 of dark. So it serves (4 people who only like white meat AND 3 people who only like dark meat) OR 7 people with no preference. – KSmarts – 2017-11-22T17:34:54.117

@KSmarts that's what I'm saying in my comment too, but the text doesn't say that well – dzaima – 2017-11-22T17:36:20.213

@dzaima KSmarts has it correct. There are 4 servings of white and 3 of dark in any given turkey. I'll make that a bit more clear. – AdmBorkBork – 2017-11-22T17:37:41.487

Are all 25 turkeys to be printed in one huge horizontal line? – Neil – 2017-11-22T17:54:23.253

1How should the turkeys be put next to each other? It seems as that none of the current answers have that overlap that the examples do – dzaima – 2017-11-22T18:19:18.653

@dzaima I guess I didn't explicitly specify, so as long as they're turkeys all in a row, that's fine. – AdmBorkBork – 2017-11-22T18:50:07.557

@Neil Yes, all one row of turkeys (you have a big table). – AdmBorkBork – 2017-11-22T18:50:22.670

4Do we get a bounty for a solution in Chicken? – Uriel – 2017-11-22T23:11:08.273

Answers

22

Befunge-93, 231 224 bytes

p&:10p3+4/:&:20p2+3/\-:v
v<0-1:+*`0:-\/7+++&g02<0
>"   _   .---.      "vg`
>"  ) /.'     '.    "v0*
>"  \/ /_   _   /   "v1+
>"==/_/__( )_____(= "v6:
v^0-1 _$"v"000g1+:>v v^<
:#,_$:^1,+55:p+1p00< >>>
_$$99+*"=":>,#:\:#->#1_@

Try it online!

The three values are read from stdin in the order: white meat, dark meat, don't care.

James Holderness

Posted 2017-11-22T16:50:51.767

Reputation: 8 298

17I know I'm not supposed to upvote a code golf challenge for artistically laid out code but... This just happens to look like a freakin turkey in the oven, so +1! – Level River St – 2017-11-23T00:53:16.687

1I look at the question and think "There's no way golfed code can do this easily", and then I saw a friggin turkey in the oven getting cooked and solving the problem. – MechMK1 – 2017-11-23T10:28:12.993

6

APL (Dyalog), 120 118 104 bytes

14 bytes saved thanks to @Adám

{,/(⌈⌈/4 3 7÷⍨⍵,⍺++/⍵)/⊂'='⍪⍨' .-_''/)\=('[4 19⍴10 10⊤¯35+⎕UCS'###(##-:77-&(#F*####+,&0N&&)#,N0Z&d++#']}

Try it online!

The picky white and dark are on the right, the non picky on the left.

Too bad most of the byte count is taken by the string currently.

How?

⍵,⍺++/⍵ - creates array of whity, darky and sum of them all plus non pickys

4 3 7÷⍨ - divide by how many of them gets their wishes from one chicken

⌈/ - take the highest estimate of the three - so if we have extremely high amount of dark meat seekers, they won't be left aside

- ceiling, in case only a half-chicken is in demand

Then we create a string, enclose it with , then repeat the eclosed matrix the calculated chickens times with /, and finally concatenate all chickens with ,/.

Uriel

Posted 2017-11-22T16:50:51.767

Reputation: 11 708

4+1 for calling the turkeys chickens. Because that's what they are, glorified chickens. Still delicious though. – J. Sallé – 2017-11-22T18:10:11.420

2

@J.Sallé Nobody calls me chicken

– manassehkatz-Moving 2 Codidact – 2017-11-22T18:14:11.293

'='⍪⍨' .-_''/)\=('[4 19⍴10 10⊤¯35+⎕UCS'###(##-:77-&(#F*####+,&0N&&)#,N0Z&d++#'] with ⎕IO←0. – Adám – 2017-11-23T00:29:37.957

4

Python 2, 142 bytes

lambda w,d,n:[min(e)+-min(-w/3,-d/4,-(w+d+n)/7)*e.center(18)for e in"  .---.   _"," .'     './ )","/   _   _/ /\\","=(_____) (__/_/==","="*18]

Try it online!

-16 bytes thanks to Lynn
-4 bytes thanks to Mr. Xcoder

and back to a lambda xD

HyperNeutrino

Posted 2017-11-22T16:50:51.767

Reputation: 26 575

3

Python 2, 197 189 174 bytes

thanks to Erik the Outgolfer for -12 bytes
thanks to Jonathan Frech for -1 byte

a,b,c=input()
for i in range(5):print'='[i<4:]+(' '+"   =   (  /_ . _ ' _.  _- __-  )-   .  ( '__ ./_ / /_ /_ )\\/   =   ="[i::4],'='*18)[i>3]*max((6+c+a+b)/7,a+3>>2,(b+2)/3)

Try it online!

ovs

Posted 2017-11-22T16:50:51.767

Reputation: 21 408

3

SOGL V0.12, 65 bytes

N∫4*κ:F3*.-:h+.-¹χ∆>?F"Ωeχ&i[A⁄╔■§‼╗╝│¼ο≠≈⁹,Ρ⁴žγūž℮3zl3βΜ%G‘'³n*←

Try it Here!

Order of inputs is white, dark, and then either.

dzaima

Posted 2017-11-22T16:50:51.767

Reputation: 19 048

2

Kotlin, 207 198 bytes

thanks to Taylor Scott for -7 bytes

{a,b,c->val n=maxOf((a+3)/4,(b+2)/3,(6+c+a+b)/7);arrayOf("      .---.   _   ","    .'     './ )  ","   /   _   _/ /\\  "," =(_____) (__/_/==").map{println(it.repeat(n))};println("=".repeat(n*18+1))}

This does not work on TIO yet, as it requires Kotlin 1.1

Try it online!

ovs

Posted 2017-11-22T16:50:51.767

Reputation: 21 408

2

Excel VBA, 222 219 211 198 Bytes

Anonymous VBE immediate window function that takes input from range [A1:C1] with order of white meat, dark meat, and indifferent in that order and outputs to the range [D1].

[D1]=[Int(Max((A1+3)/4,(B1+2)/5,Sum(1:1,6)/7))]:For Each s In Split("      .---.   _   1    .'     './ )  1   /   _   _/ /\  1 =(_____) (__/_/==1",1):[E1]=s:?[Rept(E1,D1)]:Next:?[Rept("=",18*D1+1)]

Initially the solution finds the correct number of turkeys and then it repeats the turkey pattern that many times. Ideally this would then be directly outputted onto the VBE immediate window as shown by the function below

[D1]=[Int(Max((A1+3)/4,(B1+2)/5,Sum(1:1,6)/7))]:For Each s In Split("      .---.   _   1    .'     './ )  1   /   _   _/ /\  1 =(_____) (__/_/==1",1):[E1]=s:?[Rept(E1,D1)]:Next:?[Rept("=",18*D1+1)]

This version does initially produce the correct response, however, it is immediately autoformatted by the compiler, as _ is the line continutation character, and is thus moved to have only one (space) character to its left, breaking the pattern.

Example shown below for clarity

[A1:C1]=Array(0,0,20):[D1].Clear
[D1]=[Int(Max((A1+3)/4,(B1+2)/5,Sum(1:1,6)/7))]:For Each s In Split("      .---.   _   1    .'     './ )  1   /   _   _/ /\  1 =(_____) (__/_/==1",1):[E1]=s:?[Rept(E1,D1)]:Next:?[Rept("=",18*D1+1)]

'' Note that the `_` to the right has moved     V
      .---.   _         .---.   _         .---. _
    .'     './ )      .'     './ )      .'     './ )  
   /   _   _/ /\     /   _   _/ /\     /   _   _/ /\  
 =(_____) (__/_/== =(_____) (__/_/== =(_____) (__/_/==
=======================================================

To correct this the last space character (, char 32) before the _ in line one of the output is replaced with a non-breaking space ( , char 160, Alt + 255)

      .---.   _         .---.   _         .---.   _   
    .'     './ )      .'     './ )      .'     './ )  
   /   _   _/ /\     /   _   _/ /\     /   _   _/ /\  
 =(_____) (__/_/== =(_____) (__/_/== =(_____) (__/_/==
=======================================================

-3 bytes for use of 1 delimited split statement

-8 bytes for use moving ='s into the split and using string addition over concatenation

-13 bytes for use of a non-breaking space to prevent autoformatting of the output

Taylor Scott

Posted 2017-11-22T16:50:51.767

Reputation: 6 709

2

Charcoal, 76 bytes

”{‴∨➙×95;{;C.ÞgF⁷J*←λ|⁸KK][§X⎚¦»Z◧↘gⅉ✳⟧F⎇≧h”×=¹⁹NθNηF⊖⌈⌈⟦∕θ³∕η⁴∕⁺⁺θηN⁷⟧C¹⁸¦⁰

Try it online! Link is to verbose version of code. Explanation:

”{‴∨➙×95;{;C.ÞgF⁷J*←λ|⁸KK][§X⎚¦»Z◧↘gⅉ✳⟧F⎇≧h”

Print a 1-space-indented turkey.

×=¹⁹

Print the table.

NθNη

Input the number of dark and white meat eaters.

F⊖⌈⌈⟦∕θ³∕η⁴∕⁺⁺θηN⁷⟧

Repeat one less than the ceiling of the maximum of a) one third of the number of dark meat eaters b) one quarter of the number of white meat eaters c) one seventh of the number of diners.

C¹⁸¦⁰

Make a copy of the turkey.

Neil

Posted 2017-11-22T16:50:51.767

Reputation: 95 035

1

JavaScript (ES6), 180 179 bytes

Outputs an array of strings.

(a,b,c)=>[...`      .---.   _   
    .'     './ )  
   /   _   _/ /\\  
 =(_____) (__/_/==`.split`
`.map(l=>l.repeat(n=Math.max((6+c+a+b)/7,a+3>>4,(b+2)/3)|0)),'='.repeat(18*n+1)]

f=

(a,b,c)=>[...`      .---.   _   
    .'     './ )  
   /   _   _/ /\\  
  =(_____) (__/_/==`.split`
`.map(l=>l.repeat(n=Math.max((6+c+a+b)/7,a+3>>4,(b+2)/3)|0)),'='.repeat(18*n+1)]

console.log(f(3, 2, 3))
console.log(f(0, 0, 20))


JavaScript (ES6), 182 181 bytes

Outputs a single string.

(a,b,c)=>`      .---.   _   
    .'     './ )  
   /   _   _/ /\\  
 =(_____) (__/_/==
${'='.repeat(18)}`.split`
`.map(l=>l.repeat(Math.max((6+c+a+b)/7,a+3>>4,(b+2)/3))).join`
`+'='

f=

(a,b,c)=>`      .---.   _   
    .'     './ )  
   /   _   _/ /\\  
 =(_____) (__/_/==
${'='.repeat(18)}`.split`
`.map(l=>l.repeat(Math.max((6+c+a+b)/7,a+3>>4,(b+2)/3))).join`
`+'='

console.log(f(3, 2, 3))
console.log(f(0, 0, 20))

-1 byte (Arnauld): a+3>>4 instead of (a+3)/4)

darrylyeo

Posted 2017-11-22T16:50:51.767

Reputation: 6 214