Adding some constraints
This commit is contained in:
parent
8c7f343ac7
commit
bfe994d35e
2 changed files with 5 additions and 3 deletions
1
lab9/1.c
1
lab9/1.c
|
@ -31,6 +31,7 @@ void draw_disks(FILE * file, int disks, int peg, int width, int y) {
|
||||||
*/
|
*/
|
||||||
void draw_pegs(FILE * file, int pegs, int width) {
|
void draw_pegs(FILE * file, int pegs, int width) {
|
||||||
if ( !pegs ) { return; } // exit function
|
if ( !pegs ) { return; } // exit function
|
||||||
|
if ( pegs > 10) { draw_pegs(file, 10, 70); }
|
||||||
fprintf(file, "<rect x=\"%d\" y=\"120\" width=\"15\" height=\"130\" "\
|
fprintf(file, "<rect x=\"%d\" y=\"120\" width=\"15\" height=\"130\" "\
|
||||||
"fill=\"firebrick\" />\r\n", width);
|
"fill=\"firebrick\" />\r\n", width);
|
||||||
draw_pegs(file, pegs - 1, width + 100);
|
draw_pegs(file, pegs - 1, width + 100);
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<rect x="70" y="120" width="15" height="130" fill="firebrick" />
|
<rect x="70" y="120" width="15" height="130" fill="firebrick" />
|
||||||
<rect x="170" y="120" width="15" height="130" fill="firebrick" />
|
<rect x="170" y="120" width="15" height="130" fill="firebrick" />
|
||||||
<rect x="270" y="120" width="15" height="130" fill="firebrick" />
|
<rect x="270" y="120" width="15" height="130" fill="firebrick" />
|
||||||
<rect x="240" y="230" width="80" height="20" fill="#ef8a48" stroke="black" stroke-width="1" />
|
<rect x="40" y="230" width="80" height="20" fill="#bbe200" stroke="black" stroke-width="1" />
|
||||||
<rect x="250" y="209" width="60" height="20" fill="#ba1d1e" stroke="black" stroke-width="1" />
|
<rect x="50" y="209" width="60" height="20" fill="#ef8a48" stroke="black" stroke-width="1" />
|
||||||
<rect x="258" y="188" width="45" height="20" fill="#ec8484" stroke="black" stroke-width="1" />
|
<rect x="58" y="188" width="45" height="20" fill="#149dca" stroke="black" stroke-width="1" />
|
||||||
|
<rect x="63" y="167" width="34" height="20" fill="#ba1d1e" stroke="black" stroke-width="1" />
|
||||||
</svg>
|
</svg>
|
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 708 B |
Loading…
Reference in a new issue