在赛道上比赛


24

我正在寻找周围最快的赛车手。告诉我您在如下所示的18x14赛道上最快的圈速。

      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/

您的工作是在所有可能的位置将汽车移到轨道下方。

 _
| |
|_|

 /\
/ /
\/

 __
|__|

/\
\ \
 \/

该汽车在转弯之前可以连续行驶3个空间。这是一个膝部应该是什么样子的示例。

      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /_  /      \   \
|| ||        |   |
||_||        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
| _ |        |   |
|| ||        |   |
||_||        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
| _ |        |   |
|| ||        |   |
||_||        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
| /\|        |   |
 \\ \\      /   /
  \\/ \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \ /\\      /   /
  \\ \\____/   /
   \\/        /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \ /\\____/   /
   \\ \       /
    \\/      /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \   __     /
    \ |__|   /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \    __    /
    \  |__|  /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \     __   /
    \   |__| /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____//\ /
   \       / //
    \      \//
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      //\ /
  \   \____// //
   \        \//
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |/\ |
 \   \      // //
  \   \____/ \//
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        | _ |
|   |        || ||
|   |        ||_||
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        | _ |
|   |        || ||
|   |        ||_||
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \   \
 /   /      \  _\
|   |        || ||
|   |        ||_||
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  /   /    \ /\\
 /   /      \\ \\
|   |        |\/ |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____ /\\
  /   /    \\ \\
 /   /      \\/ \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /      /\\
   /   ____\ \\
  /   /    \\/ \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /   __ \
    /   |__| \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /  __  \
    /  |__|  \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     / __   \
    / |__|   \
   /   ____   \
  /   /    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    //\      \
   // /____   \
  / \//    \   \
 /   /      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   //\ ____   \
  // //    \   \
 / \//      \   \
|   |        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/
      ______
     /      \
    /        \
   /   ____   \
  //\ /    \   \
 // //      \   \
| \/|        |   |
|   |        |   |
|   |        |   |
|   |        |   |
 \   \      /   /
  \   \____/   /
   \          /
    \        /
     \______/

规则

  • 输出应显示汽车在所有可能的位置。轨道的8个部分中的每3个位置意味着有24个可能的位置显示。
  • 轿厢位置必须按顺序显示。(您无法传送到曲目的另一部分!)
  • 起始位置和方向(顺时针/逆时针)并不重要。
  • 输出可以是任何合理的文本格式。
  • 没有输入。
  • 标准代码高尔夫球规则。您的代码中的字节越少,汽车的行驶速度就越快。

我接受无输入或不可用输入吗?
Veskah '18

@Veskah正确。编辑了帖子以包括此内容。
aoemica '18

2
非常好的第一个挑战!
Stewie Griffin '18

Answers:


4

画布,131 字节

{↔]
ø5/22╋___71╋__84╋|¶|17╋|¶|57╋2/65╋╬
3[⁵ __¶|__|²6+2╋]
3[⁵ _¶| |¶|_|25²+╋]
3[⁵ /\¶/ /¶\/6²-2²+╋]
⁷⁸⇵{↕]∔⁶{↕]∔⁸{↕↔]∔⁷⇵⁴∔⁸⇵⁴∔⁶⁴∔⁸∔

在这里尝试!


6

JavaScript(ES6),371字节

顺时针旋转。大概还是高尔夫。

f=(i=24,A=[])=>i--?A.map(r=>r.join``,g=(s,x,y)=>[...s].map(c=>(j=c.charCodeAt(),d='12221',m=k=>(x-=~-d[j&7],y-=~-d[j-2&7],k--)&&((A[y]=A[y]||Array(18).fill` `)[x]='|/_\\'[j&3],k&&m(k)))(j/8&7)),g('voF`ir@kBdm',5,1),g('fWF`Qb@SBdU',6,4),g(['NFPJAT','MDWFI@S','VFHRAL','UDOFQ@K'][i/3&3],'0x'+'111123678ABCEEECBA876321'[i],'0x'+'678BCDDDDEDC876654222567'[i])).join`
`+f(i):A

在线尝试!

动画版

少打高尔夫球

// i = frame counter, A[] = drawing matrix
f = (i = 24, A = []) =>
  i-- ?
    A.map(r =>
      r.join``,
      // g() draws the shape described by s, starting at (x, y)
      g = (s, x, y) =>
        [...s].map(c => (
          // j holds the direction in bits 0-2 and the length in bits 3-5
          // a length of 0 means 'move without drawing'
          j = c.charCodeAt(),
          d = '12221',
          // m() either draws a line or just moves the pen by 1 step
          m = k => (
            x -= ~-d[j & 7],
            y -= ~-d[j - 2 & 7],
            k--
          ) && (
            (A[y] = A[y] || Array(18).fill` `)[x] = '|/_\\'[j & 3],
            k && m(k)
          )
        )(j / 8 & 7)),
      // draw the outer boundary of the track
      g('voF`ir@kBdm', 5, 1),
      // draw the inner boundary of the track
      g('fWF`Qb@SBdU', 6, 4),
      // draw the car, using the correct shape for this frame and hard-coded coordinates
      g(['NFPJAT', 'MDWFI@S', 'VFHRAL', 'UDOFQ@K'][i / 3 & 3],
        '0x'+'111123678ABCEEECBA876321'[i],
        '0x'+'678BCDDDDEDC876654222567'[i]
      )
    ).join`\n` + f(i)
  :
    A

3

Python 2中641个 639 592 576字节

for i in range(24):
 t='s  ______s  Xs / 642  \s Xs/875310  \sX   /:;8____   \   X  /<9:/s\   \  X />=</s  \   \ X|A@?|ss|   |X|BCB|ss|   |X|DED|ss|   |X|FHG|ss|   |X \ILK\s  /   / X  \KJM\____/   /  X   \MNPRTVs/   Xs\POQSUW  /sXs \______/s '.replace('s',4*' ')
 for c,C in[zip([chr(x)for x in range(48,88)],' '*ord(s)+r+' '*40)for s,r in zip("\0\n	!",'|____|?| ____|?\/\/?/\/\ ?\  / //\ ?_| ||_?_ | |_?_| ||_?\/\/\ ?\/\/?/  \ /\ ?| ____|?| ____|'.split('?'))][abs(12-i)]+zip('\/!','!\/')*(i>12):t=t.replace(c,C)
 print'\n'.join(l[::2*(i<13)-1]for l in t.split('X'))

在线尝试!

  • -2个字节,感谢Kevin Cruijssen
  • -30个字节,由于助记符
  • -16字节,感谢乔纳森



[1,-1][i>12]-> 2*(i<13)-1
乔纳森·弗雷希

@JonathanFrech谢谢:)
TFeld
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.