2017 Code Golf Challenge

A bit of fun (and possibly frustration!) for 2017...our monthly "code golf puzzle". Enjoy!

The Objective

Each month, find the shortest possible APL expression that evaluates to that month's given numerical targets* without using any of the digits 0-9 or the quote glyph ('). For example, numbers 0-2 can be obtained as follows:

   ⍴⍬
0

   ≢#
1

   ⍴⍬⍬
2

*Numerical targets are the week numbers for that month according to https://weeknumber.co.uk/calendar/england/2017.

The aim of code golf is to use as few characters as possible in each expression.

The Rules

  • Expressions must not contain the digits 0-9 or the quote glyph (').
  • Expressions must not rely on local conditions, for example, the operating system, the exact date/time or specific input from the user.
  • System variables can be used but must be set to the Dyalog default values – this includes ⎕ML and ⎕IO (the defaults for these are both 1)
  • Returned values can be scalar integers, one-element integer arrays or character vectors but must not include decimals (even ".0").
  • Non-redundant spaces are included in the character count.
  • Entries will be rated by the number of characters in the submission.
  • Entries for each month will only be accepted in that month. However, a summary of expressions for all months can be submitted in December for entry in the cumulative total part of the game.

If you have any questions or spot any loopholes/ambiguities, please email codegolf@dyalog.com.

Eligibility

Closing Date

Prizes

Anyone can enter. Monthly & 31 December 2017 Be immortalised in our 2017 Hall of Fame!

Submitting Your Entry

Email your expressions in a text file, Microsoft Excel file or workspace to codegolf@dyalog.com stating the version of Dyalog that you wrote/tested them on (don't forget to include your name).

2017 Hall of Fame

Best scores for monthly submissions (only includes those submitted in that month):

MonthGoalsNumber of Characters UsedName(s)
January 1, 2, 3, 4, 5 16 Michele Bellon, Veli-Matti Jantunen, Nick Nikolov
February 6, 7, 8, 9 17 Veli-Matti Jantunen, Nick Nikolov
March 10, 11, 12, 13 17 Veli-Matti Jantunen, Nick Nikolov
April 14, 15, 16, 17 21 Veli-Matti Jantunen, Nick Nikolov
May 18, 19, 20, 21, 22 25 Nick Nikolov
June 23, 24, 25, 26 19 Veli-Matti Jantunen, Nick Nikolov
July 27, 28, 29, 30, 31 25 Veli-Matti Jantunen, Nick Nikolov
August 32, 33, 34, 35 23 Roger Hui, Veli-Matti Jantunen, Nick Nikolov
September 36, 37, 38, 39 25 Veli-Matti Jantunen, Nick Nikolov
October 40, 41, 42, 43, 44 33 Nick Nikolov
November 45, 46, 47, 48 25 Roger Hui, Veli-Matti Jantunen, Nick Nikolov
December 49, 50, 51, 52 23 Veli-Matti Jantunen, Nick Nikolov, Jonas Stensiö

 

Cumulative scores for submissions for the entire year:

NameNumber of Characters Used
Nick Nikolov
Jonas Stensiö
269
Veli-Matti Jantunen 271
Giacomo Manfredi 290
Roger – Dyalog 294
Dragana Babić 314
Zachary Taylor 315

An amalgamation of all the entries showing the expressions that use the fewest characters for each number can be downloaded as a text file. Congratulations to Nick Nikolov and Jonas Stensiö, who both achieved the same character count (269), although neither managed to achieve the amalgamated minimum of 267. Of course, there could be shorter expressions out there...

Previous Years

2016