'X' का विकास


15

दिया गया है, 5 गुना 5 क्षेत्रों के अधिकतम आकार के साथ एक चर आकार का बोर्ड। हर क्षेत्र कन्न एक 'x' से भर जाता है। यदि यह 'x' से नहीं भरा है, तो यह 'o' से भरा है।

प्रत्येक बोर्ड की प्रारंभिक स्थिति दी गई है (नीचे देखें)। प्रत्येक बोर्ड के साथ, 10 राउंड खेले जाने हैं (अधिकतम पर, स्थितियां: नीचे देखें) और एक्स के विकास को देखा जाना चाहिए।

एक राउंड निम्न तरीके से काम करता है:

  1. प्रत्येक 'x' ऑर्थोगोननलली बॉर्डरिंग फील्ड्स में फैलता है, लेकिन खुद ही गायब हो जाता है
  2. हर बार जब दो 'x' एक फ़ील्ड पर होते हैं, तो वे एक दूसरे को बेअसर करते हैं

प्रत्येक दौर में सभी 'x' का विकास एक साथ होना है। उदाहरण:

    o o o            o x o
    o x o     ->     x o x
    o o o            o x o

विकास के प्रत्येक दौर के साथ, आपको यह देखना होगा कि क्या बोर्ड 'x' से खाली हो जाता है। क्या यह खाली नहीं है, एक दोहराव वाला पैटर्न मौजूद हो सकता है। यदि यह भी मामला नहीं है, तो हम विकास के विश्लेषण को छोड़ देते हैं। इसके अतिरिक्त आपको प्रत्येक शुरुआती बोर्ड के लिए एक्स फ़ील्ड का अधिकतम प्रतिशत प्रिंट करना होगा (पूरी संख्याओं तक नीचे)।

इनपुट:

इनपुट डेटा यहां पाया जा सकता है (पास्टबीन) इस डेटा में 100 शुरुआती राज्य हैं। जैसा कि पहले ही उल्लेख किया गया है, बोर्ड आकार में भिन्न होते हैं। पंक्तियों की संख्या 1 से 5 तक संख्या n के साथ बताई गई है, इसके बाद n पंक्तियाँ जिनमें केवल 'x' और 'o' हैं, प्रारंभिक पैटर्न को दर्शाती हैं। एक बोर्ड की प्रत्येक पंक्ति में 1 से 5 फ़ील्ड होते हैं।

आउटपुट:

पूरा परिणाम बाहर मुद्रित किया जाना चाहिए, निम्नलिखित रूप में प्रत्येक शुरुआती बोर्ड के लिए एक मुद्रित पंक्ति:

    Round {0-10}: {repetition/empty/giveup}, {0-100} percent maximum-fill

उदाहरण:

उदाहरण 1:

    Input: 2       Starting state: x o x
           xox                     x x
           xx

                          Round 1: x x o
                                   o x

                          Round 2: x o x
                                   o x

                          Round 3: o x o
                                   o o

                          Round 4: x o x   -> The pattern repeats:
                                   o x        It is the same as in round 2,
                                              therefore we stop. Maximum fill was
                                              in the starting state with four times 'x'
                                              of 5 fields altogether,
                                              so we have 4/5 = 80 %.

    Output: Round 4: repetition, 80 percent maximum-fill

उदाहरण 2:

    Input: 1       Starting state: x x
           xx                      

                          Round 1: x x    ->  We already have a repetition, because
                                              the pattern is the same as in the starting
                                              state. The board is always filled 100 %.

    Output: Round 1: repetition, 100 percent maximum-fill

आठ दिन के बाद, मैं विजेता के रूप में सबसे कम पात्रों के साथ काम करने के उत्तर को चिह्नित करूंगा। इसके अतिरिक्त मैं 100 शुरुआती बोर्ड (इनपुट) के लिए सही आउटपुट पोस्ट करूंगा।

