Ich habe nur das unäre Plus anders verteilt (- 1 Zeichen) und die '1' nicht als Zeichen(kette) ausgegeben (- 1 Zeichen).
Here it is (84 Byte):
Code: Alles auswählen
print"P3 90 60 1"
for p in range(5400):c=(p%90-45)**2+(p/90-30)**2>324;print 1,+c,+c
Code: Alles auswählen
print"P3 90 60 1"
for p in range(5400):c=(p%90-45)**2+(p/90-30)**2>324;print 1,+c,+c
Code: Alles auswählen
print'P3 90 60 1'
for b in range(-30,30):
for c in range(-45,45):a=(b*b+c*c>324)+0;print'1',a,a
Code: Alles auswählen
s='P3 90 60 1'
for i in range(5400):x=i%90-45;y=i/90-30;s+=' 1'+' %i'%(x*x+y*y>324)*2
print s
Black JackBlackJack hat geschrieben:Also dann Leute, es ist Sonntag, High Noon. Zieht euren Colt, äh, Code.
und schönerlunar hat geschrieben:Black JackBlackJack hat geschrieben:Also dann Leute, es ist Sonntag, High Noon. Zieht euren Colt, äh, Code.
Der Geek, der schnell programmiert als sein Schatten
Darf ich das so vermarkten?
Da möchte ich einfach mal behaupten, dass dies in diesem Fall nicht so schwierig istLeonidas hat geschrieben:Und die Korrektheit der Programme muss auch noch formal bewiesen werden
Code: Alles auswählen
10 rem@ £protocol
12 rem@ £fastfor:£shortif:£constant w,h,cx,cy,r,sc,cr
14 rem@ £byte c=2:£word x=fast,y=fast,o:£integer xx,yy
100 ti$="000000"
105 w=40:h=25:cx=int(w/2):cy=int(h/2):r=int((w/4)^2):sc=1024:cr=55296
110 for y=0 to h-1:for x=0 to w-1
120 c=2:xx=x-cx:yy=y-cy:if xx*xx+yy*yy>=r then c=1
130 o=w*y+x:poke sc+o,81:poke cr+o,c:next x,y:print"{home}"ti$
150 goto 150
Code: Alles auswählen
#include <stdint.h>
#include <string.h>
#define WIDTH 40
#define HEIGHT 25
#define X_CENTER (WIDTH / 2)
#define Y_CENTER (HEIGHT / 2)
#define RADIUS (WIDTH / 4 * WIDTH / 4)
#define COLOR_WHITE 1
#define COLOR_RED 2
#define SCREEN_CODE 160
int main(void)
{
uint8_t x, y;
uint16_t xx, yy;
register uint8_t *color_ram = (void*) 0xd800;
memset((void*) 0x400, SCREEN_CODE, 1000);
for (y = 0; y < HEIGHT; ++y) {
for (x = 0; x < WIDTH; ++x) {
xx = x - X_CENTER;
yy = y - Y_CENTER;
*color_ram++ = (xx * xx + yy * yy >= RADIUS)
? COLOR_WHITE : COLOR_RED;
}
}
return 0;
}
Ich tippe mal stark auf "Nein", nachdem es mittlerweile vier 119 Bytes Lösungen gibt, die sich praktisch nicht unterscheiden. Die bisher einzige Python 3 Lösung mit 121 Bytes ist allerdings nicht die kürzest mögliche ...BlackJack hat geschrieben:@numerix: Bin ja mal gespannt, ob noch jemand mit einer Python 2.5 Lösung <119 Bytes kommt.