私を月餅にしよう!


31

中秋節は始まりました!

残念ながら、私の月餅はすべて盗まれました-私のような小さな人々にとっては高価すぎて、今年は食べることができないのではないかと心配しています!

だから私はあなたに助けを求める。いくつか作っていただけますか?

知らない人のために、月餅がどのようなものかを教えてください。


月餅にはさまざまなサイズがあります!
だから私はあなたに私与えるつもりだ入力をnは私は1つをするとき、。

ここに私が欲しい出力の例を示します

サイズn = 3の月餅

    (@@@@@)  
    (@MAF@) 
    (@@@@@) 

サイズn = 6の月餅:

    (@@@@@@@@@@@) 
    (@         @)
    (@    M    @) 
    (@    F    @)
    (@         @)
    (@@@@@@@@@@@) 

つまり、サイズnの月餅は次のとおりです。

  • n行の高さ
  • 2n-1 @sの長さ
  • 2n + 1文字の長さ(@sおよび角括弧)

そして、あなたは私にあなたのあまりにも小さな練習月餅を投げない方が良いです!
入力は常にn> = 3であると仮定します

月餅には、次の装飾のいずれかが含まれています

  • MF
  • MAF
  • HMF
  • JCJ
  • TTT
  • ZJ
  • LF
  • RF
  • CF

どちらでも構いません- 垂直方向と水平方向の中央にある限り。
縦にも横にも書くことができます!

バラエティが欲しい!
あなたが本当に私に同じ月餅の2つを作るつもりなら、装飾は異なる方が良いです!

つまり、まったく同じ入力でプログラムを複数回実行しても、常に同じ装飾が得られるとは限りません

私はあなたの月餅を食べるのを待つことができないので、私はそれらをより早く受け取ることができます(あなたのコードが短くなるほど)!

がんばろう!


装飾について疑問に思う人のために:
それらは中秋節のすべての代替名のイニシャルです。
リストは、この投稿の上部にリンクされているウィキペディアのページにあります。


明確化:

先頭および末尾の空白に関する規則はありません
好きなだけ持ってください!

装飾は、月餅の真ん中になければなりません!
水平の装飾では、これはケーキの中央の行になければならず、装飾文字列の左右の文字数は等しくなければなりません。
これは、縦型の装飾では、ケーキの中央の列に配置する必要があり、装飾の上下の文字数が等しくなければならないことを意味します。

すべての装飾を使用する必要はありません!
唯一の要件は、任意の入力 nに対して複数の可能性がなければならないことです。可能性も均等である必要はありません。

機能は許容されます。


2
こんにちは、PPCGへようこそ!これは素晴らしい最初の投稿のようです。通常、提案された課題にサンドボックスを使用することをお勧めします。ここに投稿する前に、他の人からフィードバックを得て、考えもしなかったかもしれないことで課題を完成させることができます。そうは言っても、あなたの挑戦はよく考えられているように見えます。私から+1。あなたの最初の例に関する1つの質問ですが、なぜ読んMAFでいないのMFですか?Aデコレーションオプションにが表示されません。
ケビンCruijssen 16

1
Thanks! Sorry, I wasn't aware of the sandbox. Am I able to leave just this one up anyway? About the decoration - that was a mistake. I added MAF to the allowed decorations. Feedback very much appreciated!
Moon Rabbit

1
There are no rules regarding leading and trailing spaces. Up to you!
Moon Rabbit

3
Hey, I need to manually type all this into my mooncake machine to get the actual mooncakes!
Moon Rabbit

4
... in which case it's good that none of those contrived languages with non-ASCII character sets have reared their head, because they are a pain to type :)
GreenAsJade

回答:


9

Pyth, 71 65 59 58 bytes

Saved 1 byte thanks to @StevenH.

