数学建模社区-数学中国

标题: [求助]怎么用mathematic画一个五角星和国际象棋棋盘? [打印本页]

作者: heleilei1986    时间: 2008-3-19 18:12
标题: [求助]怎么用mathematic画一个五角星和国际象棋棋盘?
怎么用mathematic画一个五角星和国际象棋棋盘?谁能帮我,在里面直接回复也可以。或者把小程序直接发我的邮箱,394959454@qq.com 谢谢了。
作者: a1987001    时间: 2008-4-22 13:37

<< Graphics`Animation`

r1 = Table[Graphics[{Hue[0.1], Rectangle[{m, n}, {m + 1, n + 1}]}], {m, 0, 6, 2}, {n, 0, 6, 2}];
r2 = Table[Graphics[{Hue[0.1], Rectangle[{m + 1, n + 1}, {m + 2, n + 2}]}], {m, 0, 6, 2}, {n, 0, 6, 2}];
l = Graphics[Line[{{0, 0}, {1, 1}}]];Show[r1, r2, AspectRatio -> Automatic]颜色自己改

下面是象棋的,方法有点笨。

r1 = Graphics[{Hue[0.1], Rectangle[{0, 0}, {8, 9}]}];

l1 = Table[Graphics[Line[{{0, i}, {8, i}}]], {i, 0, 9, 1}];

l2 = Table[Graphics[Line[{{m, 0}, {m, 4}}]], {m, 0, 8, 1}];

l3 = Table[Graphics[Line[{{n, 5}, {n, 9}}]], {n, 0, 8, 1}];

l4 = Table[Graphics[Line[{{n, 4}, {n, 9}}]], {n, 0, 8, 8}];

l5 = Table[Graphics[Line[{{3, 0 + i}, {5, 2 + i}}]], {i, 0, 7, 7}];

l6 = Table[Graphics[Line[{{5, 0 + i}, {3, 2 + i}}]], {i, 0, 7, 7}];

t1 = Table[ Graphics[Text["车", {0 + m, 0 + n}, TextStyle :> 4], {RGBColor[0, 1, 1], Disk[{0, 0}, 1]}], {m, 0, 8, 8}, {n, 0, 9, 9}];

t2 = Table[ Graphics[Text["马", {1 + m, 0 + n}, TextStyle :> 4]], {m, 0, 6, 6}, {n, 0, 9, 9}];

t3 = Table[ Graphics[Text["相", {2 + m, 0 + n}, TextStyle :> 4]], {m, 0, 4, 4}, {n, 0, 9, 9}];t

4 = Table[ Graphics[Text["士", {3 + m, 0 + n}, TextStyle :> 4]], {m, 0, 2, 2}, {n, 0, 9, 9}];

t5 = Table[ Graphics[Text["帅", {4, 0 + n}, TextStyle :> 4]], {n, 0, 9, 9}];

t6 = Table[ Graphics[Text["炮", {1 + m, 2 + n}, TextStyle :> 4]], {m, 0, 6, 6}, {n, 0, 5, 5}];

t7 = Table[ Graphics[Text["兵", {0 + m, 3}, TextStyle :> 4]], {m, 0, 8, 2}];

t8 = Table[ Graphics[Text["卒", {0 + m, 6}, TextStyle :> 4]], {m, 0, 8, 2}];

Show[r1, l1, l2, l3, l4, l5, l6, t1, t2, t3, t4, t5, t6, t7, t8, AspectRatio -> Automatic]

6 l! [6 J* B8 }. I! B
[此贴子已经被作者于2008-4-22 13:39:48编辑过]

作者: a1987001    时间: 2008-4-22 13:41
直接从我作业中COPY的,所以上传的地方可能有些地方有错误。你修改一下就号了,一定是可以运行的
6 o; u) O8 k/ _& ~) V- O
[此贴子已经被作者于2008-4-22 13:41:34编辑过]

作者: heleilei1986    时间: 2008-4-22 18:32
谢谢了哦。。我还要在自己的机子上运行一下,呵呵。。




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5