Nickolas's blog

By Nickolas, 13 years ago, translation, In English

The round is over, I hope you have enjoyed it. Here is the editorial.

The language of this round is COBOL (dialect COBOL85), one of the oldest programming languages (date of “birth”: 1959, so it’s twice older than I am). Despite being so old, it’s still in active use, though not in programming competitions, so I think it should be enough of a surprise for you :-)

The problem "A+B" (numbers A and B given in separate lines) can be solved in a following way:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. SOLUTION.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 A        PIC 9(10)   VALUE ZEROES.
       01 B        PIC 9(10)   VALUE ZEROES.
       01 STR      PIC X(10).

       PROCEDURE DIVISION.
         ACCEPT STR
         MOVE STR TO A
         ACCEPT STR
         MOVE STR TO B
         ADD A TO B
         DISPLAY B
         STOP RUN.

You can find examples of COBOL programs in a Progopedia article and in RosettaCode article as well as in OpenCOBOL manuals.

The testing system uses OpenCOBOL 1.0. To test your programs before submitting, you can:

  • use “Custom test” tab in the contest interface.
  • use ideone, language COBOL. Remember that by default doces submitted by anonymous are shown in “recent codes”; to avoid this I recommend registering and using “user’s” privacy option or at least use “private” option..
  • install the compiler locally.

If you use Linux, this compiler is present in the repositories. After installing the compiler use cobc -std=cobol85 -x <filename> to compile the code and create the executable.

If you use Windows and have Visual Studio C++ inslalled (tested with 2005 Express Edition):

  • download http://assets.codeforces.com/files/surprize-language-round-5.7z
  • extract the contents using password fe8b058ca460d2 to folder C: — unfortunately, the executables of the compiler require it to be located in folder C:\OpenCobol
  • keep your source code in C:\OpenCobol as well, and compile them using compile.bat solution.cob

Surprise Language Round #5 will be held on February 22nd. It will continue the series of Unknown Language Rounds; we decided to replace the term “Unknown”, since we can’t really guarantee that the language of the round will be unknown to all participants, and the more rounds are there, the more probable it is that somebody has already seen one of the languages.

The rules will differ from the typical Codeforces Rounds:

  • This round will be unrated and it will use ACM ICPC rules.
  • It will have 5 problems, sorted by estimated complexity.
  • Solutions are accepted only in one language, which will be announced at the beginning of the contest. Please reread this post at the beginning of the contest.

The contest is intended to be relatively small and not as brain-taxing as my previous one — it’s a weekday, after all. Good luck!

Announcement of Surprise Language Round 5
  • Vote: I like it
  • +166
  • Vote: I do not like it

| Write comment?
»
13 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Hi I have a question. how I can learn the syntax and rules of that language in middle of the contest? is there any help in the contest?

thanks a lot. :)

  • »
    »
    13 years ago, # ^ |
      Vote: I like it +22 Vote: I do not like it

    The point of such contests is that you have to find the things you need to write the solutions yourself. You will be given the compiler/interpreter you have to use, and a very basic example of code, maybe a link to some more examples, but that's all, you'll have to find and explore any documentation you'll need on your own. The problems are simple so you need to care only about learning the language, not about figuring out the algorithm.

»
13 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

But... This is an existing language, or one created by yourself?

»
13 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Hi everybody

I didn’t know that I’m not allowed to post in a non-English language …

My Blog Post

I have only translated an English post to my native language and my Contribution is -55 now.

What I have to do ?

thanks.

»
13 years ago, # |
  Vote: I like it +12 Vote: I do not like it

Befunge was realy cool :)

»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What means "The round will be unrated" ? It won't affect our rating or what?

  • »
    »
    13 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Yes, it won't affect our rating, I think. Good Luck! :)

  • »
    »
    13 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Yes, it won't. It simply for fun.

»
13 years ago, # |
  Vote: I like it +1 Vote: I do not like it

what about linux users?will compiler be provided later during the contest?

»
13 years ago, # |
  Vote: I like it +2 Vote: I do not like it

What to do if I have windows that does not have visual studio c++, only have codeblocks IDE?

»
13 years ago, # |
Rev. 4   Vote: I like it -8 Vote: I do not like it

COBOL

ARE YOU KIDDING ME

»
13 years ago, # |
  Vote: I like it +43 Vote: I do not like it

The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense. (E. Dijkstra)

»
13 years ago, # |
  Vote: I like it +26 Vote: I do not like it

I feel sorry for the people that use COBOL for living :P

»
13 years ago, # |
  Vote: I like it +7 Vote: I do not like it

WHY C'S 14 FAILS ALL TIME?

RPU + 14 -> FDI

THE SECOND LINE IN THE INPUT IS OBVIOUS 0 NOT 14

  • »
    »
    13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    "Note that numeric variables are read into strings and then converted into numbers — this is explained by the compiler specifics which reads numbers in different ways depending on whether they are read from cosole or from file redirected to the program input stream."

    • »
      »
      »
      13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      thanks a lot I tested from 0 to 25 in my console with no problem

»
13 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Here is my code for problem A. gl & hf. :P

»
13 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Thanks for such a nice contest :)

I experienced a few annoying problems which I don't understand until now:

  1. Sometimes the compiler just doesn't work. I used windows. I had to restart cmd once every five minutes.

  2. Lots of "Error: syntax error, unexpected LITERAL, expecting EXTERNAL or GLOBAL". I tried to google but it didn't help.

Anyone experienced the same problems and understand how it happened? :)

  • »
    »
    13 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    I received that error (Error: syntax error, unexpected LITERAL, expecting EXTERNAL or GLOBAL) because i made a typo in a declaration

    I put 01 str X(15).

    But forgot to put the "pic":

    01 str pic X(15).

    I also looked for it on google, but didn't find much, some said that this error was caused by additional spaces, so i looked into that, and i noticed the missing pic keyword, which solved the issue.

    • »
      »
      »
      13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks. Seems like that was exactly what happened. During contest I was too frustrated and rewrote most of the codes :)) Cost me quite a lot of time :(

  • »
    »
    13 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    It tries to append something to your PATH each time you call it :) So eventually the PATH will become too long that Windows cannot process it.

»
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for the contest! At times it was a bit frustrating when I got lost in figuring out smaller details like removing the trailing zeros or concatenating strings without spaces in between. But I suppose that was to some extend intended :) Right now I have to admit that I would rather code in Befunge than in COBOL. There you have that really small set of possible operations which gives you the power to create complex structures (loops, etc.) yourself (which was fun) while COBOL provides all this — but you have to figure out what the right syntax is. This almost always took me longer than implementing it myself in Befunge last time.

»
13 years ago, # |
  Vote: I like it +3 Vote: I do not like it

COBOL just like COLLECTION, neither of them is easy to learn. :<

»
12 years ago, # |
Rev. 2   Vote: I like it -11 Vote: I do not like it

If any of you are interested in participating in an external surprise language contest, there is a contest starting tomorrow(3rd march) at 12:30 Gmt.

Contest Link: http://chaos.techkriti.org