File:Random go position.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Size of this preview: 600 × 600 pixels. Other resolutions: 240 × 240 pixels | 480 × 480 pixels | 768 × 768 pixels | 1,024 × 1,024 pixels | 2,497 × 2,497 pixels.
Original file (2,497 × 2,497 pixels, file size: 334 KB, MIME type: image/png)
File information
Structured data
Captions
A Go position, used to illustrate the rules of Go.
David Benbennick made it with the following Metapost program, modified slightly from the code at Image:Go position, life and death, 1.png:
scale=0.6in; % scale is the diameter of a stone linethickness = scale/25; pickup pencircle scaled linethickness; num = 150; % Levels of shading in each stone. color shadow; shadow = (0.44,0.36,0.18); lx = -0.35; ly = 0.35; lz = sqrt(1-lx*lx-ly*ly); % light source direction vector. % note that lz = cos(ltip). ltheta = angle(lx, ly); ltip = angle(lz, lx++ly); % the angle at which the light source is tipped. path ellipse; ellipse := fullcircle scaled scale xscaled lz; % First, we draw the black stone, and a special version for the bottom row: picture blackstone; blackstone = currentpicture; picture blackstoneb; blackstoneb = currentpicture; picture blackstoner; blackstoner = currentpicture; addto blackstone contour fullcircle scaled scale shifted (0.05*scale*dir(ltheta+180)) withcolor shadow; addto blackstoneb contour fullcircle scaled scale shifted (0.05*scale*dir(ltheta+180)) withcolor shadow; addto blackstoner contour fullcircle scaled scale shifted (0.05*scale*dir(ltheta+180)) withcolor shadow; addto blackstone doublepath (0.55*scale,0)--(0,0)--(0,-0.55*scale) withpen currentpen; addto blackstoneb doublepath (0.55*scale,0)--(0,0) withpen currentpen; addto blackstoner doublepath (0,-0.55*scale)--(0,0) withpen currentpen; addto blackstone contour fullcircle scaled scale; addto blackstoneb contour fullcircle scaled scale; addto blackstoner contour fullcircle scaled scale; for ratio = 1 step -1/num until 0 : path ourellipse; ourellipse = ellipse scaled ratio shifted (scale*(1+-+ratio)*sind(ltip)/2, 0) rotated ltheta; addto blackstone contour ourellipse withcolor (0.7*(1+-+ratio)**2*white); addto blackstoneb contour ourellipse withcolor (0.7*(1+-+ratio)**2*white); addto blackstoner contour ourellipse withcolor (0.7*(1+-+ratio)**2*white); endfor; % Next, we draw a white stone, and a special version for the bottom row: picture whitestone; whitestone = currentpicture; picture whitestoneb; whitestoneb = currentpicture; picture whitestoner; whitestoner = currentpicture; basewhite = 0.7; addto whitestone contour fullcircle scaled scale shifted (0.05*scale*dir(ltheta+180)) withcolor shadow; addto whitestoneb contour fullcircle scaled scale shifted (0.05*scale*dir(ltheta+180)) withcolor shadow; addto whitestoner contour fullcircle scaled scale shifted (0.05*scale*dir(ltheta+180)) withcolor shadow; addto whitestone doublepath (0.55*scale,0)--(0,0)--(0,-0.55*scale) withpen currentpen; addto whitestoneb doublepath (0.55*scale,0)--(0,0) withpen currentpen; addto whitestoner doublepath (0,-0.55*scale)--(0,0) withpen currentpen; addto whitestone contour fullcircle scaled scale withcolor (basewhite*white); addto whitestoneb contour fullcircle scaled scale withcolor (basewhite*white); addto whitestoner contour fullcircle scaled scale withcolor (basewhite*white); for ratio = 1 step -1/num until 0 : path ourellipse; ourellipse = ellipse scaled ratio shifted (scale*(1+-+ratio)*sind(ltip)/2, 0) rotated ltheta; addto whitestone contour ourellipse withcolor (basewhite + (1-basewhite)*((1+-+ratio)**4))*white; addto whitestoneb contour ourellipse withcolor (basewhite + (1-basewhite)*((1+-+ratio)**4))*white; addto whitestoner contour ourellipse withcolor (basewhite + (1-basewhite)*((1+-+ratio)**4))*white; endfor; boardwidth = 5; boardheight = 5; % a 5-by-5 positions of a go board. def drawboard = pickup pencircle scaled linethickness; fill unitsquare xscaled ((boardwidth+0.2)*scale) yscaled ((boardheight+0.2)*scale) shifted (-0.6*scale, -0.6scale) withcolor (0.86,0.70,0.36); for i = 0 upto boardwidth - 1 : draw (scale*i,0) -- (scale*i, (boardheight-1)*scale); endfor; for j = 0 upto boardheight - 1 : draw (0,scale*j) -- ((boardwidth-1)*scale,scale*j); endfor; enddef; def wh(expr x, y) = if y = 0 : draw whitestoneb shifted (x*scale, y*scale); elseif x = boardwidth - 1 : draw whitestoner shifted (x*scale, y*scale); else : draw whitestone shifted (x*scale, y*scale); fi; enddef; def bl(expr x, y) = if y = 0 : draw blackstoneb shifted (x*scale, y*scale); elseif x = boardwidth - 1 : draw blackstoner shifted (x*scale, y*scale); else : draw blackstone shifted (x*scale, y*scale); fi; enddef; def lab(expr num, x, y, color) = draw thelabel(num, (0, 0)) scaled (0.75*scale/10pt) shifted (x*scale, y*scale) withcolor color; enddef; beginfig(1); drawboard; bl(1,4);bl(4,4);bl(0,3);bl(1,3);wh(3,3);bl(4,3);wh(2,2);wh(0,1); wh(2,1);bl(3,1);wh(4,1);bl(1,0);wh(2,0);wh(3,0); currentpicture := currentpicture shifted (3in, 3in); endfig; end;
With the above code as Random_go_position.mp, run
mpost Random_go_position.mp convert -density 800 Random_go_position.1 Random_go_position.pnm pnmcrop Random_go_position.pnm | pnmtopng > Random_go_position.png.uncrush pngcrush -reduce -brute -l 9 Random_go_position.png.uncrush Random_go_position.png
to reproduce this image.
I, the copyright holder of this work, hereby publish it under the following licenses:
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. | ||
| ||
This licensing tag was added to this file as part of the GFDL licensing update.http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
This file is licensed under the Creative Commons Attribution-Share Alike 2.0 Generic license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
You may select the license of your choice.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 03:53, 18 February 2005 | 2,497 × 2,497 (334 KB) | Dbenbenn (talk | contribs) | made by me, {{GFDL}} |
You cannot overwrite this file.
File usage on Commons
The following page uses this file:
File usage on other wikis
The following other wikis use this file:
- Usage on hu.wikipedia.org
- Usage on ko.wikipedia.org