आप अपनी पसंद की (प्रोग्रामिंग / स्क्रिप्टिंग / जो भी) भाषा का उपयोग कर सकते हैं।

मज़े करो!

पुनश्च: यदि आपके कोई प्रश्न हैं, तो बेझिझक पूछें।

PPS: मूल रचनाकारों के संबंध में: जर्मन बोलने में सक्षम लोगों के लिए, यह प्रश्न यहां से नहीं लिया गया है कि क्या आप यहां नहीं गए हैं । चूंकि चुनौती को पूरा करने का आधिकारिक समय समाप्त हो गया है, मैं देखना चाहता था कि क्या कोई छोटा और सुरुचिपूर्ण समाधान निकाल सकता है।

22.04.2014:

चुनौती दी! विजेता के रूप में चिह्नित। सही आउटपुट:

    Round 10: giveup, 50 percent maximum-fill
    Round 5: empty, 66 percent maximum-fill
    Round 1: repetition, 100 percent maximum-fill
    Round 1: empty, 100 percent maximum-fill
    Round 4: repetition, 100 percent maximum-fill
    Round 4: repetition, 70 percent maximum-fill
    Round 2: repetition, 60 percent maximum-fill
    Round 4: empty, 88 percent maximum-fill
    Round 10: giveup, 50 percent maximum-fill
    Round 5: repetition, 80 percent maximum-fill
    Round 10: repetition, 80 percent maximum-fill
    Round 1: empty, 80 percent maximum-fill
    Round 3: repetition, 60 percent maximum-fill
    Round 4: repetition, 48 percent maximum-fill
    Round 9: empty, 41 percent maximum-fill
    Round 10: giveup, 92 percent maximum-fill
    Round 10: giveup, 53 percent maximum-fill
    Round 10: giveup, 66 percent maximum-fill
    Round 6: repetition, 50 percent maximum-fill
    Round 10: giveup, 88 percent maximum-fill
    Round 10: giveup, 76 percent maximum-fill
    Round 10: giveup, 68 percent maximum-fill
    Round 10: giveup, 40 percent maximum-fill
    Round 10: giveup, 100 percent maximum-fill
    Round 10: giveup, 71 percent maximum-fill
    Round 2: empty, 81 percent maximum-fill
    Round 6: repetition, 36 percent maximum-fill
    Round 10: giveup, 61 percent maximum-fill
    Round 10: giveup, 60 percent maximum-fill
    Round 4: repetition, 66 percent maximum-fill
    Round 10: giveup, 72 percent maximum-fill
    Round 3: empty, 80 percent maximum-fill
    Round 10: giveup, 50 percent maximum-fill
    Round 10: giveup, 83 percent maximum-fill
    Round 7: repetition, 37 percent maximum-fill
    Round 9: repetition, 85 percent maximum-fill
    Round 5: repetition, 40 percent maximum-fill
    Round 5: repetition, 60 percent maximum-fill
    Round 4: empty, 80 percent maximum-fill
    Round 10: giveup, 60 percent maximum-fill
    Round 4: repetition, 46 percent maximum-fill
    Round 6: repetition, 42 percent maximum-fill
    Round 10: giveup, 72 percent maximum-fill
    Round 4: repetition, 70 percent maximum-fill
    Round 4: repetition, 80 percent maximum-fill
    Round 6: repetition, 50 percent maximum-fill
    Round 4: repetition, 56 percent maximum-fill
    Round 10: giveup, 60 percent maximum-fill
    Round 10: giveup, 54 percent maximum-fill
    Round 10: giveup, 66 percent maximum-fill
    Round 2: repetition, 40 percent maximum-fill
    Round 2: repetition, 40 percent maximum-fill
    Round 6: repetition, 75 percent maximum-fill
    Round 7: empty, 85 percent maximum-fill
    Round 10: giveup, 50 percent maximum-fill
    Round 6: repetition, 70 percent maximum-fill
    Round 2: empty, 66 percent maximum-fill
    Round 1: empty, 66 percent maximum-fill
    Round 3: empty, 100 percent maximum-fill
    Round 3: empty, 66 percent maximum-fill
    Round 8: repetition, 42 percent maximum-fill
    Round 1: empty, 60 percent maximum-fill
    Round 2: repetition, 100 percent maximum-fill
    Round 2: repetition, 83 percent maximum-fill
    Round 4: repetition, 66 percent maximum-fill
    Round 6: repetition, 75 percent maximum-fill
    Round 4: empty, 66 percent maximum-fill
    Round 10: giveup, 61 percent maximum-fill
    Round 10: giveup, 56 percent maximum-fill
    Round 4: empty, 66 percent maximum-fill
    Round 6: repetition, 33 percent maximum-fill
    Round 3: empty, 57 percent maximum-fill
    Round 3: repetition, 100 percent maximum-fill
    Round 6: repetition, 73 percent maximum-fill
    Round 10: giveup, 50 percent maximum-fill
    Round 6: repetition, 50 percent maximum-fill
    Round 10: giveup, 73 percent maximum-fill
    Round 5: empty, 80 percent maximum-fill
    Round 10: giveup, 61 percent maximum-fill
    Round 3: repetition, 53 percent maximum-fill
    Round 10: giveup, 33 percent maximum-fill
    Round 10: giveup, 80 percent maximum-fill
    Round 10: giveup, 63 percent maximum-fill
    Round 10: giveup, 70 percent maximum-fill
    Round 10: giveup, 84 percent maximum-fill
    Round 7: repetition, 70 percent maximum-fill
    Round 10: repetition, 57 percent maximum-fill
    Round 10: giveup, 55 percent maximum-fill
    Round 6: repetition, 36 percent maximum-fill
    Round 4: repetition, 75 percent maximum-fill
    Round 10: giveup, 72 percent maximum-fill
    Round 10: giveup, 64 percent maximum-fill
    Round 10: giveup, 84 percent maximum-fill
    Round 10: giveup, 58 percent maximum-fill
    Round 10: giveup, 60 percent maximum-fill
    Round 10: giveup, 53 percent maximum-fill
    Round 4: repetition, 40 percent maximum-fill
    Round 4: empty, 40 percent maximum-fill
    Round 10: giveup, 50 percent maximum-fill
    Round 10: giveup, 68 percent maximum-fill