jjRc"(@@)"2++J*KtytQ\@m.[Kd;.[ttQ@,,O"MC"\F]Oc"MAFHMF"3QkJ

Try it online. Test suite.

So much padding.


2
It's nuts how different this answer is from the one below it in the same language...
Magic Octopus Urn

You can save one byte by replacing ?%Q2 with @, (reverse the order of the two choices)...Q. I (ab)used that a lot in golfing my own Pyth answer down.
Steven H.

@StevenH. Thanks, I always forget about modular indexing.
PurkkaKoodari

7

JavaScript ES6, 206 196 192 188 187 180 176 169 165 156 bytes

g=(n,r=new Date%2,a=(s,x,b=' @'[+!s].repeat(n-3+!x))=>`(@${b+(s||'@')+b}@)
`,l=a` `.repeat(n/2-2+n%2))=>a()+l+(n%2?a(r?'MAF':'HMF',1):a('RC'[r])+a`F`)+l+a()

Breakdown

r=new Date%2                           // Sometimes 0, sometimes 1

// Function to create lines of the cake of the form `(@@@@@@@@@)` or `(@  ${s}  @)`
a=(s,x,b=' @'[+!s].repeat(n-3+!x))=>`(@${b+(s||'@')+b}@)
`

// Cake parts
a()                                    // Top of the cake.
l=a` `.repeat(n/2-2+n%2)               // Undecorated inner part.
a(r?'MAF':'HMF',1)                     // Decoration for uneven sized cakes.
a('RC'[r])+a`F`                        // Decoration for even sized cakes.
l                                      // Undecorated inner part.
a()                                    // Bottom part.

My first attempt at code-golf. This can probably be golfed more.

saved 4 bytes thanks to @ETHProductions

Edit I took the liberty of using Date.now()%2 new Date%2 to satisfy:

multiple executions of your program with the exact same input must not always yield the same decoration

this allows me to save another 7 bytes over +Math.random()>.5

saved another 4 bytes thanks to @Arnauld


Welcome to PPCG, and great first answer! I believe ['MA','HA'][r]+'F' can be golfed to 'MH'[r]+'AF'.
ETHproductions

1
You can save two bytes by replacing [' R ',' C '][r] with " ${'RC'[r]} ", replacing each " with a backtick.
ETHproductions

1
And ['MA','HM'][r]+'F' is actually two bytes longer than ['MAF','HMF'][r] ;)
ETHproductions

2
You can use ' @'[+!s] instead of (s?' ':'@')
Arnauld

2
Also, you can use new Date%2 instead of Date.now()%2.
Arnauld

6

Pyth, 99 79 71 68 64 bytes

Pyth is very bad all right at making strings. Or maybe I'm just bad getting better at golfing them.

jmj.[-yQ3@,k@,@,O"MC"\FgydQOc"MAFHMF"3Q>2ahydQ@" @"sIcdtQc2"(@@)

Can create the decorations MAF and HMF horizontally, and the decorations MF and CF vertically.

Try it online!


2
Ahh, good to see some character development in this story.
Moon Rabbit

6

Vim, 118 bytes

Takes input as a buffer (e.g. a file with the number n as its contents).

"aDi()<Esc>@ai@<Esc>.xY@apddll<C-v>G$k3hr @=@a/2-1
j@=@a-2-@a%2
l:let r=abs(reltime()[1])%2
@=@a%2?r?"RJCJ":"3rT":"rFkr"."ML"[r]
<Esc>

Here it is with the unprintable control characters in xxd format:

0000000: 2261 4469 2829 1b40 6169 401b 2e78 5940  "aDi().@ai@..xY@
0000010: 6170 6464 6c6c 1647 246b 3368 7220 403d  apddll.G$k3hr @=
0000020: 4061 2f32 2d31 0a6a 403d 4061 2d32 2d40  @a/2-1.j@=@a-2-@
0000030: 6125 320a 6c3a 6c65 7420 723d 6162 7328  a%2.l:let r=abs(
0000040: 7265 6c74 696d 6528 295b 315d 2925 320a  reltime()[1])%2.
0000050: 403d 4061 2532 3f72 3f22 524a 434a 223a  @=@a%2?r?"RJCJ":
0000060: 2233 7254 223a 2272 466b 7222 2e22 4d4c  "3rT":"rFkr"."ML
0000070: 225b 725d 0a1b                           "[r]..

Try it online! (As it turns out, the V interpreter works fine for normal Vim code, too.)

Explanation

"aD                   " Delete the number and store it in @a
i()<Esc>              " Insert empty parentheses
@ai@<Esc>.x           " Insert @a '@' characters between the parentheses twice; delete 1
Y@apdd                " Copy the line and paste it @a times; delete 1
ll<C-v>G$k3hr<Space>  " Replace the inner area with spaces
@=@a/2-1<CR>j         " Go down @a/2-1 lines
@=@a-2-@a%2<CR>l      " Go right @a-2-@a%2 columns
:let r=reltime()[1]%2<CR>  " Get a random 1 or 0 based on the time (this may be OS-dependent)
@=@a%2?
   r?"RJCJ":"3rT"     " For odd @a, replace the next 3 characters with "JCJ" or "TTT"
  :"rFkr"."ML"[r]     " For even @a, replace this character with "F" and the above with "M" or "L"
<CR><Esc>

Wow, nice! I think this is the first non-deterministic vim answer I've seen! A couple thoughts: 1) When you put the input in "arguments" rather than "input", it predefines @a to arg1, @b to arg2, etc. but this is a V specific feature. This doesn't technically matter since you have "aD at the beginning, but I just thought I'd point it out. 2) You could take one byte off if you did dd@ap instead of Y@apdd
DJMcMayhem

@DJMcMayhem dd@ap doesn't quite work alas.
Jordan

dd@aP works, but then requires an additional j and an additional k down the line.
Jordan

5

PHP, 342 292 249 185 178 176 bytes

for(;$i<$n=$argv[1];)$o.=str_pad("(@",2*$n-1," @"[$i++%($n-1)<1])."@)
";$p=F.[M,AM,R,MH][rand()&2|$d=$n&1];$f=$n*($n+$d)-2;for($i=2+$d;$i--;$f+=$d?:2*$n+2)$o[$f]=$p[$i];echo$o;

Call with php -r '<code>' <size>

history

Rev 1: initial version; all sizes (including tiny cakes), all decorations, all possible directions

Rev. 2: removed tiny cakes (-36 bytes), restructured decoration options, removed one decoration item (-21) and a single byte golf (-1).

Rev. 3: Down to four decorations; (-17), only horizontal for odd sizes (-18) plus minor golfing (-8).

Rev. 4: Thanks to Jörg for golfing down the "paint cake" part; he took off an amazing (-31).
Another -6 with my additional golfing, and -27 for using a single string instead of an array of strings.

Rev. 5: -7 bytes mostly thanks to Christallkeks

breakdown

This is getting slimmer by the hour. :)

