-
Notifications
You must be signed in to change notification settings - Fork 139
/
ludo.py
354 lines (285 loc) · 6.5 KB
/
ludo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
// C program to implement
// the above approach
#include <conio.h>
#include <graphics.h>
#include <stdio.h>
// Declaring Function used
// in this program
void red_corner();
void blue_corner();
void green_corner();
void yellow_corner();
void home();
void line_red_blue();
void line_green_yellow();
void line_red_green();
void line_yellow_blue();
// Driver Code
void main()
{
int gd = DETECT, gm;
// Initialize of gdriver with
// DETECT macros
initgraph(&gd, &gm, "C:\\turboc3\\bgi");
// Set Background Color
setfillstyle(SOLID_FILL, DARKGRAY);
floodfill(5, 5, 15);
// Main Outer Outline
rectangle(500, 200, 1250, 950);
// Main Inner Outline
rectangle(480, 180, 1270, 970);
// Coloring The Middle Space
setfillstyle(SOLID_FILL, BLACK);
floodfill(485, 185, 15);
// Calling red_corner() Function
red_corner();
// Calling blue_corner() Function
blue_corner();
// Calling green_corner() Function
green_corner();
// Calling yellow_corner() Function
yellow_corner();
// Calling home() Function
home();
// Calling line_red_blue() Function
line_red_blue();
// Calling line_green_yellow() Function
line_green_yellow();
// Calling line_red_green() Function
line_red_green();
// Calling line_yellow_blue() Function
line_yellow_blue();
// Holding The Screen For A While
getch();
// Close the initialized gdriver
closegraph();
}
void line_yellow_blue()
{
int x = 950;
// Vertical Divisions
line(950, 600, 1250, 600);
line(950, 550, 1250, 550);
// Loop for creating horizontal
// line and coloring
while (x < 1250) {
line(x, 500, x, 650);
setfillstyle(SOLID_FILL, BLUE);
floodfill(x + 2, 555, 15);
x = x + 50;
}
setfillstyle(SOLID_FILL, DARKGRAY);
floodfill(1240, 555, 15);
// Start Point
setfillstyle(SOLID_FILL, BLUE);
floodfill(1195, 605, 15);
circle(1175, 625, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(1180, 630, 15);
// Star Point
circle(1125, 525, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(1130, 530, 15);
// Home Decoration
line(950, 650, 910, 600);
line(950, 500, 910, 550);
setfillstyle(SOLID_FILL, BLUE);
floodfill(925, 575, 15);
}
void line_red_green()
{
int x = 500;
// Vertical Divisions
line(500, 600, 800, 600);
line(500, 550, 800, 550);
// Loop for creating horizontal
// line and coloring
while (x < 800) {
line(x, 500, x, 650);
setfillstyle(SOLID_FILL, GREEN);
floodfill(x + 2, 555, 15);
x = x + 50;
}
setfillstyle(SOLID_FILL, DARKGRAY);
floodfill(505, 555, 15);
// Start Point
setfillstyle(SOLID_FILL, GREEN);
floodfill(555, 505, 15);
circle(575, 525, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(580, 530, 15);
// Star Point
circle(625, 625, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(630, 630, 15);
// Home Decoration
line(800, 500, 840, 550);
line(800, 650, 840, 600);
setfillstyle(SOLID_FILL, GREEN);
floodfill(810, 575, 15);
}
void line_red_blue()
{
int x = 650;
// Vertical Divisions
line(850, 650, 850, 950);
line(900, 650, 900, 950);
// Loop for creating horizontal
// line and coloring
while (x <= 900) {
line(800, x, 950, x);
setfillstyle(SOLID_FILL, RED);
floodfill(855, x + 2, 15);
x = x + 50;
}
setfillstyle(SOLID_FILL, DARKGRAY);
floodfill(855, 940, 15);
// Start point
setfillstyle(SOLID_FILL, RED);
floodfill(805, 895, 15);
circle(825, 875, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(830, 880, 15);
// Star Point
circle(925, 825, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(930, 830, 15);
// Home Decoration
line(800, 650, 840, 600);
line(950, 650, 910, 600);
setfillstyle(SOLID_FILL, RED);
floodfill(885, 615, 15);
}
void line_green_yellow()
{
int x = 200;
// Vertical Divisions
line(850, 200, 850, 500);
line(900, 200, 900, 500);
// Loop for creating horizontal
// line and coloring
while (x < 500) {
line(800, x, 950, x);
setfillstyle(SOLID_FILL, YELLOW);
floodfill(855, x + 2, 15);
x = x + 50;
}
setfillstyle(SOLID_FILL, DARKGRAY);
floodfill(855, 205, 15);
// Start Point
setfillstyle(SOLID_FILL, YELLOW);
floodfill(905, 255, 15);
circle(925, 275, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(930, 280, 15);
// Star Point
circle(825, 325, 10);
setfillstyle(SOLID_FILL, WHITE);
floodfill(830, 330, 15);
// Home Decoration
line(800, 500, 840, 550);
line(950, 500, 910, 550);
setfillstyle(SOLID_FILL, YELLOW);
floodfill(885, 545, 15);
}
void red_corner()
{
// Outer Line
rectangle(500, 650, 800, 950);
// Inner Line
rectangle(550, 700, 750, 900);
// Circles
circle(600, 750, 30);
circle(700, 750, 30);
circle(600, 850, 30);
circle(700, 850, 30);
setfillstyle(SOLID_FILL, RED);
// Rectangle Red
floodfill(505, 655, 15);
// Circle Red
floodfill(615, 765, 15);
floodfill(715, 765, 15);
floodfill(615, 865, 15);
floodfill(715, 865, 15);
setfillstyle(SOLID_FILL, WHITE);
floodfill(555, 705, 15);
}
void blue_corner()
{
// Outer Line
rectangle(950, 650, 1250, 950);
// Inner Line
rectangle(1000, 700, 1200, 900);
// Circles
circle(1050, 750, 30);
circle(1150, 750, 30);
circle(1050, 850, 30);
circle(1150, 850, 30);
setfillstyle(SOLID_FILL, BLUE);
// Rectangle Blue
floodfill(955, 655, 15);
// Circle Blue
floodfill(1065, 765, 15);
floodfill(1165, 765, 15);
floodfill(1065, 865, 15);
floodfill(1165, 865, 15);
setfillstyle(SOLID_FILL, WHITE);
floodfill(1005, 705, 15);
}
void green_corner()
{
// Outer Line
rectangle(500, 200, 800, 500);
// Inner Line
rectangle(550, 250, 750, 450);
// Circles
circle(600, 300, 30);
circle(700, 300, 30);
circle(600, 400, 30);
circle(700, 400, 30);
setfillstyle(SOLID_FILL, GREEN);
// Rectangle Green
floodfill(505, 215, 15);
// Circle Green
floodfill(615, 315, 15);
floodfill(715, 315, 15);
floodfill(615, 415, 15);
floodfill(715, 415, 15);
setfillstyle(SOLID_FILL, WHITE);
floodfill(555, 255, 15);
}
void yellow_corner()
{
// Outer Line
rectangle(950, 200, 1250, 500);
// Inner Line
rectangle(1000, 250, 1200, 450);
// Circles
circle(1050, 300, 30);
circle(1150, 300, 30);
circle(1050, 400, 30);
circle(1150, 400, 30);
setfillstyle(SOLID_FILL, YELLOW);
// Rectangle Yellow
floodfill(955, 215, 15);
// Circle Yellow
floodfill(1065, 315, 15);
floodfill(1165, 315, 15);
floodfill(1065, 415, 15);
floodfill(1165, 415, 15);
setfillstyle(SOLID_FILL, WHITE);
floodfill(1005, 255, 15);
}
void home()
{
// Outer Line
rectangle(800, 500, 950, 650);
// Inner Line
rectangle(840, 550, 910, 600);
// Coloring Middle Space Black
setfillstyle(SOLID_FILL, BLACK);
floodfill(860, 595, 15);
// Printing The Text 'HOME'
settextstyle(8, 0, 3);
outtextxy(848, 560, "HOME");
}