1 Line Challenge

From Esolang
Jump to navigation Jump to search

The 1 Line Challenge is a challenge started by Scratch-Minion in 2016. The objective is to create images defined in 1 line of code in Scratch.

Description

Examples are remixed from the original Scratch "project". Images are drawn from left to right and down to up, with the pen size set to 2 due to a bug in Scratch 2.0 that causes gaps in the image if the pen size is set to 1. The default resolution is 360x360, but the image can be expanded to fill the entire 480x360 canvas by modifying the Draw Row custom block to repeat 480 instead of 360 times and accordingly adjusting the x position from -180 to -240. The final image is expected to be used as the thumbnail. It can be generated using either of the two available "set pen color to" blocks:

  • The first features a range of rainbow colors, and is stated by the author to be easier. The Scratch 2.0 version supports rainbow colors from 0-200, while the Scratch 3.0 version dropped the maximum to 100 and added options for saturation, brightness and transparency, none of which are allowed.
  • The second allows for much more colors. The color has to be "picked" from the screen in Scratch 2.0, while Scratch 3.0 also allows for individually set "CSB" (Color Saturation Brightness) colors. This system is similar to HSV (Hue Saturation Value), but reduces the maximum color value from 0-360 to 0-100 due to limitations, while the other values remain at 0-100.

There are two official studios, the second of which, Not Quite a 1 Line Project, is for projects using additional blocks. 5 projects per user can be added per day unless the patterns are considered "nice". Images are specifically stated to be required to use more than 1 color, and not solely use a random number generator.

Sample programs

The original template is preloaded with the following sine wave example. The x and y position perimeters can be found in Motion, and the rest in Operators. As Scratch is a visual language, the example is presented here in Tosh, a text-based adaptation of Scratch.

180 * sin of x position - y position

External links