// paint cake
for(;$i<$n=$argv[1];)$o.=str_pad("(@",2*$n-1," @"[$i++%($n-1)<1])."@)\n";

// add deco
$p=F.[M,AM,R,MH][rand()&2|$d=$n&1];
$f=$n*($n+$d)-2;
for($i=2+$d;$i--;$f+=$d?:2*$n+2)$o[$f]=$p[$i];

// output
echo$o;

1
for($i=0;$i<$n=$argv[1];$i++){$o[]=str_pad("(@",2*$n-1,!$i|$i==$n-1?"@":" ")."@)";}
Jörg Hülsermann

@JörgHülsermann: Lots of thanks. I had to take a similar expression for !$i|$‌​i==$n-1?"@":" "; the ternary would just not accept yours (on my machine), although it is correct.
Titus


1
This saves you six bytes on the cake paint: for(;$i<$n=$argv[1];)$o.=str_pad("(@",2*$n-1," @"[$i++%($n-1)==0])."@)\n"; Also, it looks like you got "MAD" golfing your decos ;-)
Christallkeks

4

Java 7, 399 349 bytes

Updated version with help from @Dodge and @Kevin Cruijssen:

void m(int n){int i=2,r=n%2,x=2*n,u=r+2,y=r*4+(int)(Math.random()*2)*u,z=y+u;String t="MFZJMAFHMF".substring(y,z);char[][]c=new char[n][x+1];while(i<x-1)c[0][i]=c[n-1][i++]=64;for(i=0;i<u;)c[(n-1)/2+(1-r)*i][r*(i-1)+n]=t.charAt(i++);for(i=0;i<n;){c[i][0]=40;c[i][1]=c[i][x-1]=64;c[i][x]=41;System.out.println(new String(c[i++]).replace('\0',' '));}}

void m(int n){String[]s={"MF","MAF","ZJ","HMF","LF","JCJ","RF","TTT","CF","MAF"};char[]d=s[((int)(Math.random()*5))*2+(n%2)].toCharArray(),c[]=new char[n][2*n+1];int i=2;while(i<2*n-1)c[0][i]=c[n-1][i++]='@';i=0;while(i<d.length)c[(n-1)/2+(1-(n%2))*i][(n%2)*(-1+i)+n]=d[i++];i=0;while(i<n){c[i][0]='(';c[i][1]=c[i][2*n-1]='@';c[i][2*n]=')';System.out.println(new String(c[i++]).replace('\0',' '));}}

Try it here!

