We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

GolfImage

From Esolang
Jump to navigation Jump to search

GolfImage is a vector image format inspired by the golfing languages, including an INT derivative (that being ShapeINT) suited for GolfImage. It was made in 2026 as a response to the fact that few languages exist with this purpose.

Syntax

Every GolfImage file begins with the header that outlines the width and height of the image. For example, H40W40 creates a 40x40 image. This acts as a grid for the file's components. Each line is a layer, with the highest lines being the lowest layers and vice versa. The shape's description begins with a capital letter, declaring the type.

  • R - rectangle
  • P - polygon
  • C - circle
  • L - line
  • S - shape

R is a rectangle, P is a regular polygon of n points, C is a circle/oval, L is a line segment, and S is a shape of which the points may be defined. In the case of the shape, the last declared point automatically draws back to the starting point, and hence it can shorten the file length. Filling in is not required, though it is a requirement that there is an outline. If you have failed to declare your colours, the shape takes on a black outline and blank filling.

After the shape has been declared, you can define its class using c:, which gives it a set of shared characteristics. After class, list its position on the grid of its top-left corner using p: to then list where it is in the format: p:20,30 where it is placed at (20, 30). Then, finish that with d: which lists dimensions in the same format as p. After dimensions, use o: for colours that are listed in RGB hex in the order of outline-filling. Hence, o:FFFFEE000000 gives a neon yellow outline with a black filling. Once that's done, you may begin writing code using ShapeINT.

With classes, they are defined at either the top or the bottom of the file and function like regular shapes in the same sense that the all-caps name begins the line and defines the functions and properties of the shapes under the class. All lines in GolfImage end in a semi-colon, except for headers; these end in colons. A file will always end in END to ensure no data has been lost during transfer.

ShapeINT

ShapeINT has the same functions as standard INT, with extra functions and states related to GolfImage. C determines whether it's true that the shape has just been clicked, H determines whether it's true that it's being hovered over, ; shifts the shape x and y spaces (e.g. ;2,3), ' changes its qualities (to change colour, do 'o000000FFFFFF, and the such), and \ changes the visibility of the shape. The code is encased in curly brackets, as they do not appear in INT and hence it cannot cause false positives. If \ has an argument after it, it switches to the scene named after what was passed through it.

Examples

Hello World:

H10W10:
	 HELLOp:5,5:d:1,1{*H[^"Hello World!"]-};
  Rc:HELLO;
END;

Fun Video Game:

H10W10:
  SCENE1:
    Rp:5,5d:1,1o:00000055FF55{*=Vx[*x]\SCENE2-};
  SCENE2:
    Rp:5,5d:1,1o:000000FF5555;
END;