Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities includingStack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Loading…
Code Golf

Return to Answer

added 63 characters in body
Rosario
  • 1.7k
  • 6
  • 9

APL(NARS), 449 chars

r←h;g;p;l;m;x;t;a;s;d;wl←≢m←,(0..2)∘.,(0..5)∘.,2..12⋄a←0t←m[x←?l]⋄m[x]←m[r←?l]⋄m[r]←t⋄→2×⍳l≥a+←1⋄g←p←⍬⋄r←1+i←1⋄d←{⍵≡⍬:''⋄{'FSW'[1+1⊃⍵],'YORBGP'[1+2⊃⍵],⍕3⊃⍵}¨⍵}⋄w←{⍬≡s←⍵:0⋄∨/{k←⍵⋄0=+/q←{⍵[1]=k}¨s:0⋄3≤≢∪{2⊃⍵}¨q/s}¨0 1 2}⋄x←m[i..i+4]⋄i+←5⎕←d x⋄a←⍎⍞⋄→0×⍳∼a∊⍳5⋄⎕←d(s t)←x[a],m[i]⋄→0×⍳l<i+←1⋄x←x[a∼⍨⍳5]⋄→6×⍳∼t[1]=3∣1+s[1]g,←⊂s⋄⎕←1⎕←d g⋄⎕←d p⋄→9×⍳w g⋄→0×⍳w p⋄x,←m[i]⋄→0×⍳l<i+←1⋄→3→8×⍳∼s[1]=3∣1+t[1]p,←⊂t⋄⎕←2⋄→5→4×⍳s[3]>t[3]⋄→7×⍳s[3]<t[3]⋄⎕←0⋄→5r←1

//24+34+180+81+10+50+19+13+35+3=449ItAt end the h function return 1 if operator wins, 2 if PC wins. It is possible there is some error. test:

  h FY2 FO8 WR10 FP11 FO9 1 FY2 FG2 0 FO8 WR10 FP11 FO9 FY8 2 WR10 SG10 2 SG10  FO8 FP11 FO9 FY8 WY11 3 FO9 SP10 1 FO9  SG10  FO8 FP11 FY8 WY11 FO4 4 WY11 SB6 2 FO9  SG10 SB6  FO8 FP11 FY8 FO4 WP8 5 WP8 FY3 1 FO9 WP8  SG10 SB6  FO8 FP11 FY8 FO4 FR8 1 FO8 WO2 2 FO9 WP8  SG10 SB6 WO2  FP11 FY8 FO4 FR8 WO5 2 FY8 WG7 2 FO9 WP8  SG10 SB6 WO2 WG7  FP11 FO4 FR8 WO5 SB10 3 FR8 SO8 1 FO9 WP8 FR8  SG10 SB6 WO2 WG7  FP11 FO4 WO5 SB10 FO11 4 SB10 WR11 1 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7  FP11 FO4 WO5 FO11 WB6 5 WB6 SP5 2 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7 SP5 2

APL(NARS), 449 chars

r←h;g;p;l;m;x;t;a;s;d;wl←≢m←,(0..2)∘.,(0..5)∘.,2..12⋄a←0t←m[x←?l]⋄m[x]←m[r←?l]⋄m[r]←t⋄→2×⍳l≥a+←1⋄g←p←⍬⋄r←1+i←1⋄d←{⍵≡⍬:''⋄{'FSW'[1+1⊃⍵],'YORBGP'[1+2⊃⍵],⍕3⊃⍵}¨⍵}⋄w←{⍬≡s←⍵:0⋄∨/{k←⍵⋄0=+/q←{⍵[1]=k}¨s:0⋄3≤≢∪{2⊃⍵}¨q/s}¨0 1 2}⋄x←m[i..i+4]⋄i+←5⎕←d x⋄a←⍎⍞⋄→0×⍳∼a∊⍳5⋄⎕←d(s t)←x[a],m[i]⋄→0×⍳l<i+←1⋄x←x[a∼⍨⍳5]⋄→6×⍳∼t[1]=3∣1+s[1]g,←⊂s⋄⎕←1⎕←d g⋄⎕←d p⋄→9×⍳w g⋄→0×⍳w p⋄x,←m[i]⋄→0×⍳l<i+←1⋄→3→8×⍳∼s[1]=3∣1+t[1]p,←⊂t⋄⎕←2⋄→5→4×⍳s[3]>t[3]⋄→7×⍳s[3]<t[3]⋄⎕←0⋄→5r←1

//24+34+180+81+10+50+19+13+35+3=449It is possible there is some error. test:

  h FY2 FO8 WR10 FP11 FO9 1 FY2 FG2 0 FO8 WR10 FP11 FO9 FY8 2 WR10 SG10 2 SG10  FO8 FP11 FO9 FY8 WY11 3 FO9 SP10 1 FO9  SG10  FO8 FP11 FY8 WY11 FO4 4 WY11 SB6 2 FO9  SG10 SB6  FO8 FP11 FY8 FO4 WP8 5 WP8 FY3 1 FO9 WP8  SG10 SB6  FO8 FP11 FY8 FO4 FR8 1 FO8 WO2 2 FO9 WP8  SG10 SB6 WO2  FP11 FY8 FO4 FR8 WO5 2 FY8 WG7 2 FO9 WP8  SG10 SB6 WO2 WG7  FP11 FO4 FR8 WO5 SB10 3 FR8 SO8 1 FO9 WP8 FR8  SG10 SB6 WO2 WG7  FP11 FO4 WO5 SB10 FO11 4 SB10 WR11 1 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7  FP11 FO4 WO5 FO11 WB6 5 WB6 SP5 2 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7 SP5 2

APL(NARS), 449 chars