कृपया कोड-गोल्फ या कोड-चैलेंज के रूप में टैग करें, लेकिन दोनों नहीं। (यह इस मामले में कोड-गोल्फ होना चाहिए)।
user80551

1
किसी को इसे एक अच्छी तरह से परिभाषित सेलुलर ऑटोमेटन में बदलना चाहिए। :-)
जस्टिन

जवाबों:


4

पर्ल, 308, 304, 305, 293, 264 , 262

संपादित करें: हाल के एक संपादन के बाद बग बग खत्म हो गया, जिससे खाली बोर्डों के लिए गलत उत्पादन हुआ (परीक्षण सूट का उत्पादन ठीक था)। जबसेRound 0 दिए गए आउटपुट प्रारूप का मतलब केवल यह हो सकता है कि इनपुट में खाली बोर्ड हो सकते हैं (हालांकि कोई भी टेस्ट सूट में नहीं है), बग को ठीक किया जाना था। क्विक फिक्स का मतलब था बाइट काउंट वृद्धि (1 से, वास्तव में) - एक विकल्प नहीं, बिल्कुल। इसलिए, मुझे इसे थोड़ा और अधिक गोल्फ करना पड़ा।

-pएसटीडीआईएन से पढ़े (गिनती में जोड़ा गया) के साथ चलाएं । rप्रतिस्थापन संशोधक के कारण 5.014 की आवश्यकता है ।