The new version is much more optimized and got rid of the String array handling. Also as suggested, there are only 4 decorations now: 2 for even inputs (MF,ZJ) and 2 for odd inputs (MAF,HMF) which are combined into a single String.

Ungolfed:

void m(int n){
    int i=2,
    r=n%2,
    x=2*n,
    u=r+2, // length of the decoration string
    y=r*4+(int)(Math.random()*2)*u, // random starting index of string (0, 2, 4, 7)
    z=y+u; // exclusive end index of string (2, 4, 7, 10)
    String t="MFZJMAFHMF".substring(y,z);
    char[][]c=new char[n][x+1];
    while(i < x-1) {
        c[0][i]=c[n-1][i++]=64; // '@'
    }
    for(i=0; i<u;) {
        c[(n-1)/2+(1-r)*i][r*(i-1)+n]=t.charAt(i++); // Depending on even/odd, fills the center column/row respectively with the decoration
    }
    for(i=0; i<n;) {
        c[i][0]=40; // '('
        c[i][1]=c[i][x-1]=64; // '@'
        c[i][x]=41; // ')'
        System.out.println(new String(c[i++]).replace('\0',' ')); // Print all
    }
}

Thanks for the submission! Let me clarify, as a few users have missed it - not all decorations must be included. I have gone ahead and bolded this in the 'clarifications' section. Hopefully that will save you a few bytes! I believe you would still be able to use the same method to select decorations.
Moon Rabbit

4
Haha, as far as Java golfing goes, he might as well include all of the decorations ;). +1, always, for anyone with the balls to whip out the Java-putter.
Magic Octopus Urn

Why is "MAF" repeated?
Cyoce

@carusocomputing Very true. Just in case, though, I thought I'd mention it. Nice!
Moon Rabbit

Thanks for your feedback :) True, Java isn't very optimal for golfing, but it's pretty fun to do it :P. Maybe I could use the loops and initialization of the decoration char[] more efficiently and golf other things further. @Cyoce I duplicated MAF because then I have all decorations for an even input at indices 0,2,4,6,8 and all decorations for an odd input at indices 1,3,5,7,9. That makes it easier to calculate the random index for a given input. Math.random()*5 gives a random number from 0-4. *2 spreads it to 0,2,4,6,8. +n%2 adds 1 for odd inputs to get 1,3,5,7,9.
QBrute

3

Batch, 386 bytes

@echo off
set/pn=
set f=HMAC
set/ao=n%%2,u=n/2,l=h=u+1,d=%random%%%2*2+1
if %o%==1 set/al=u=0,d/=2
set c=
for /l %%i in (4,1,%n%) do call set c= %%c%%
call:l %n%
for /l %%i in (2,1,%n%) do call:l %%i
exit/b
:l
set s=   
if %1==%h% call set s=%%f:~%d%,2%%F
if %1==%u% call set s= %%f:~%d%,1%% 
if %1==%l% set s= F 
set s=(@%c%%s%%c%@)
if %1==%n% set s=%s: =@%
echo %s%

