Create a Question Asker!

0

Writing questions for programming puzzles is tiring and takes many minutes to do. This is where you come in. Your job is to write a program that randomly generates plausible-sounding (but not necessarily interesting) code golf questions.

Input: None

Output: One sentence code golf question (see sentence structure)

Guidelines: No hardcoding. The questions don't have to be valid, solvable, or nontrivial. Creativity is encouraged. Voting is based on variety and bonus to programs that can create interesting problems.

Samples:

Find the sum of every even number from 1 to 100.
Create a funny sentence without punctuation.
Draw a picture of a cat in 3D.

Sentence structure:

[verb] [noun goal] [of] [noun specific] [preposition] [noun restriction]

qwr

Posted 2014-05-28T01:53:05.123

Reputation: 8 929

Question was closed 2014-05-28T05:17:00.070

Answers

11

NetLogo

to go
  type one-of [ "Print" "Calculate" "Find" "Determine" "Output" ]
  type " the "
  type one-of [ "sum" "mean" "average" "median" "standard deviation" "product" "geometric mean"]
  type " of all "
  type one-of [ "prime" "composite" "even" "odd" "perfect" "abundant" "deficient" "square" "triangular" "cubic" "lucky" "friendly" "strictly non-palindromic" ]
  type " numbers from "
  type random 100
  type " to "
  type 100 + random 10000
  type one-of [ " (inclusive)." " (exclusive)." ]
end

Sample output (obtained randomly):

Find the product of all friendly numbers from 60 to 3112 (inclusive).

Ypnypn

Posted 2014-05-28T01:53:05.123

Reputation: 10 485

1

C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
    srand(time(NULL));
    printf("Find the sum of every even number from 1 to %d.\n", rand());
    return 0;
}

On my computer it can generate 2147483648 different challenges.

user12205

Posted 2014-05-28T01:53:05.123

Reputation: 8 752

Hahaha. I love the simplicity (laziness?) of this one. Also, you can golf it so it's 50% #includes: delete int and return 0, NULL---> 0, text "sum of even numbers 1<x<%d?" – Level River St – 2014-05-28T16:31:36.613

0

Python

from random import randint as r
print "Draw a picture of a cat in %iD" % (r(2,4))

Harry Beadle

Posted 2014-05-28T01:53:05.123

Reputation: 787