r←h;g;p;l;m;x;t;a;s;d;wl←≢m←,(0..2)∘.,(0..5)∘.,2..12⋄a←0t←m[x←?l]⋄m[x]←m[r←?l]⋄m[r]←t⋄→2×⍳l≥a+←1⋄g←p←⍬⋄r←1+i←1⋄d←{⍵≡⍬:''⋄{'FSW'[1+1⊃⍵],'YORBGP'[1+2⊃⍵],⍕3⊃⍵}¨⍵}⋄w←{⍬≡s←⍵:0⋄∨/{k←⍵⋄0=+/q←{⍵[1]=k}¨s:0⋄3≤≢∪{2⊃⍵}¨q/s}¨0 1 2}⋄x←m[i..i+4]⋄i+←5⎕←d x⋄a←⍎⍞⋄→0×⍳∼a∊⍳5⋄⎕←d(s t)←x[a],m[i]⋄→0×⍳l<i+←1⋄x←x[a∼⍨⍳5]⋄→6×⍳∼t[1]=3∣1+s[1]g,←⊂s⋄⎕←1⎕←d g⋄⎕←d p⋄→9×⍳w g⋄→0×⍳w p⋄x,←m[i]⋄→0×⍳l<i+←1⋄→3→8×⍳∼s[1]=3∣1+t[1]p,←⊂t⋄⎕←2⋄→5→4×⍳s[3]>t[3]⋄→7×⍳s[3]<t[3]⋄⎕←0⋄→5r←1

//24+34+180+81+10+50+19+13+35+3=449At end the h function return 1 if operator wins, 2 if PC wins. It is possible there is some error. test:

  h FY2 FO8 WR10 FP11 FO9 1 FY2 FG2 0 FO8 WR10 FP11 FO9 FY8 2 WR10 SG10 2 SG10  FO8 FP11 FO9 FY8 WY11 3 FO9 SP10 1 FO9  SG10  FO8 FP11 FY8 WY11 FO4 4 WY11 SB6 2 FO9  SG10 SB6  FO8 FP11 FY8 FO4 WP8 5 WP8 FY3 1 FO9 WP8  SG10 SB6  FO8 FP11 FY8 FO4 FR8 1 FO8 WO2 2 FO9 WP8  SG10 SB6 WO2  FP11 FY8 FO4 FR8 WO5 2 FY8 WG7 2 FO9 WP8  SG10 SB6 WO2 WG7  FP11 FO4 FR8 WO5 SB10 3 FR8 SO8 1 FO9 WP8 FR8  SG10 SB6 WO2 WG7  FP11 FO4 WO5 SB10 FO11 4 SB10 WR11 1 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7  FP11 FO4 WO5 FO11 WB6 5 WB6 SP5 2 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7 SP5 2
Rosario
  • 1.7k
  • 6
  • 9

APL(NARS), 449 chars

r←h;g;p;l;m;x;t;a;s;d;wl←≢m←,(0..2)∘.,(0..5)∘.,2..12⋄a←0t←m[x←?l]⋄m[x]←m[r←?l]⋄m[r]←t⋄→2×⍳l≥a+←1⋄g←p←⍬⋄r←1+i←1⋄d←{⍵≡⍬:''⋄{'FSW'[1+1⊃⍵],'YORBGP'[1+2⊃⍵],⍕3⊃⍵}¨⍵}⋄w←{⍬≡s←⍵:0⋄∨/{k←⍵⋄0=+/q←{⍵[1]=k}¨s:0⋄3≤≢∪{2⊃⍵}¨q/s}¨0 1 2}⋄x←m[i..i+4]⋄i+←5⎕←d x⋄a←⍎⍞⋄→0×⍳∼a∊⍳5⋄⎕←d(s t)←x[a],m[i]⋄→0×⍳l<i+←1⋄x←x[a∼⍨⍳5]⋄→6×⍳∼t[1]=3∣1+s[1]g,←⊂s⋄⎕←1⎕←d g⋄⎕←d p⋄→9×⍳w g⋄→0×⍳w p⋄x,←m[i]⋄→0×⍳l<i+←1⋄→3→8×⍳∼s[1]=3∣1+t[1]p,←⊂t⋄⎕←2⋄→5→4×⍳s[3]>t[3]⋄→7×⍳s[3]<t[3]⋄⎕←0⋄→5r←1

//24+34+180+81+10+50+19+13+35+3=449It is possible there is some error. test:

  h FY2 FO8 WR10 FP11 FO9 1 FY2 FG2 0 FO8 WR10 FP11 FO9 FY8 2 WR10 SG10 2 SG10  FO8 FP11 FO9 FY8 WY11 3 FO9 SP10 1 FO9  SG10  FO8 FP11 FY8 WY11 FO4 4 WY11 SB6 2 FO9  SG10 SB6  FO8 FP11 FY8 FO4 WP8 5 WP8 FY3 1 FO9 WP8  SG10 SB6  FO8 FP11 FY8 FO4 FR8 1 FO8 WO2 2 FO9 WP8  SG10 SB6 WO2  FP11 FY8 FO4 FR8 WO5 2 FY8 WG7 2 FO9 WP8  SG10 SB6 WO2 WG7  FP11 FO4 FR8 WO5 SB10 3 FR8 SO8 1 FO9 WP8 FR8  SG10 SB6 WO2 WG7  FP11 FO4 WO5 SB10 FO11 4 SB10 WR11 1 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7  FP11 FO4 WO5 FO11 WB6 5 WB6 SP5 2 FO9 WP8 FR8 SB10  SG10 SB6 WO2 WG7 SP5 2

[8]ページ先頭

©2009-2025 Movatter.jp