(@a,%h,$m)=('',map<>=~y/ox\n/\0!/rd,1..$_);for$n(0..10){$_="Round $n: ".($h{$_="@a"}++?repetition:(($.=100*y/!///y/ //c)<$m?$.:$m=$.)?giveup:empty).", $m percent maximum-fill\n";@a=/g/?map{$_=$a[$i=$_];y//!/cr&(s/.//r.P^P.s/.$//r^$a[$i+1]^$a[$i-1])}0..$#a:last}

अर्थात

# '-p' switch wraps code into the 'while(<>){....}continue{print}' loop, 
# which reads a line from STDIN into $_, executes '....' and prints contents 
# of $_. We use it to read board height and print current board's result.

# First line reads board's state into @a array, a line per element, at the same 
# time replacing 'o' with 'x00', 'x' with '!' and chomping trailing newlines. 
# '!' was chosen because it's just like 'x01' except 5th bit (which is not important)
# but saves several characters in source code.

# Note: array is prepended with an empty line, which automatically remains in this 
# state during evolution, but saves us trouble of checking if actual (any non-empty)
# line has neighboring line below.

# %h hash and $m hold seen states and maximum fill percentage for current board,
# they are initialized to undef i.e empty and 0.

(@a,%h,$m)=('',map<>=~y/ox\n/\0!/rd,1..$_);

# /
# Then do required number of evolutions:

for$n(0..10){

# Stringify board state, i.e. concatenate lines with spaces ($") as separators.
# Calculate fill percentage - divide number of '!' by number of non-spaces. 
# Note: using $. magick variable automatically takes care of rounding.
# Construct output string. It's not used if loop gets to next iteration. 
# Check if current state was already seen (at the same time add it to %h) 
# and if fill percentage is 0.

$_="Round $n: "
    .($h{$_="@a"}++?repetition:(($.=100*y/!///y/ //c)<$m?$.:$m=$.)?giveup:empty)
    .", $m percent maximum-fill\n";

# /
# Next is funny: if output string contains 'g' (of 'giveup' word), then evolve 
# further, otherwise break-out of the loop.

    @a=/g/
        ?map{

# Do evolution round. Act of evolution for a given line is none other than 
# XOR-ing 4 strings: itself shifted right, itself shifted left, line above, line 
# below. Result of this operation is truncated to original length using bitwise '&'. 
# Note, when shifting string right or left we prepend (append) not an ascii-0, 
# but 'P' character. It's shorter, and 4th and 6th bits will be annihilated anyway.

            $_=$a[$i=$_];
            y//!/cr
            &(s/.//r.P
            ^P.s/.$//r
            ^$a[$i+1]
            ^$a[$i-1])
        }0..$#a
        :last
}

वाह, इतनी तेजी से एक समाधान। मैं चकित हूं। चूंकि मैं PERL से परिचित नहीं हूं (हालांकि मैंने इसे स्थापित किया है), मैं अपने इनपुट डेटा के साथ आपकी स्क्रिप्ट कैसे शुरू करूं?
प्लॉक

2
@DevanLoper, जैसे perl -p x.pl < input.txtअगर डेटा एक फाइल में है, या perl -p x.plलाइन एकल प्रविष्टि का परीक्षण करने के द्वारा और फ़ीड लाइन (के साथ समाप्त ctrl-D( ctrl-Z))। याद रखें कि अपने पर्ल को चेक करना है 5.014या नया।
user2846289

धन्यवाद वादिम, अब यह चलता है। लेकिन मुद्रित भरण प्रतिशत के संबंध में मेरे पास दो पंक्तियों में एक अलग परिणाम है। लेकिन वह गोल-गोल त्रुटियां हो सकती हैं।
प्लॉक

1
@DevanLoper, क्षमा करें, यह मेरी त्रुटि है, प्रतिशत पिछले पुनरावृत्ति से लिया गया है। मैं जल्द ही इसे ठीक कर दूंगा।
user2846289

1
बग को ठीक किया गया, + कुछ बाइट्स फेंके गए। टेस्ट के परिणाम लिंक्ड साइट से मेल खाते हैं। तकनीकी रूप से, 11 राउंड चलाए जाते हैं, लेकिन अंतिम राउंड की स्थिति की जाँच नहीं की जाती है और न ही इसका उपयोग किया जाता है। यह सभी संक्षिप्तता के लिए है। मैंने 1 \n oइनपुट पकड़ने के लिए शुरुआत में लूप ब्रेकिंग की स्थिति रखी ।
user2846289

3

सी # - 1164 चार्ट

यह कोड-गोल्फ में मेरी पहली भागीदारी है इसलिए कृपया कृपालु बनें ;-)

मुझे पता है, मैं सबसे अच्छे परिणामों से बहुत दूर हूँ - वास्तव में आश्चर्यजनक है!

लेकिन मुझे लगा कि मैं अपना समाधान C # में साझा करूंगा।

using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;class Program{static void Main(string[] args){new WebClient().DownloadFile("http://mc.capgemini.de/challenge/in.txt",@"D:\in.txt");var a=File.ReadAllLines(@"D:\in.txt");int l=0;while(l<a.Length){int n=Int32.Parse(a[l]);var b=a.Skip(l+1).Take(n).ToArray();var f=new List<string[]>{b};var d=0;string g=null;while(d<10){var s=f.Last();if(s.All(e=>e.All(c=>c=='o'))){g="empty";break;}var h=new string[n];for(int r=0;r<n;r++){var k="";for(int c=0;c<b[r].Length;c++){int x=0;try{if(s[r][c-1]=='x')x++;}catch{}try{if(s[r][c+1]=='x')x++;}catch{}try{if(s[r-1][c]=='x')x++;}catch{}try{if(s[r+1][c]=='x')x++;}catch{}k+=((x%2)==1)?'x':'o';}h[r]=k;}d++;f.Add(h);var w=false;for(int i=0;i<f.Count-1;i++){var m=f[i];if (!h.Where((t,y)=>t!=m[y]).Any())w=true;}if(w){g="repetition";break;}}if(d==10&&g==null)g="giveup";File.AppendAllLines(@"D:\out.txt",new[]{string.Format("Round {0}: {1}, {2} percent maximum-fill",d,g,f.Select(z=>{int t=0;int x=0;foreach(var c in z.SelectMany(s=>s)){t++;if(c=='x')x++;}return(int)Math.Floor((double)x/t*100);}).Concat(new[]{0}).Max())});l=l+n+1;}}}

पूरी तरह से उपयोग के निर्देश पहले से ही 97 वर्णों की गणना करते हैं - इसलिए मुझे लगता है कि 200 से कम पात्रों के भीतर बाकी हासिल करना काफी कठिन होने वाला है।

यह एक काफी पुनरावृत्त दृष्टिकोण है, जो कई स्थानों पर LINQ का उपयोग करता है। मैंने इनपुट फ़ाइल के डाउनलोड और आउटपुट फ़ाइल को कोड में लिखना भी शामिल किया।

यहाँ एक और अधिक पठनीय संस्करण है:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;

class Program
{
    static void Main(string[] args)
    {
        // Download the file
        new WebClient().DownloadFile("http://mc.capgemini.de/challenge/in.txt", @"D:\in.txt");
        // Read of lines of downloaded file
        var a = File.ReadAllLines(@"D:\in.txt");
        // Line index in input file
        int l = 0;
        while (l < a.Length)
        {
            // Parse number of rows to take
            int n = Int32.Parse(a[l]);

            // Take the n rows
            var b = a.Skip(l + 1).Take(n).ToArray();
            var f = new List<string[]> { b };
            var d = 0;
            string g = null;
            while (d < 10)
            {
                // Last state consists only of o's? -> 
                var s = f.Last();
                if (s.All(e => e.All(c => c == 'o')))
                {
                    g = "empty";
                    break;
                }
                // In h we will build up the new state
                var h = new string[n];
                // Loop through all rows of initial state
                for (int r = 0; r < n; r++)
                {
                    // This is our new row we will build up for the current state
                    var k = "";
                    // Count number of orthogonal adjacent x's
                    // And catch potential OutOfRangeExceptions
                    for (int c = 0; c < b[r].Length; c++)
                    {
                        int x = 0;
                        try { if (s[r][c - 1] == 'x') x++; }
                        catch { }
                        try { if (s[r][c + 1] == 'x') x++; }
                        catch { }
                        try { if (s[r - 1][c] == 'x') x++; }
                        catch { }
                        try { if (s[r + 1][c] == 'x') x++; }
                        catch { }
                        // Is number of adjacent x's odd? -> character will be 'x'
                        // otherwise -> 'o'
                        k += ((x % 2) == 1) ? 'x' : 'o';
                    }
                    // Add the new row to the current state
                    h[r] = k;
                }
                // Increase round count
                d++;
                // Add the new state to our state collection
                f.Add(h);
                // Now check, whether it is a repetition by comparing the last state (h) with all other states
                bool w = false;
                for (int i = 0; i < f.Count - 1; i++)
                {
                    var m = f[i];
                    if (!h.Where((t, y) => t != m[y]).Any())
                        w = true;
                }
                if (w)
                {
                    g = "repetition";
                    break;
                }
            }
            // Check whether we reached maximum AND the last round wasn't a repetition
            if (d == 10 && g == null)
                g = "giveup";
            // Now we append the final output row to our text file
            File.AppendAllLines(@"D:\out.txt",
                new[]
                    {
                        string.Format("Round {0}: {1}, {2} percent maximum-fill",
                        d,
                        g,
                        // Here we select all rates of x's per state
                        // and then grab the maximum of those rates
                        f.Select(z =>
                            {
                                int t=0;
                                int x=0;
                                foreach (char c in z.SelectMany(s => s))
                                {
                                    t++;
                                    if(c=='x')
                                        x++;
                                }
                                return (int) Math.Floor((double) x / t *100);
                            }).Concat(new[] {0}).Max())
                    });
            // finally we shift our index to the next (expected) number n in the input file
            l = l + n + 1;
        }
    }
}

1
लघु, छोटा, बेन का समाधान। आपने C # शर्तों में सोच के एक ऐसे माइक्रो का निर्माण किया है ...
पॉल फकलैम

2

जे - 275 चार

ओह, इन सभी I / O विनिर्देशों! अंत में, जम्मू के लिए ऐसा शर्मनाक बड़ा स्कोर। अनुगामी नई \rरेखा के साथ एसटीडीआईएन पर इनपुट लेता है, और मानता है कि इनपुट में कोई भी गाड़ी रिटर्न ( ) नहीं है। यहां प्रश्न में नमूना इनपुट फ़ाइल पर इसे लागू करने का परिणाम है।

stdout;,&LF&.>}:(".@{~&0(('Round ',":@(#->/@t),': ',(empty`repetition`giveup{::~2<.#.@t=.11&=@#,0={:),', ',' percent maximum-fill',~0":>./)@(100*1&=%&(+/"1)_&~:)@,.@(a=:(a@,`[@.(e.~+.10<#@[)(_*_&=)+[:~:/((,-)(,:|.)0 1)|.!.0=&1){:)@,:@('ox'&i.^_:)@{.;$: ::]@}.)}.)];._2[1!:1]3

अनगुल्ड: (मैं बाद में अधिक गहन और जे-नौसिखिया-अनुकूल स्पष्टीकरण जोड़ सकता हूं।)

input   =: ];._2 [ 1!:1]3
convert =: 'ox'&i. ^ _:               NB. 'x'=>1  'o'=>0  else=>infinity
spread  =: ((,-)(,:|.)0 1) |.!.0 =&1  NB. x spreading outwards
cover   =: (_*_&=) + [: ~:/ spread    NB. collecting x`s and removing tiles not on board
iterate =: (iterate@, ` [ @. (e.~ +. 10<#@[) cover) {:
percent =: 100 * 1&= %&(+/"1) _&~:    NB. percentage of x at each step
max     =: 0 ": >./
stat    =: 11&=@# , 0={:              NB. information about the simulation
ending  =: empty`repetition`giveup {::~ 2 <. #.@stat   NB. how simulation ended
round   =: ": @ (# - >/@stat)         NB. round number
format  =: 'Round ', round, ': ', ending, ', ', ' percent maximum-fill',~ max
evolvex =: format @ percent@,. @ iterate@,: @ convert
joinln  =: ,&LF &.>
nlines  =: ". @ {~&0
remain  =: }.
stdout ; joinln }: (nlines (evolvex@{. ; $: ::]@}.) remain) input

यह $:हिस्सा इनपुट पर मुख्य बॉडी रिकर्व बनाता है ( @प्रत्येक भाग पर डेज़ी-चेन को लागू करते हुए, जे से पार्स के लिए एक बहुत असुविधाजनक रूप) । nlinesअगले बोर्ड के लिए लाइनों की संख्या पाता है।

प्रत्येक बोर्ड पर कार्रवाई ( evolvex) साफ-सुथरी है: iterate( aगोल्फ में कहा जाता है) अनुकार के प्रत्येक पुनरावृत्ति की एक सूची का निर्माण करता है जब तक कि हम या तो पहले देखे गए या बहुत सारे चरणों को हिट नहीं करते हैं। फिर percent@,.प्रत्येक परिणाम में भरे हुए वर्ग के प्रतिशत की गणना करता है, और formatकुछ आंकड़े ( stat, कहा जाता है) चलाता हैt गोल्फ में है) यह पता लगाने के लिए कि सिमुलेशन कैसे समाप्त हुआ, कौन सा प्रतिशत सबसे बड़ा था, और इसी तरह, सभी को एक स्ट्रिंग में प्रारूपित करने से पहले।

अंत में, एक नए पंक्तिबद्ध स्ट्रिंग में अलग-अलग बोर्ड आउटपुट के सभी शामिल }:होने से पहले कुछ कचरे की देखभाल ; joinlnकरता है।


हाय एल्गोरिदमशर्क, क्या आप इनपुट पैरामीटर के रूप में एक .txt फ़ाइल के साथ कमांड लाइन से अपनी स्क्रिप्ट शुरू करने के बारे में निर्देश प्रदान कर सकते हैं? धन्यवाद!
प्लॉक

1
@DevanLoper जो मुझे याद दिलाता है, मैं इसे स्टडआउट करने के लिए उत्पादन करना भूल गया; उस सुधार को जोड़ा। इसे अब मानक तरीके से काम करना चाहिए jconsole golf.ijs < input.txt:।
एल्गोरिथमशार्क

जानकारी के लिए धन्यवाद, लेकिन यह अभी भी मेरे लिए कोई आउटपुट प्रिंट नहीं करता है, यहां तक ​​कि आपके कोड को भी बदल दिया है।
प्लॉक

@DevanLoper समस्या vएक नाम के रूप में मेरे उपयोग की प्रतीत होती है , जो कि जो भी कारण स्क्रिप्ट में अनुमति नहीं है। (मैं REPL में स्निपेट चला रहा था।) इसे बदलने aसे काम करने का आभास होता है।
एल्गोरिद्मशार्क

@algoshark यह मैं हो सकता है, लेकिन मैं अभी भी मुझे कुछ भी प्रिंट करने के लिए नहीं मिल सकता है।
प्लॉक
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.