Skip to main content
added 31 characters in body
Source Link
lynn
  • 69.2k
  • 27
  • 18

Use challenge types to compile a stripped-down "challenge format" to full-blown explanations

My original idea, which spurred Nathan to make this post, was a tool that converts such a type signature -- along with some metadata -- into a lengthy specification. The output would follows a clear template, explain all our default rules, include a leaderboard snippet, etc. Something like a "templating language" for PPCG challenges, that compiles to Markdown. I'd feed it something like

Int, Int -> AsciiArt

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

< 3 5
> XXX
> XXX
> XXX
> XXX
> XXX
< 10 2
> XXXXXXXXXX
> XXXXXXXXXX

and it would output

Task
====

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

Test cases
==========

Example input 1:

    3 5

Example output 1:

    XXX
    XXX
    XXX
    XXX
    XXX

Example input 2:

    10 2

Example output 2:

    XXXXXXXXXX
    XXXXXXXXXX

Rules
=====

* Your solution must be either a function/subroutine definition, or a full program.

* Your solution may receive input in the following ways:

  * Two integer function arguments.
  * Two command line arguments.
  * Two integers, in any reasonable string format, read from STDIN.
  * ...

* Your solution may produce output in the following ways:

  * Return/print an ASCII-art string, with newlines separating the rows.
  * Return/print a list of strings, each representing a row.
  * ...

* This is [tag:code-golf], so the shortest solution (in bytes) wins.

Use challenge types to compile a stripped-down "challenge format" to full-blown explanations

My original idea, which spurred Nathan to make this post, was a tool that converts such a type signature into a lengthy specification. The output would follows a clear template, explain all our default rules, include a leaderboard snippet, etc. Something like a "templating language" for PPCG challenges, that compiles to Markdown. I'd feed it something like

Int, Int -> AsciiArt

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

< 3 5
> XXX
> XXX
> XXX
> XXX
> XXX
< 10 2
> XXXXXXXXXX
> XXXXXXXXXX

and it would output

Task
====

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

Test cases
==========

Example input 1:

    3 5

Example output 1:

    XXX
    XXX
    XXX
    XXX
    XXX

Example input 2:

    10 2

Example output 2:

    XXXXXXXXXX
    XXXXXXXXXX

Rules
=====

* Your solution must be either a function/subroutine definition, or a full program.

* Your solution may receive input in the following ways:

  * Two integer function arguments.
  * Two command line arguments.
  * Two integers, in any reasonable string format, read from STDIN.
  * ...

* Your solution may produce output in the following ways:

  * Return/print an ASCII-art string, with newlines separating the rows.
  * Return/print a list of strings, each representing a row.
  * ...

* This is [tag:code-golf], so the shortest solution (in bytes) wins.

Use challenge types to compile a stripped-down "challenge format" to full-blown explanations

My original idea, which spurred Nathan to make this post, was a tool that converts such a type signature -- along with some metadata -- into a lengthy specification. The output would follows a clear template, explain all our default rules, include a leaderboard snippet, etc. Something like a "templating language" for PPCG challenges, that compiles to Markdown. I'd feed it something like

Int, Int -> AsciiArt

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

< 3 5
> XXX
> XXX
> XXX
> XXX
> XXX
< 10 2
> XXXXXXXXXX
> XXXXXXXXXX

and it would output

Task
====

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

Test cases
==========

Example input 1:

    3 5

Example output 1:

    XXX
    XXX
    XXX
    XXX
    XXX

Example input 2:

    10 2

Example output 2:

    XXXXXXXXXX
    XXXXXXXXXX

Rules
=====

* Your solution must be either a function/subroutine definition, or a full program.

* Your solution may receive input in the following ways:

  * Two integer function arguments.
  * Two command line arguments.
  * Two integers, in any reasonable string format, read from STDIN.
  * ...

* Your solution may produce output in the following ways:

  * Return/print an ASCII-art string, with newlines separating the rows.
  * Return/print a list of strings, each representing a row.
  * ...

* This is [tag:code-golf], so the shortest solution (in bytes) wins.
Source Link
lynn
  • 69.2k
  • 27
  • 18

Use challenge types to compile a stripped-down "challenge format" to full-blown explanations

My original idea, which spurred Nathan to make this post, was a tool that converts such a type signature into a lengthy specification. The output would follows a clear template, explain all our default rules, include a leaderboard snippet, etc. Something like a "templating language" for PPCG challenges, that compiles to Markdown. I'd feed it something like

Int, Int -> AsciiArt

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

< 3 5
> XXX
> XXX
> XXX
> XXX
> XXX
< 10 2
> XXXXXXXXXX
> XXXXXXXXXX

and it would output

Task
====

Given two positive integers **w** and **h**, print a **w** by **h** rectangle of `X`s.

Test cases
==========

Example input 1:

    3 5

Example output 1:

    XXX
    XXX
    XXX
    XXX
    XXX

Example input 2:

    10 2

Example output 2:

    XXXXXXXXXX
    XXXXXXXXXX

Rules
=====

* Your solution must be either a function/subroutine definition, or a full program.

* Your solution may receive input in the following ways:

  * Two integer function arguments.
  * Two command line arguments.
  * Two integers, in any reasonable string format, read from STDIN.
  * ...

* Your solution may produce output in the following ways:

  * Return/print an ASCII-art string, with newlines separating the rows.
  * Return/print a list of strings, each representing a row.
  * ...

* This is [tag:code-golf], so the shortest solution (in bytes) wins.