Skip to content

Instantly share code, notes, and snippets.

0PR#3
7sp=int(30+(30*sin(x*3.14159/180))):PRINTspc(sp);"Hello World":x=x+15:goto7
/* Proof that there are no floating point errors when multiplying a double by zero.
* You're welcome, Downgoat
*/
int main(void)
{
double f;
for (f = 0; f < 10000; f += 0.000001)
if (f * 0)
printf("ERROR IN %f\n",f);
10 GR : POKE 49234,0
20 X = 20 : Y = 20
30 C = INT(RND(1) * 16)
40 COLOR = C : PLOT X,Y
50 IF RND(1) >= .9 THEN C = INT(RND(1) * 16)
60 X = X + INT(RND(1) * 3) - 1
70 Y = Y + INT(RND(1) * 3) - 1
80 IF X > 39 THEN X=0
90 IF X < 0 THEN X=39
100 IF Y > 47 THEN Y=0
010 GR
020 POKE 49234,0
030 COLOR= 15
040 FOR I = 0 TO 39
050 VLIN 0,47 AT I
060 NEXT
100 COLOR= 5
110 S = 21
120 W = S
130 H = 27
/* Here are some ways you can golf your program:
Line 11 (in this gist): remove space
Lines 54, 55, 59, 60, 64, 65 - did you count the newlines? They are unnecessary.
Line 69 - might as well change to "g.pgm" or just "g", the full filename and probably the extension are unnecessary. You could probably just include in the answer that it "creates a PGM file (without extension) called g"
Pretty much every line - I see you've got variables named 2-byte names such as m4, vc, xe, etc. Have you really used every single uppercase/lowercase single-byte variable name?
Line 53 - You've got a function `void xw`, can't you save a byte by making it `int` (or three by making it B) and never using the return value?
Line 61 - You've got a variable named `grid`, might as well change this to a one-byte name or at least two-byte
*/
#include<array>
1 GR:POKE-16302,0:I=0:O=15:P=1:Q=1:FORY=7TO47:I=I-1:IF(I<=0)THENI=7:READC:COLOR=C
2 IF(Y<21)THENO=O-((21-Y)/12):GOTO4
3 O=O+P-1:P=P*Q:Q=Q+0.002
4 HLINO,39-O ATY:NEXT:DATA12,13,9,1,3,6:COLOR=0:HLIN16,22 AT7:HLIN18,20 AT8:HLIN16,22 AT47:HLIN18,20 AT46:VLIN14,34 AT32:VLIN15,33AT 31:VLIN16,32 AT30:VLIN18,30 AT29:VLIN22,26 AT28:COLOR=12:FORA=0TO3:VLINA,A+4 AT22-A:NEXT
10 TEXT : HOME : PRINT "STD. DEV. = ";: INPUT s1
20 HGR : HCOLOR = 3
30 w = 279: h = 159
40 w0 = w - 100: w1 = w0/10
45 h1 = h - 100: h2 = h - 60
50 k = 0.5: m = 1 / (2 * 3.14159265 * s1 * s1)
60 FOR i = 0 TO 10 STEP k
70 x = 10 * i + 1: y = 10 * i + h1
75 HPLOT x,y
80 FOR j = 0 TO w0 STEP 1
#! /bin/bash
# C1R compiler
# remove HTML tags, but replace "<br />" by newlines
function removeHTMLtags() {
sed -e 's~<br */>~\
~g' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'
}
/* apparently I can't write a freaking string-reverse algorithm
stackoverflow.com/a/784567/6850771 */
char *reverse(char *str)
{
char tmp, *src, *dst;
size_t len;
if (str != NULL)
{
len = strlen (str);
if (len > 1) {
#include <stdlib.h>
#include "include/string.h"
const char *errlist[] = {
"no error (operation succeeded", /* 0 */
"not owner", /* EPERM */
"no such file or directory", /* ENOENT */
"no such process", /* ESRCH */
"interrupted system call", /* EINTR */
"I/O error", /* EIO */