Will only output HMF, MAF, MF or CF as appropriate. Note: certain lines end in white space. Variables:

  • n Input parameter (read from STDIN)
  • f Decoration prefixes (suffix F is implied)
  • o Oddness of n (only used once, but if statements don't accept expressions)
  • l Row of the upper vertical character, or 0 for a horizontal decoration
  • u Row of the lower vertical character, or 0 for a horizontal decoration
  • h Row of the horizontal decoration (gets overwritten by a vertical decoration)
  • d Index of decoration in decoration prefix (0/1 for horizontal or 1/3 for vertical)
  • c String of n-3 spaces
  • s Output string for each row
  • %1 Row number, but set to n for the first row too, so that both first and last rows use @s instead of spaces.

3

C, 233 Bytes

Should be able to golf this down a bit from here...

A="HMFMAFCF";i,j,k,t;f(n){t=time();char*S=n&1?t&1?A:A+3:t&1?A+1:A+6;for(;i<n;i++,puts(")"))for(j=0,k=2*n-1,putchar(40);j<k;putchar(0==i*j|i==n-1|j==k-1?64:n&1&i==n/2&j>n-3&j<n+1?*S++:n&1?32:(i==n/2-1|i==n/2)&j>n-2&j<n?*S++:32),j++);}

Great challenge, this was difficult and ugly to code.

Run with this main func;

main(c,v)char**v;
{
    f(atoi(v[1]));
}

2

Ruby 2.3.1, 449 265 245 233 230 characters

Seems like there should be a ruby answer, so here is a ruby answer. It's really not that clever, Hopefully someone else here will be more clever ;)

Golfed version:

def m(n)
d,s=n.odd?? [[%w{MAF HMF}.sample],n/2]:[%w{RF LF}.sample.chars,(n-2)/2]
r=->f{l=f.size;q=($i-l)/2;($c=' '*$i)[q...l+q]=f;puts "(@#$c@)"}
$i=2*n-1;a='@'*$i
r[a]
(1..n-2).map{|x|(s...s+d.size)===x ?r[d[x-s]]:r['']}
r[a]
end

Golfing tricks:

  • replace method declaration with a stabby string interpolation of
  • $globals doesn't need #{global}, only #$global
  • === for ranges is shorter than .covers?

Readable version

def row(inner_width, fillchar='')
  padding = ( inner_width - fillchar.size) / 2
  (center =(' ' * inner_width))[padding...fillchar.size+padding]=fillchar
  puts "(@"+center+"@)"
end

def mooncake(n)
  decoration = n.odd?? [%w{ MAF HMF JCJ TTT }.sample] : %w{ ZJ LF RF CF }.sample.chars
  start_row = n.odd?? (n/2) : (n - 2) / 2
  inner_width = 2 * n - 1
  row(inner_width,'@'*inner_width)
  (1...(n-1)).each do |row|
    if (start_row ... start_row + decoration.size).include? row 
      row(inner_width,decoration[row - start_row])      
    else
      row(inner_width)      
    end
  end
  row(inner_width,'@'*inner_width)
end

Testing

mooncake(3)
mooncake(4)
mooncake(5)
mooncake(6)

I reimplemented w/o using the array, seems like everyone is doing that.
Rob

1

I was bored ... here are two more versions:

PHP, 193 bytes

function p($s){global$n;return"(@".str_pad($s,2*$n-3,$s?" ":"@",2)."@)
";}$p=[M,MA,R,HM][rand()&2|1&$n=$argv[1]];echo p(""),$e=str_repeat(p(" "),($n+$n%2)/2-2),$n&1?p($p.F):p($p).p(F),$e,p("");

a port of Lmis´ answer

PHP, 191 bytes

for($p=[M,MA,R,HM][rand()&2|1&$n=$argv[1]].F;$i<$n*$w=2*$n+1;$i++)echo($x=$i%$w)?$w-1-$x?($y=$i/$w|0)%($n-1)&&1-$x&&$w-2-$x?$p[$n&1?$n>>1!=$y?9:$x-$n+1:($n-$x?9:$y-$n/2+1)]?:" ":"@":")
":"(";

printing the cake character by character in a single loop

breakdown

for(
    $p=[M,MA,R,HM][rand()&2|1&$n=$argv[1]].F;   // pick decoration
    $i<$n*$w=2*$n+1;$i++)       // loop $i from 0 to $n*width-1:
echo                                // print ...
    $w-1-($x=$i%$w)                 // 1. not last column
        ?$x                         // 2. not first column
            ?
                ($y=$i/$w|0)%($n-1) // 3. not first or last line
                && 1-$x%($w-3)      // and not second or (width-2)th column
                ?$p[$n&1
                    ?$n>>1!=$y?3:1+$x-$n
                    :($n-$x?3:1+$y-$n/2)
                ]   ?               // 4. decoration character
                    :" "            // 4. else: blank
                :"@"                // 3. else: "@"
            :"("                    // 2. else: "("
        :")\n"                      // 1. else: ")"+newline
    ;

0

Python 3, 318 301 297 285 272 bytes

Knocked off 17 bytes with the help of DJMcMayhem

Knocked off 4 bytes thanks to mbomb007

Knocked off another 12 bytes thanks to DJMcMayhem

Knocked off another 13 bytes thanks to mbomb007

My first golf ever, so it's not all that great. I used: aliasing math.ceil as y and str.format as z, nesting formats, single line imports, lambda, and bitwise operation plus some other things to get this like it is.

def f(n):import random,math;y=math.ceil;z=str.format;i=y(2*n-5>>1);j=y(n-3>>1);return z("{a}{}{a}",z("{d}(@{}{b}F{c}@)\n{e}"," "*i,b=random.sample(["L","R"],1)[0],c=" "*(2*n-5-i),d=z("(@{}@)\n"," "*(2*n-3))*j,e=z("(@{}@)\n"," "*(2*n-3))*(n-3-j)),a=z("({})\n","@"*(2*n-1)))

Ungolfed version (separated imports, no aliases, and no bitwise operation):

def f(n):
    import random;
    import math;
    return "{a}{}{a}".format(
        "{d}(@{}{b}F{c}@)\n{e}".format(
            " "*(math.ceil((2*n-5)/2)),
            b=random.sample(["L","R"],1)[0],
            c=" "*((2*n)-(5+math.ceil((2*n-5)/2))),
            d="(@{}@)\n".format(" "*(2*n-3))*math.ceil((n-3)/2),
            e="(@{}@)\n".format(" "*(2*n-3))*(n-(3+(math.ceil((n-3)/2))))),
        a="({})\n".format("@"*(2*n-1)))

Interestingly, using the non-bitwise version of this still produces correct output, however, the output is different:

Non-Bitwise:

(@@@@@@@)
(@     @)
(@  LF @)
(@@@@@@@)

Bitwise:

(@@@@@@@)
(@ LF  @)
(@     @)
(@@@@@@@)

you can move the imports out of the function and change them to from ... import* type imports to save some bytes
Blue

Nice answer, and welcome to the site! A couple tips: 1. lambda functions are shorter, and 2. you could do import math;y=math.ceil to take two bytes off. This would give you import random;import math;y=math.ceil;lambda n:"{a}{}{a}".format("{d}(@{}{b}F{c}@)\n{e}".format(" "*(y((2*n-5)/2)),b=random.sample(["L","R"],1)[0],c=" "*((2*n)-(5+y((2*n-5)/2))),d="(@{}@)\n".format(" "*(2*n-3))*y((n-3)/2),e="(@{}@)\n".format(" "*(2*n-3))*(n-(3+(y((n-3)/2))))),a="({})\n".format("@"*(2*n-1))) which is 13 bytes shorter.
DJMcMayhem

@DJMcMayhem Thanks a lot! I updated my answer.
L. Steer

Glad I could help! One other thing you could probably do is alias to format since you call it a lot. Problem is, I don't exactly know how to alias to a member function (like str.format) so you'd have to experiment a little. I'm not positive it would be shorter though.
DJMcMayhem

4
Nice work! I am glad you got something out of this exercise :) However, I would like to clarify that the decoration must be centered to fit the challenge specifications. Whether or not you decide to change your code to reflect this - can I ask that you keep the current code in your post too? Good effort worth keeping, even if it neglects one of the rules.
Moon Rabbit

0

C# 448 bytes

Golfed:

var v=n%2==0;int l=n+n-3,h=n-2,e=v?0:1,c=e+2;var c2=v?"MFZJLFRFCF":"MAFHMFJCJTTT";var r=new Random().Next(3+e);var f=new String(c2.Skip(c*r).Take(c).ToArray());var mc="";for (var i=0;i < h;i++) {var x="";if (!v && i==((h / 2))) { x=f;} else if (v && ((i==h / 2) || (i==(h/2)-1))) { x +=f[i%2==1?0:1];} var es=x.PadLeft((l/2)+1+e,' ').PadRight(l,' ');mc +="(@"+es+"@)\n";}var b="("+"".PadLeft(l+2, '@')+")";mc=b+"\n"+mc+ b; Console.WriteLine(mc);

Test it here

Ungolfed:

        var v = n % 2 == 0;
        int l = n + n - 3, h = n - 2, e = v ? 0 : 1, c = e + 2;
        var c2 = v ? "MFZJLFRFCF" : "MAFHMFJCJTTT";
        var r = new Random().Next(3 + e);
        var f = new String(c2.Skip(c * r).Take(c).ToArray());
        var mc = "";
        for (var i = 0; i < h; i++)
        {
            var x = "";
            if (!v && i == ((h / 2)))
            {
                x = f;
            }
            else if (v && ((i == h / 2) || (i == (h / 2) - 1)))
            {
                x += f[i % 2 == 1 ? 0 : 1];
            }
            var emptySpace = x.PadLeft((l / 2) + 1 + e, ' ').PadRight(l, ' ');
            mc += "(@" + emptySpace + "@)\n";
        }
        var b = "(" + "".PadLeft(l + 2, '@') + ")";
        mc = b + "\n" + mc + b;
        Console.WriteLine(mc);
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.