<< 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]
欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |