1# asciixmas 2# December 1989 Larry Bartz Indianapolis, IN 3# 4# $Id$ 5# 6# I'm dreaming of an ascii character-based monochrome Christmas, 7# Just like the ones I used to know! 8# Via a full duplex communications channel, 9# At 9600 bits per second, 10# Even though it's kinda slow. 11# 12# I'm dreaming of an ascii character-based monochrome Christmas, 13# With ev'ry C program I write! 14# May your screen be merry and bright! 15# And may all your Christmases be amber or green, 16# (for reduced eyestrain and improved visibility)! 17# 18# 19# Notes on the Python version: 20# I used a couple of `try...except curses.error' to get around some functions 21# returning ERR. The errors come from using wrapping functions to fill 22# windows to the last character cell. The C version doesn't have this problem, 23# it simply ignores any return values. 24# 25 26import curses 27import sys 28 29FROMWHO = "Thomas Gellekum <tg@FreeBSD.org>" 30 31def set_color(win, color): 32 if curses.has_colors(): 33 n = color + 1 34 curses.init_pair(n, color, my_bg) 35 win.attroff(curses.A_COLOR) 36 win.attron(curses.color_pair(n)) 37 38def unset_color(win): 39 if curses.has_colors(): 40 win.attrset(curses.color_pair(0)) 41 42def look_out(msecs): 43 curses.napms(msecs) 44 if stdscr.getch() != -1: 45 curses.beep() 46 sys.exit(0) 47 48def boxit(): 49 for y in range(0, 20): 50 stdscr.addch(y, 7, ord('|')) 51 52 for x in range(8, 80): 53 stdscr.addch(19, x, ord('_')) 54 55 for x in range(0, 80): 56 stdscr.addch(22, x, ord('_')) 57 58 return 59 60def seas(): 61 stdscr.addch(4, 1, ord('S')) 62 stdscr.addch(6, 1, ord('E')) 63 stdscr.addch(8, 1, ord('A')) 64 stdscr.addch(10, 1, ord('S')) 65 stdscr.addch(12, 1, ord('O')) 66 stdscr.addch(14, 1, ord('N')) 67 stdscr.addch(16, 1, ord("'")) 68 stdscr.addch(18, 1, ord('S')) 69 70 return 71 72def greet(): 73 stdscr.addch(3, 5, ord('G')) 74 stdscr.addch(5, 5, ord('R')) 75 stdscr.addch(7, 5, ord('E')) 76 stdscr.addch(9, 5, ord('E')) 77 stdscr.addch(11, 5, ord('T')) 78 stdscr.addch(13, 5, ord('I')) 79 stdscr.addch(15, 5, ord('N')) 80 stdscr.addch(17, 5, ord('G')) 81 stdscr.addch(19, 5, ord('S')) 82 83 return 84 85def fromwho(): 86 stdscr.addstr(21, 13, FROMWHO) 87 return 88 89def tree(): 90 set_color(treescrn, curses.COLOR_GREEN) 91 treescrn.addch(1, 11, ord('/')) 92 treescrn.addch(2, 11, ord('/')) 93 treescrn.addch(3, 10, ord('/')) 94 treescrn.addch(4, 9, ord('/')) 95 treescrn.addch(5, 9, ord('/')) 96 treescrn.addch(6, 8, ord('/')) 97 treescrn.addch(7, 7, ord('/')) 98 treescrn.addch(8, 6, ord('/')) 99 treescrn.addch(9, 6, ord('/')) 100 treescrn.addch(10, 5, ord('/')) 101 treescrn.addch(11, 3, ord('/')) 102 treescrn.addch(12, 2, ord('/')) 103 104 treescrn.addch(1, 13, ord('\\')) 105 treescrn.addch(2, 13, ord('\\')) 106 treescrn.addch(3, 14, ord('\\')) 107 treescrn.addch(4, 15, ord('\\')) 108 treescrn.addch(5, 15, ord('\\')) 109 treescrn.addch(6, 16, ord('\\')) 110 treescrn.addch(7, 17, ord('\\')) 111 treescrn.addch(8, 18, ord('\\')) 112 treescrn.addch(9, 18, ord('\\')) 113 treescrn.addch(10, 19, ord('\\')) 114 treescrn.addch(11, 21, ord('\\')) 115 treescrn.addch(12, 22, ord('\\')) 116 117 treescrn.addch(4, 10, ord('_')) 118 treescrn.addch(4, 14, ord('_')) 119 treescrn.addch(8, 7, ord('_')) 120 treescrn.addch(8, 17, ord('_')) 121 122 treescrn.addstr(13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\") 123 124 treescrn.addstr(14, 11, "| |") 125 treescrn.addstr(15, 11, "|_|") 126 127 unset_color(treescrn) 128 treescrn.refresh() 129 w_del_msg.refresh() 130 131 return 132 133def balls(): 134 treescrn.overlay(treescrn2) 135 136 set_color(treescrn2, curses.COLOR_BLUE) 137 treescrn2.addch(3, 9, ord('@')) 138 treescrn2.addch(3, 15, ord('@')) 139 treescrn2.addch(4, 8, ord('@')) 140 treescrn2.addch(4, 16, ord('@')) 141 treescrn2.addch(5, 7, ord('@')) 142 treescrn2.addch(5, 17, ord('@')) 143 treescrn2.addch(7, 6, ord('@')) 144 treescrn2.addch(7, 18, ord('@')) 145 treescrn2.addch(8, 5, ord('@')) 146 treescrn2.addch(8, 19, ord('@')) 147 treescrn2.addch(10, 4, ord('@')) 148 treescrn2.addch(10, 20, ord('@')) 149 treescrn2.addch(11, 2, ord('@')) 150 treescrn2.addch(11, 22, ord('@')) 151 treescrn2.addch(12, 1, ord('@')) 152 treescrn2.addch(12, 23, ord('@')) 153 154 unset_color(treescrn2) 155 treescrn2.refresh() 156 w_del_msg.refresh() 157 return 158 159def star(): 160 treescrn2.attrset(curses.A_BOLD | curses.A_BLINK) 161 set_color(treescrn2, curses.COLOR_YELLOW) 162 163 treescrn2.addch(0, 12, ord('*')) 164 treescrn2.standend() 165 166 unset_color(treescrn2) 167 treescrn2.refresh() 168 w_del_msg.refresh() 169 return 170 171def strng1(): 172 treescrn2.attrset(curses.A_BOLD | curses.A_BLINK) 173 set_color(treescrn2, curses.COLOR_WHITE) 174 175 treescrn2.addch(3, 13, ord('\'')) 176 treescrn2.addch(3, 12, ord(':')) 177 treescrn2.addch(3, 11, ord('.')) 178 179 treescrn2.attroff(curses.A_BOLD | curses.A_BLINK) 180 unset_color(treescrn2) 181 182 treescrn2.refresh() 183 w_del_msg.refresh() 184 return 185 186def strng2(): 187 treescrn2.attrset(curses.A_BOLD | curses.A_BLINK) 188 set_color(treescrn2, curses.COLOR_WHITE) 189 190 treescrn2.addch(5, 14, ord('\'')) 191 treescrn2.addch(5, 13, ord(':')) 192 treescrn2.addch(5, 12, ord('.')) 193 treescrn2.addch(5, 11, ord(',')) 194 treescrn2.addch(6, 10, ord('\'')) 195 treescrn2.addch(6, 9, ord(':')) 196 197 treescrn2.attroff(curses.A_BOLD | curses.A_BLINK) 198 unset_color(treescrn2) 199 200 treescrn2.refresh() 201 w_del_msg.refresh() 202 return 203 204def strng3(): 205 treescrn2.attrset(curses.A_BOLD | curses.A_BLINK) 206 set_color(treescrn2, curses.COLOR_WHITE) 207 208 treescrn2.addch(7, 16, ord('\'')) 209 treescrn2.addch(7, 15, ord(':')) 210 treescrn2.addch(7, 14, ord('.')) 211 treescrn2.addch(7, 13, ord(',')) 212 treescrn2.addch(8, 12, ord('\'')) 213 treescrn2.addch(8, 11, ord(':')) 214 treescrn2.addch(8, 10, ord('.')) 215 treescrn2.addch(8, 9, ord(',')) 216 217 treescrn2.attroff(curses.A_BOLD | curses.A_BLINK) 218 unset_color(treescrn2) 219 220 treescrn2.refresh() 221 w_del_msg.refresh() 222 return 223 224def strng4(): 225 treescrn2.attrset(curses.A_BOLD | curses.A_BLINK) 226 set_color(treescrn2, curses.COLOR_WHITE) 227 228 treescrn2.addch(9, 17, ord('\'')) 229 treescrn2.addch(9, 16, ord(':')) 230 treescrn2.addch(9, 15, ord('.')) 231 treescrn2.addch(9, 14, ord(',')) 232 treescrn2.addch(10, 13, ord('\'')) 233 treescrn2.addch(10, 12, ord(':')) 234 treescrn2.addch(10, 11, ord('.')) 235 treescrn2.addch(10, 10, ord(',')) 236 treescrn2.addch(11, 9, ord('\'')) 237 treescrn2.addch(11, 8, ord(':')) 238 treescrn2.addch(11, 7, ord('.')) 239 treescrn2.addch(11, 6, ord(',')) 240 treescrn2.addch(12, 5, ord('\'')) 241 242 treescrn2.attroff(curses.A_BOLD | curses.A_BLINK) 243 unset_color(treescrn2) 244 245 treescrn2.refresh() 246 w_del_msg.refresh() 247 return 248 249def strng5(): 250 treescrn2.attrset(curses.A_BOLD | curses.A_BLINK) 251 set_color(treescrn2, curses.COLOR_WHITE) 252 253 treescrn2.addch(11, 19, ord('\'')) 254 treescrn2.addch(11, 18, ord(':')) 255 treescrn2.addch(11, 17, ord('.')) 256 treescrn2.addch(11, 16, ord(',')) 257 treescrn2.addch(12, 15, ord('\'')) 258 treescrn2.addch(12, 14, ord(':')) 259 treescrn2.addch(12, 13, ord('.')) 260 treescrn2.addch(12, 12, ord(',')) 261 262 treescrn2.attroff(curses.A_BOLD | curses.A_BLINK) 263 unset_color(treescrn2) 264 265 # save a fully lit tree 266 treescrn2.overlay(treescrn) 267 268 treescrn2.refresh() 269 w_del_msg.refresh() 270 return 271 272def blinkit(): 273 treescrn8.touchwin() 274 275 for cycle in range(5): 276 if cycle == 0: 277 treescrn3.overlay(treescrn8) 278 treescrn8.refresh() 279 w_del_msg.refresh() 280 break 281 elif cycle == 1: 282 treescrn4.overlay(treescrn8) 283 treescrn8.refresh() 284 w_del_msg.refresh() 285 break 286 elif cycle == 2: 287 treescrn5.overlay(treescrn8) 288 treescrn8.refresh() 289 w_del_msg.refresh() 290 break 291 elif cycle == 3: 292 treescrn6.overlay(treescrn8) 293 treescrn8.refresh() 294 w_del_msg.refresh() 295 break 296 elif cycle == 4: 297 treescrn7.overlay(treescrn8) 298 treescrn8.refresh() 299 w_del_msg.refresh() 300 break 301 302 treescrn8.touchwin() 303 304 # ALL ON 305 treescrn.overlay(treescrn8) 306 treescrn8.refresh() 307 w_del_msg.refresh() 308 309 return 310 311def deer_step(win, y, x): 312 win.mvwin(y, x) 313 win.refresh() 314 w_del_msg.refresh() 315 look_out(5) 316 317def reindeer(): 318 y_pos = 0 319 320 for x_pos in range(70, 62, -1): 321 if x_pos < 66: y_pos = 1 322 for looper in range(0, 4): 323 dotdeer0.addch(y_pos, x_pos, ord('.')) 324 dotdeer0.refresh() 325 w_del_msg.refresh() 326 dotdeer0.erase() 327 dotdeer0.refresh() 328 w_del_msg.refresh() 329 look_out(50) 330 331 y_pos = 2 332 333 for x_pos in range(x_pos - 1, 50, -1): 334 for looper in range(0, 4): 335 if x_pos < 56: 336 y_pos = 3 337 338 try: 339 stardeer0.addch(y_pos, x_pos, ord('*')) 340 except curses.error: 341 pass 342 stardeer0.refresh() 343 w_del_msg.refresh() 344 stardeer0.erase() 345 stardeer0.refresh() 346 w_del_msg.refresh() 347 else: 348 dotdeer0.addch(y_pos, x_pos, ord('*')) 349 dotdeer0.refresh() 350 w_del_msg.refresh() 351 dotdeer0.erase() 352 dotdeer0.refresh() 353 w_del_msg.refresh() 354 355 x_pos = 58 356 357 for y_pos in range(2, 5): 358 lildeer0.touchwin() 359 lildeer0.refresh() 360 w_del_msg.refresh() 361 362 for looper in range(0, 4): 363 deer_step(lildeer3, y_pos, x_pos) 364 deer_step(lildeer2, y_pos, x_pos) 365 deer_step(lildeer1, y_pos, x_pos) 366 deer_step(lildeer2, y_pos, x_pos) 367 deer_step(lildeer3, y_pos, x_pos) 368 369 lildeer0.touchwin() 370 lildeer0.refresh() 371 w_del_msg.refresh() 372 373 x_pos -= 2 374 375 x_pos = 35 376 377 for y_pos in range(5, 10): 378 379 middeer0.touchwin() 380 middeer0.refresh() 381 w_del_msg.refresh() 382 383 for looper in range(2): 384 deer_step(middeer3, y_pos, x_pos) 385 deer_step(middeer2, y_pos, x_pos) 386 deer_step(middeer1, y_pos, x_pos) 387 deer_step(middeer2, y_pos, x_pos) 388 deer_step(middeer3, y_pos, x_pos) 389 390 middeer0.touchwin() 391 middeer0.refresh() 392 w_del_msg.refresh() 393 394 x_pos -= 3 395 396 look_out(300) 397 398 y_pos = 1 399 400 for x_pos in range(8, 16): 401 deer_step(bigdeer4, y_pos, x_pos) 402 deer_step(bigdeer3, y_pos, x_pos) 403 deer_step(bigdeer2, y_pos, x_pos) 404 deer_step(bigdeer1, y_pos, x_pos) 405 deer_step(bigdeer2, y_pos, x_pos) 406 deer_step(bigdeer3, y_pos, x_pos) 407 deer_step(bigdeer4, y_pos, x_pos) 408 deer_step(bigdeer0, y_pos, x_pos) 409 410 x_pos -= 1 411 412 for looper in range(0, 6): 413 deer_step(lookdeer4, y_pos, x_pos) 414 deer_step(lookdeer3, y_pos, x_pos) 415 deer_step(lookdeer2, y_pos, x_pos) 416 deer_step(lookdeer1, y_pos, x_pos) 417 deer_step(lookdeer2, y_pos, x_pos) 418 deer_step(lookdeer3, y_pos, x_pos) 419 deer_step(lookdeer4, y_pos, x_pos) 420 421 deer_step(lookdeer0, y_pos, x_pos) 422 423 for y_pos in range(y_pos, 10): 424 for looper in range(0, 2): 425 deer_step(bigdeer4, y_pos, x_pos) 426 deer_step(bigdeer3, y_pos, x_pos) 427 deer_step(bigdeer2, y_pos, x_pos) 428 deer_step(bigdeer1, y_pos, x_pos) 429 deer_step(bigdeer2, y_pos, x_pos) 430 deer_step(bigdeer3, y_pos, x_pos) 431 deer_step(bigdeer4, y_pos, x_pos) 432 deer_step(bigdeer0, y_pos, x_pos) 433 434 y_pos -= 1 435 436 deer_step(lookdeer3, y_pos, x_pos) 437 return 438 439def main(win): 440 global stdscr 441 stdscr = win 442 443 global my_bg, y_pos, x_pos 444 global treescrn, treescrn2, treescrn3, treescrn4 445 global treescrn5, treescrn6, treescrn7, treescrn8 446 global dotdeer0, stardeer0 447 global lildeer0, lildeer1, lildeer2, lildeer3 448 global middeer0, middeer1, middeer2, middeer3 449 global bigdeer0, bigdeer1, bigdeer2, bigdeer3, bigdeer4 450 global lookdeer0, lookdeer1, lookdeer2, lookdeer3, lookdeer4 451 global w_holiday, w_del_msg 452 453 my_bg = curses.COLOR_BLACK 454 # curses.curs_set(0) 455 456 treescrn = curses.newwin(16, 27, 3, 53) 457 treescrn2 = curses.newwin(16, 27, 3, 53) 458 treescrn3 = curses.newwin(16, 27, 3, 53) 459 treescrn4 = curses.newwin(16, 27, 3, 53) 460 treescrn5 = curses.newwin(16, 27, 3, 53) 461 treescrn6 = curses.newwin(16, 27, 3, 53) 462 treescrn7 = curses.newwin(16, 27, 3, 53) 463 treescrn8 = curses.newwin(16, 27, 3, 53) 464 465 dotdeer0 = curses.newwin(3, 71, 0, 8) 466 467 stardeer0 = curses.newwin(4, 56, 0, 8) 468 469 lildeer0 = curses.newwin(7, 53, 0, 8) 470 lildeer1 = curses.newwin(2, 4, 0, 0) 471 lildeer2 = curses.newwin(2, 4, 0, 0) 472 lildeer3 = curses.newwin(2, 4, 0, 0) 473 474 middeer0 = curses.newwin(15, 42, 0, 8) 475 middeer1 = curses.newwin(3, 7, 0, 0) 476 middeer2 = curses.newwin(3, 7, 0, 0) 477 middeer3 = curses.newwin(3, 7, 0, 0) 478 479 bigdeer0 = curses.newwin(10, 23, 0, 0) 480 bigdeer1 = curses.newwin(10, 23, 0, 0) 481 bigdeer2 = curses.newwin(10, 23, 0, 0) 482 bigdeer3 = curses.newwin(10, 23, 0, 0) 483 bigdeer4 = curses.newwin(10, 23, 0, 0) 484 485 lookdeer0 = curses.newwin(10, 25, 0, 0) 486 lookdeer1 = curses.newwin(10, 25, 0, 0) 487 lookdeer2 = curses.newwin(10, 25, 0, 0) 488 lookdeer3 = curses.newwin(10, 25, 0, 0) 489 lookdeer4 = curses.newwin(10, 25, 0, 0) 490 491 w_holiday = curses.newwin(1, 27, 3, 27) 492 493 w_del_msg = curses.newwin(1, 20, 23, 60) 494 495 try: 496 w_del_msg.addstr(0, 0, "Hit any key to quit") 497 except curses.error: 498 pass 499 500 try: 501 w_holiday.addstr(0, 0, "H A P P Y H O L I D A Y S") 502 except curses.error: 503 pass 504 505 # set up the windows for our various reindeer 506 lildeer1.addch(0, 0, ord('V')) 507 lildeer1.addch(1, 0, ord('@')) 508 lildeer1.addch(1, 1, ord('<')) 509 lildeer1.addch(1, 2, ord('>')) 510 try: 511 lildeer1.addch(1, 3, ord('~')) 512 except curses.error: 513 pass 514 515 lildeer2.addch(0, 0, ord('V')) 516 lildeer2.addch(1, 0, ord('@')) 517 lildeer2.addch(1, 1, ord('|')) 518 lildeer2.addch(1, 2, ord('|')) 519 try: 520 lildeer2.addch(1, 3, ord('~')) 521 except curses.error: 522 pass 523 524 lildeer3.addch(0, 0, ord('V')) 525 lildeer3.addch(1, 0, ord('@')) 526 lildeer3.addch(1, 1, ord('>')) 527 lildeer3.addch(1, 2, ord('<')) 528 try: 529 lildeer2.addch(1, 3, ord('~')) # XXX 530 except curses.error: 531 pass 532 533 middeer1.addch(0, 2, ord('y')) 534 middeer1.addch(0, 3, ord('y')) 535 middeer1.addch(1, 2, ord('0')) 536 middeer1.addch(1, 3, ord('(')) 537 middeer1.addch(1, 4, ord('=')) 538 middeer1.addch(1, 5, ord(')')) 539 middeer1.addch(1, 6, ord('~')) 540 middeer1.addch(2, 3, ord('\\')) 541 middeer1.addch(2, 5, ord('/')) 542 543 middeer2.addch(0, 2, ord('y')) 544 middeer2.addch(0, 3, ord('y')) 545 middeer2.addch(1, 2, ord('0')) 546 middeer2.addch(1, 3, ord('(')) 547 middeer2.addch(1, 4, ord('=')) 548 middeer2.addch(1, 5, ord(')')) 549 middeer2.addch(1, 6, ord('~')) 550 middeer2.addch(2, 3, ord('|')) 551 middeer2.addch(2, 5, ord('|')) 552 553 middeer3.addch(0, 2, ord('y')) 554 middeer3.addch(0, 3, ord('y')) 555 middeer3.addch(1, 2, ord('0')) 556 middeer3.addch(1, 3, ord('(')) 557 middeer3.addch(1, 4, ord('=')) 558 middeer3.addch(1, 5, ord(')')) 559 middeer3.addch(1, 6, ord('~')) 560 middeer3.addch(2, 3, ord('/')) 561 middeer3.addch(2, 5, ord('\\')) 562 563 bigdeer1.addch(0, 17, ord('\\')) 564 bigdeer1.addch(0, 18, ord('/')) 565 bigdeer1.addch(0, 19, ord('\\')) 566 bigdeer1.addch(0, 20, ord('/')) 567 bigdeer1.addch(1, 18, ord('\\')) 568 bigdeer1.addch(1, 20, ord('/')) 569 bigdeer1.addch(2, 19, ord('|')) 570 bigdeer1.addch(2, 20, ord('_')) 571 bigdeer1.addch(3, 18, ord('/')) 572 bigdeer1.addch(3, 19, ord('^')) 573 bigdeer1.addch(3, 20, ord('0')) 574 bigdeer1.addch(3, 21, ord('\\')) 575 bigdeer1.addch(4, 17, ord('/')) 576 bigdeer1.addch(4, 18, ord('/')) 577 bigdeer1.addch(4, 19, ord('\\')) 578 bigdeer1.addch(4, 22, ord('\\')) 579 bigdeer1.addstr(5, 7, "^~~~~~~~~// ~~U") 580 bigdeer1.addstr(6, 7, "( \\_____( /") # )) 581 bigdeer1.addstr(7, 8, "( ) /") 582 bigdeer1.addstr(8, 9, "\\\\ /") 583 bigdeer1.addstr(9, 11, "\\>/>") 584 585 bigdeer2.addch(0, 17, ord('\\')) 586 bigdeer2.addch(0, 18, ord('/')) 587 bigdeer2.addch(0, 19, ord('\\')) 588 bigdeer2.addch(0, 20, ord('/')) 589 bigdeer2.addch(1, 18, ord('\\')) 590 bigdeer2.addch(1, 20, ord('/')) 591 bigdeer2.addch(2, 19, ord('|')) 592 bigdeer2.addch(2, 20, ord('_')) 593 bigdeer2.addch(3, 18, ord('/')) 594 bigdeer2.addch(3, 19, ord('^')) 595 bigdeer2.addch(3, 20, ord('0')) 596 bigdeer2.addch(3, 21, ord('\\')) 597 bigdeer2.addch(4, 17, ord('/')) 598 bigdeer2.addch(4, 18, ord('/')) 599 bigdeer2.addch(4, 19, ord('\\')) 600 bigdeer2.addch(4, 22, ord('\\')) 601 bigdeer2.addstr(5, 7, "^~~~~~~~~// ~~U") 602 bigdeer2.addstr(6, 7, "(( )____( /") # )) 603 bigdeer2.addstr(7, 7, "( / |") 604 bigdeer2.addstr(8, 8, "\\/ |") 605 bigdeer2.addstr(9, 9, "|> |>") 606 607 bigdeer3.addch(0, 17, ord('\\')) 608 bigdeer3.addch(0, 18, ord('/')) 609 bigdeer3.addch(0, 19, ord('\\')) 610 bigdeer3.addch(0, 20, ord('/')) 611 bigdeer3.addch(1, 18, ord('\\')) 612 bigdeer3.addch(1, 20, ord('/')) 613 bigdeer3.addch(2, 19, ord('|')) 614 bigdeer3.addch(2, 20, ord('_')) 615 bigdeer3.addch(3, 18, ord('/')) 616 bigdeer3.addch(3, 19, ord('^')) 617 bigdeer3.addch(3, 20, ord('0')) 618 bigdeer3.addch(3, 21, ord('\\')) 619 bigdeer3.addch(4, 17, ord('/')) 620 bigdeer3.addch(4, 18, ord('/')) 621 bigdeer3.addch(4, 19, ord('\\')) 622 bigdeer3.addch(4, 22, ord('\\')) 623 bigdeer3.addstr(5, 7, "^~~~~~~~~// ~~U") 624 bigdeer3.addstr(6, 6, "( ()_____( /") # )) 625 bigdeer3.addstr(7, 6, "/ / /") 626 bigdeer3.addstr(8, 5, "|/ \\") 627 bigdeer3.addstr(9, 5, "/> \\>") 628 629 bigdeer4.addch(0, 17, ord('\\')) 630 bigdeer4.addch(0, 18, ord('/')) 631 bigdeer4.addch(0, 19, ord('\\')) 632 bigdeer4.addch(0, 20, ord('/')) 633 bigdeer4.addch(1, 18, ord('\\')) 634 bigdeer4.addch(1, 20, ord('/')) 635 bigdeer4.addch(2, 19, ord('|')) 636 bigdeer4.addch(2, 20, ord('_')) 637 bigdeer4.addch(3, 18, ord('/')) 638 bigdeer4.addch(3, 19, ord('^')) 639 bigdeer4.addch(3, 20, ord('0')) 640 bigdeer4.addch(3, 21, ord('\\')) 641 bigdeer4.addch(4, 17, ord('/')) 642 bigdeer4.addch(4, 18, ord('/')) 643 bigdeer4.addch(4, 19, ord('\\')) 644 bigdeer4.addch(4, 22, ord('\\')) 645 bigdeer4.addstr(5, 7, "^~~~~~~~~// ~~U") 646 bigdeer4.addstr(6, 6, "( )______( /") # ) 647 bigdeer4.addstr(7, 5, "(/ \\") # ) 648 bigdeer4.addstr(8, 0, "v___= ----^") 649 650 lookdeer1.addstr(0, 16, "\\/ \\/") 651 lookdeer1.addstr(1, 17, "\\Y/ \\Y/") 652 lookdeer1.addstr(2, 19, "\\=/") 653 lookdeer1.addstr(3, 17, "^\\o o/^") 654 lookdeer1.addstr(4, 17, "//( )") 655 lookdeer1.addstr(5, 7, "^~~~~~~~~// \\O/") 656 lookdeer1.addstr(6, 7, "( \\_____( /") # )) 657 lookdeer1.addstr(7, 8, "( ) /") 658 lookdeer1.addstr(8, 9, "\\\\ /") 659 lookdeer1.addstr(9, 11, "\\>/>") 660 661 lookdeer2.addstr(0, 16, "\\/ \\/") 662 lookdeer2.addstr(1, 17, "\\Y/ \\Y/") 663 lookdeer2.addstr(2, 19, "\\=/") 664 lookdeer2.addstr(3, 17, "^\\o o/^") 665 lookdeer2.addstr(4, 17, "//( )") 666 lookdeer2.addstr(5, 7, "^~~~~~~~~// \\O/") 667 lookdeer2.addstr(6, 7, "(( )____( /") # )) 668 lookdeer2.addstr(7, 7, "( / |") 669 lookdeer2.addstr(8, 8, "\\/ |") 670 lookdeer2.addstr(9, 9, "|> |>") 671 672 lookdeer3.addstr(0, 16, "\\/ \\/") 673 lookdeer3.addstr(1, 17, "\\Y/ \\Y/") 674 lookdeer3.addstr(2, 19, "\\=/") 675 lookdeer3.addstr(3, 17, "^\\o o/^") 676 lookdeer3.addstr(4, 17, "//( )") 677 lookdeer3.addstr(5, 7, "^~~~~~~~~// \\O/") 678 lookdeer3.addstr(6, 6, "( ()_____( /") # )) 679 lookdeer3.addstr(7, 6, "/ / /") 680 lookdeer3.addstr(8, 5, "|/ \\") 681 lookdeer3.addstr(9, 5, "/> \\>") 682 683 lookdeer4.addstr(0, 16, "\\/ \\/") 684 lookdeer4.addstr(1, 17, "\\Y/ \\Y/") 685 lookdeer4.addstr(2, 19, "\\=/") 686 lookdeer4.addstr(3, 17, "^\\o o/^") 687 lookdeer4.addstr(4, 17, "//( )") 688 lookdeer4.addstr(5, 7, "^~~~~~~~~// \\O/") 689 lookdeer4.addstr(6, 6, "( )______( /") # ) 690 lookdeer4.addstr(7, 5, "(/ \\") # ) 691 lookdeer4.addstr(8, 0, "v___= ----^") 692 693 ############################################### 694 curses.cbreak() 695 stdscr.nodelay(1) 696 697 while 1: 698 stdscr.clear() 699 treescrn.erase() 700 w_del_msg.touchwin() 701 treescrn.touchwin() 702 treescrn2.erase() 703 treescrn2.touchwin() 704 treescrn8.erase() 705 treescrn8.touchwin() 706 stdscr.refresh() 707 look_out(150) 708 boxit() 709 stdscr.refresh() 710 look_out(150) 711 seas() 712 stdscr.refresh() 713 greet() 714 stdscr.refresh() 715 look_out(150) 716 fromwho() 717 stdscr.refresh() 718 look_out(150) 719 tree() 720 look_out(150) 721 balls() 722 look_out(150) 723 star() 724 look_out(150) 725 strng1() 726 strng2() 727 strng3() 728 strng4() 729 strng5() 730 731 # set up the windows for our blinking trees 732 # 733 # treescrn3 734 treescrn.overlay(treescrn3) 735 736 # balls 737 treescrn3.addch(4, 18, ord(' ')) 738 treescrn3.addch(7, 6, ord(' ')) 739 treescrn3.addch(8, 19, ord(' ')) 740 treescrn3.addch(11, 22, ord(' ')) 741 742 # star 743 treescrn3.addch(0, 12, ord('*')) 744 745 # strng1 746 treescrn3.addch(3, 11, ord(' ')) 747 748 # strng2 749 treescrn3.addch(5, 13, ord(' ')) 750 treescrn3.addch(6, 10, ord(' ')) 751 752 # strng3 753 treescrn3.addch(7, 16, ord(' ')) 754 treescrn3.addch(7, 14, ord(' ')) 755 756 # strng4 757 treescrn3.addch(10, 13, ord(' ')) 758 treescrn3.addch(10, 10, ord(' ')) 759 treescrn3.addch(11, 8, ord(' ')) 760 761 # strng5 762 treescrn3.addch(11, 18, ord(' ')) 763 treescrn3.addch(12, 13, ord(' ')) 764 765 # treescrn4 766 treescrn.overlay(treescrn4) 767 768 # balls 769 treescrn4.addch(3, 9, ord(' ')) 770 treescrn4.addch(4, 16, ord(' ')) 771 treescrn4.addch(7, 6, ord(' ')) 772 treescrn4.addch(8, 19, ord(' ')) 773 treescrn4.addch(11, 2, ord(' ')) 774 treescrn4.addch(12, 23, ord(' ')) 775 776 # star 777 treescrn4.standout() 778 treescrn4.addch(0, 12, ord('*')) 779 treescrn4.standend() 780 781 # strng1 782 treescrn4.addch(3, 13, ord(' ')) 783 784 # strng2 785 786 # strng3 787 treescrn4.addch(7, 15, ord(' ')) 788 treescrn4.addch(8, 11, ord(' ')) 789 790 # strng4 791 treescrn4.addch(9, 16, ord(' ')) 792 treescrn4.addch(10, 12, ord(' ')) 793 treescrn4.addch(11, 8, ord(' ')) 794 795 # strng5 796 treescrn4.addch(11, 18, ord(' ')) 797 treescrn4.addch(12, 14, ord(' ')) 798 799 # treescrn5 800 treescrn.overlay(treescrn5) 801 802 # balls 803 treescrn5.addch(3, 15, ord(' ')) 804 treescrn5.addch(10, 20, ord(' ')) 805 treescrn5.addch(12, 1, ord(' ')) 806 807 # star 808 treescrn5.addch(0, 12, ord(' ')) 809 810 # strng1 811 treescrn5.addch(3, 11, ord(' ')) 812 813 # strng2 814 treescrn5.addch(5, 12, ord(' ')) 815 816 # strng3 817 treescrn5.addch(7, 14, ord(' ')) 818 treescrn5.addch(8, 10, ord(' ')) 819 820 # strng4 821 treescrn5.addch(9, 15, ord(' ')) 822 treescrn5.addch(10, 11, ord(' ')) 823 treescrn5.addch(11, 7, ord(' ')) 824 825 # strng5 826 treescrn5.addch(11, 17, ord(' ')) 827 treescrn5.addch(12, 13, ord(' ')) 828 829 # treescrn6 830 treescrn.overlay(treescrn6) 831 832 # balls 833 treescrn6.addch(6, 7, ord(' ')) 834 treescrn6.addch(7, 18, ord(' ')) 835 treescrn6.addch(10, 4, ord(' ')) 836 treescrn6.addch(11, 23, ord(' ')) 837 838 # star 839 treescrn6.standout() 840 treescrn6.addch(0, 12, ord('*')) 841 treescrn6.standend() 842 843 # strng1 844 845 # strng2 846 treescrn6.addch(5, 11, ord(' ')) 847 848 # strng3 849 treescrn6.addch(7, 13, ord(' ')) 850 treescrn6.addch(8, 9, ord(' ')) 851 852 # strng4 853 treescrn6.addch(9, 14, ord(' ')) 854 treescrn6.addch(10, 10, ord(' ')) 855 treescrn6.addch(11, 6, ord(' ')) 856 857 # strng5 858 treescrn6.addch(11, 16, ord(' ')) 859 treescrn6.addch(12, 12, ord(' ')) 860 861 # treescrn7 862 863 treescrn.overlay(treescrn7) 864 865 # balls 866 treescrn7.addch(3, 15, ord(' ')) 867 treescrn7.addch(6, 7, ord(' ')) 868 treescrn7.addch(7, 18, ord(' ')) 869 treescrn7.addch(10, 4, ord(' ')) 870 treescrn7.addch(11, 22, ord(' ')) 871 872 # star 873 treescrn7.addch(0, 12, ord('*')) 874 875 # strng1 876 treescrn7.addch(3, 12, ord(' ')) 877 878 # strng2 879 treescrn7.addch(5, 13, ord(' ')) 880 treescrn7.addch(6, 9, ord(' ')) 881 882 # strng3 883 treescrn7.addch(7, 15, ord(' ')) 884 treescrn7.addch(8, 11, ord(' ')) 885 886 # strng4 887 treescrn7.addch(9, 16, ord(' ')) 888 treescrn7.addch(10, 12, ord(' ')) 889 treescrn7.addch(11, 8, ord(' ')) 890 891 # strng5 892 treescrn7.addch(11, 18, ord(' ')) 893 treescrn7.addch(12, 14, ord(' ')) 894 895 look_out(150) 896 reindeer() 897 898 w_holiday.touchwin() 899 w_holiday.refresh() 900 w_del_msg.refresh() 901 902 look_out(500) 903 for i in range(0, 20): 904 blinkit() 905 906curses.wrapper(main) 907