forked from ioccc-src/temp-test-ioccc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
747 lines (631 loc) · 30.5 KB
/
index.html
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- START: two lines up starts content from: inc/top.default.html -->
<!-- END: this line ends content from: inc/top.default.html -->
<!-- START: this line starts content from: inc/head.default.html -->
<head>
<link rel="stylesheet" href="../../ioccc.css">
<link href="https://fonts.googleapis.com/css2?family=Outfit:[email protected]&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2001/dgbeards - Best AI</title>
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
<meta name="description" content="2001 IOCCC entry dgbeards - Best AI">
<meta name="keywords" content="IOCCC, 2001, IOCCC 2001, IOCCC entry, dgbeards, Best AI">
</head>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- END: this line ends content from: inc/head.default.html -->
<!-- -->
<!-- This web page was formed via the tool: bin/readme2index.sh -->
<!-- The content of main section of this web page came from: 2001/dgbeards/README.md -->
<!-- -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2001/dgbeards/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2001/dgbeards/README.md !!! -->
<!-- !!! Do not modify this web page, instead modify the file: 2001/dgbeards/README.md !!! -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
<!-- START: this line starts content from: inc/body.default.html -->
<body>
<!-- END: this line ends content from: inc/body.default.html -->
<!-- START: this line starts content from: inc/topbar.default.html -->
<div class="theader">
<nav class="topbar">
<div class="container">
<div class="logo">
<a href="../../index.html" class="logo-link">
IOCCC
</a>
</div>
<div class="topbar-items">
<div class="item">
<span class="item-header">
Entries
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../years.html" class="sub-item-link">
Winning entries
</a>
</div>
<div class="outfit-font">
<a href="../../authors.html" class="sub-item-link">
Winning authors
</a>
</div>
<div class="outfit-font">
<a href="../../location.html" class="sub-item-link">
Location of authors
</a>
</div>
<div class="outfit-font">
<a href="../../bugs.html" class="sub-item-link">
Bugs and (mis)features
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_an_entry" class="sub-item-link">
Fixing entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#fix_author" class="sub-item-link">
Updating author info
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
Status
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../news.html" class="sub-item-link">
News
</a>
</div>
<div class="outfit-font">
<a href="../../status.html" class="sub-item-link">
Contest status
</a>
</div>
<div class="outfit-font">
<a href="../../next/index.html" class="sub-item-link">
Rules and guidelines
</a>
</div>
<div class="outfit-font">
<a href="../../markdown.html" class="sub-item-link">
Markdown guidelines
</a>
</div>
<div class="outfit-font">
<a href="../../SECURITY.html" class="sub-item-link">
Security policy
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
FAQ
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../faq.html" class="sub-item-link">
Frequently Asked Questions
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#submit" class="sub-item-link">
How to enter
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#compiling" class="sub-item-link">
Compiling entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#running_entries" class="sub-item-link">
Running entries
</a>
</div>
<div class="outfit-font">
<a href="../../faq.html#help" class="sub-item-link">
How to help
</a>
</div>
</div>
</div>
<div class="item">
<span class="item-header">
About
</span>
<div class="sub-item">
<div class="outfit-font">
<a href="../../index.html" class="sub-item-link">
Home page
</a>
</div>
<div class="outfit-font">
<a href="../../about.html" class="sub-item-link">
About the IOCCC
</a>
</div>
<div class="outfit-font">
<a href="../../judges.html" class="sub-item-link">
The Judges
</a>
</div>
<div class="outfit-font">
<a href="../../thanks-for-help.html" class="sub-item-link">
Thanks for the help
</a>
</div>
<div class="outfit-font">
<a href="../../contact.html" class="sub-item-link">
Contact us
</a>
</div>
</div>
</div>
</div>
</div>
</nav>
<div class="header-mobile-menu">
<noscript>
<a href="../../nojs-menu.html" class="topbar-js-label">
Please Enable JavaScript
</a>
</noscript>
<button id="header-open-menu-button" class="topbar-mobile-menu">
<img
src="../../png/hamburger-icon-open.png"
alt="hamburger style menu icon - open state"
width=48
height=48>
</button>
<button id="header-close-menu-button" class="hide-content">
<img
src="../../png/hamburger-icon-closed.png"
alt="hamburger style menu icon - closed state"
width=48
height=48>
</button>
<div id="mobile-menu-panel" class="hide-content">
<div class="mobile-menu-container">
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
Entries
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../years.html">
Winning entries
</a>
<a class="mobile-submenu-item" href="../../authors.html">
Winning authors
</a>
<a class="mobile-submenu-item" href="../../location.html">
Location of authors
</a>
<a class="mobile-submenu-item" href="../../bugs.html">
Bugs and (mis)features
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_an_entry">
Fixing entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#fix_author">
Updating author info
</a>
<a class="mobile-submenu-item" href="../../thanks-for-help.html">
Thanks for the help
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
Status
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../news.html">
News
</a>
<a class="mobile-submenu-item" href="../../status.html">
Contest status
</a>
<a class="mobile-submenu-item" href="../../next/index.html">
Rules and guidelines
</a>
<a class="mobile-submenu-item" href="../../markdown.html">
Markdown guidelines
</a>
<a class="mobile-submenu-item" href="../../SECURITY.html">
Security policy
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
FAQ
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../faq.html">
Frequently Asked Questions
</a>
<a class="mobile-submenu-item" href="../../faq.html#submit">
How to enter
</a>
<a class="mobile-submenu-item" href="../../faq.html#compiling">
Compiling entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#running_entries">
Running entries
</a>
<a class="mobile-submenu-item" href="../../faq.html#help">
How to help
</a>
</div>
</div>
<div class="mobile-menu-wrapper">
<div class="mobile-menu-item">
About
</div>
<div class="mobile-submenu-wrapper">
<a class="mobile-submenu-item" href="../../index.html">
Home page
</a>
<a class="mobile-submenu-item" href="../../about.html">
About the IOCCC
</a>
<a class="mobile-submenu-item" href="../../judges.html">
The Judges
</a>
<a class="mobile-submenu-item" href="../../contact.html">
Contact us
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var headerOpenMenuButton = document.getElementById("header-open-menu-button");
var headerCloseMenuButton = document.getElementById("header-close-menu-button");
var mobileMenuPanel = document.getElementById("mobile-menu-panel");
headerOpenMenuButton.addEventListener("click", () => {
headerOpenMenuButton.classList.remove("topbar-mobile-menu");
headerOpenMenuButton.classList.add("hide-content");
headerCloseMenuButton.classList.remove("hide-content");
headerCloseMenuButton.classList.add("topbar-mobile-menu");
mobileMenuPanel.classList.remove("hide-content");
mobileMenuPanel.classList.add("topbar-mobile-panel");
});
headerCloseMenuButton.addEventListener("click", () => {
headerCloseMenuButton.classList.remove("topbar-mobile-menu");
headerCloseMenuButton.classList.add("hide-content");
mobileMenuPanel.classList.add("hide-content");
mobileMenuPanel.classList.remove("topbar-mobile-panel");
headerOpenMenuButton.classList.add("topbar-mobile-menu");
headerOpenMenuButton.classList.remove("hide-content");
});
</script>
<!-- END: this line ends content from: inc/topbar.default.html -->
<!-- START: this line starts content from: inc/header.default.html -->
<div class="header">
<a href="../../2011/zucker/index.html">
<img src="../../png/ioccc.png"
alt="IOCCC image by Matt Zucker"
width=300
height=110>
</a>
<h1>The International Obfuscated C Code Contest</h1>
<h2>2001/dgbeards - Best AI</h2>
<h3>Plays suicide chess</h3>
</div>
<!-- END: this line ends content from: inc/header.default.html -->
<!-- START: this line starts content from: inc/navbar.mid.html -->
<div class="navbar">
<a class="Left" href="../ctk/index.html">← 2001/ctk</a>
<a class="Left" href="../index.html">↑ 2001 ↑</a>
<a class="Left" href="../herrmann1/index.html">2001/herrmann1 →</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/dgbeards.c">C code</a>
<a class="Right" href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/Makefile">Makefile</a>
<a class="Right" href="#inventory">Inventory</a>
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2001%2Fdgbeards%2Findex.html">✓</a>
</div>
<!-- END: this line ends content from: inc/navbar.mid.html -->
<!-- START: this line starts content from: inc/before-content.default.html -->
<div class="content" id="content">
<!-- END: this line ends content from: inc/before-content.default.html -->
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
<h2 id="author">Author:</h2>
<ul>
<li>Name: <a href="../../authors.html#Doug_Beardsley">Doug Beardsley</a><br>
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)</li>
</ul>
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- BEFORE: 1st line of markdown file: 2001/dgbeards/README.md -->
<h2 id="to-build">To build:</h2>
<pre><code> make</code></pre>
<p>There is an alternate version based on the author’s remarks. See <a href="#alternate-code">Alternate
code</a> below for more details.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
<p>The current status of this entry is:</p>
<blockquote>
<p><strong>STATUS: INABIAF - please DO NOT fix</strong></p>
</blockquote>
<p>For more detailed information see <a href="../../bugs.html#2001_dgbeards">2001/dgbeards in bugs.html</a>.</p>
<h2 id="to-use">To use:</h2>
<pre><code> ./dgbeards</code></pre>
<h2 id="alternate-code">Alternate code:</h2>
<p>The author provided a way to speed it up a bit and also how to make it so it
doesn’t crash on losing. The idea that it crashes on losing was too good to
lose but this alternate version has the former change. If you wish to remove
this you can look at the author’s remarks and make the change.</p>
<h3 id="alternate-build">Alternate build:</h3>
<pre><code> make alt</code></pre>
<h3 id="alternate-use">Alternate use:</h3>
<pre><code> ./dgbeards.alt</code></pre>
<h2 id="try">Try:</h2>
<p>See if you can figure out how to make the computer always lose (‘win’ :-) ).
It’s a very simple thing to do. Read the author’s remarks for clues.</p>
<p>This game crashes if it loses.</p>
<h2 id="judges-remarks">Judges’ remarks:</h2>
<p>This is probably the worst AI we’ve ever seen. So, then, why did
the entry win? Because it’s <em>trying</em> to lose.</p>
<p>This is also one of the first chess games we’ve seen.</p>
<p>Of particular interest is the author’s decision that the program should
crash if it loses. I’ve played chess with a lot of people like that, and
I appreciate the realism.</p>
<p>BTW: if your goal is to lose and you do does that mean you win? :-) What does
winning mean in a game you’re supposed to lose at?</p>
<h2 id="authors-remarks">Author’s remarks:</h2>
<h3 id="faq">FAQ</h3>
<h4 id="q-what-does-this-program-do">Q: What does this program do?</h4>
<p>A: It lets the user play two player or single player games of <a href="https://en.wikipedia.org/wiki/Losing_chess">suicide
chess</a>. Suicide Chess (also known as
Losing Chess) is a variant of normal chess. It is played on the same board and
uses the same pieces. Here is a list of the differences:</p>
<ol type="1">
<li><p>The object of the game is to get to a position where you have no legal
moves. This is usually accomplished by losing all of your pieces.
Sometimes, the game can end when you still have some pawns on the board,
but they are blocked and cannot move. The general rule is if a player
has no legal moves, the game is over. The entry is the player with fewer
pieces on the board. This is almost always the same player that had no
moves, but not always.</p></li>
<li><p>In suicide chess, piece captures are compulsory. If a player can
capture an opponent’s piece, he is required to do so. If he can capture
more than one of the opponent’s pieces or can capture one piece with more
than one of his own pieces, he can choose which capture to play.</p></li>
<li><p>The king is not significant. There is no concept of check and the king
can be captured.</p></li>
<li><p>Because of rule 3, pawns are allowed to promote to a king.</p></li>
<li><p>Castling is not allowed.</p></li>
</ol>
<h4 id="q-how-do-you-use-this-program">Q: How do you use this program?</h4>
<p>A: The program is fairly straightforward. When you start the program,
it displays the opening position for a game of suicide chess and waits
for user input. Commands are as follows:</p>
<ul>
<li><code>quit</code> quits the program</li>
<li><code>g</code> causes the computer to make a move</li>
</ul>
<p>Moves are represented by the long algebraic notation for the move. For those
not familiar with long algebraic notation, a move consists of a square to move
from followed by a square to move to. Squares are denoted by a letter and a
number. The letter specifies the column or file of the square and the number
specifies the row rank. Files are named from left to right by the letters <code>A</code> -
<code>H</code>. Rows are numbered from bottom to top with the numbers <code>1</code> - <code>8</code>. A sample
move from the opening position is <code>E2E3</code>. This means to move a piece from
square <code>E2</code> to <code>E3</code>. From the opening position, this corresponds to moving the
king pawn forward one square. This is generally to be considered one of the
best opening moves in suicide chess. All moves, captures and otherwise, are
represented with this notation. A special case is pawn promotion moves. They
use the same notation followed by an <code>=</code> and a letter representing the piece to
promote to. The letters are <code>R</code>, <code>N</code> , <code>B</code>, <code>Q</code>, <code>K</code> representing rook, knight,
bishop, queen, and king respectively. The letters must be upper case.</p>
<p>You can also specify a command line argument of a single digit to change
the search depth of the program. If no argument is specified, it
defaults to a depth of 3.</p>
<h4 id="q-are-there-any-limitations-in-your-program">Q: Are there any limitations in your program?</h4>
<p>A: Yes. The first of the limitations is that you can only play legal
moves according to the rules of suicide chess. En passant captures are
not recognized. They are rarely encountered in suicide chess and when
they do happen, they usually do not change the outcome of the game. As
mentioned above, castling is not allowed either.</p>
<p>It also does not detect the end of the game. It can see sure wins or
losses several moves ahead, but does not announce the end of a game nor
the winner. Given the existing code it is easy to do this, but it was
deemed unnecessary fluff.</p>
<h4 id="q-what-is-the-playing-strength-of-this-program">Q: What is the playing strength of this program?</h4>
<p>A: Playing strength is a relative term. Relative to other computer
programs that play suicide chess, it is about the bottom. There is one
freeware program in existence called <code>kenny</code> that this program can beat,
but that is about it.</p>
<p>Suicide chess is a very tactical game. Most humans who do not have any
experience in suicide chess will lose to this program. The <a href="http://www.freechess.org">Free Internet
Chess Server</a> is a free online chess server
that supports suicide chess. This server keeps track of ratings. The
human ratings for suicide chess range from 1000 to about 2400. This
program would probably be rated somewhere around 1700-1900. It is better
than most players, but will get destroyed by experienced human opponents.</p>
<p>This program searches to a fixed depth of 3
<a href="https://en.wikipedia.org/wiki/Ply_(game_theory)">ply</a>. Because it does not
search very deep, it performs very poorly in quiet strategic positions.
In such positions, it will often just shuffle pieces around aimlessly
until a tactical exchange presents itself.</p>
<p>A small amount of randomness has been added to make the program a more
interesting opponent. To avoid a call to <code>srand(3)</code>, <code>rand(3)</code> and the
extra code for the required include files, the <code>time(3)</code> function is used as
the source of random data. It is a slow function, and since it is
executed inside the search loop, there is a significant performance
decrease. To make it faster, replace the <code>time(3)</code> call with <code>rand(3)</code> and add
the line <code>srand(time(0));</code> to the beginning of <code>main()</code>. I used the more
inefficient <code>time(3)</code> function to illustrate a different (and somewhat
obfuscated?) way of generating random numbers.</p>
<h4 id="q-why-is-this-program-obfuscated">Q: Why is this program obfuscated?</h4>
<p>A: Here are several reasons:</p>
<p>First, without preprocessing, the code is not easy to read. The
preprocessor is used to compress the code and obfuscate it. The main
obstacle to entering this program is the source code size limit. This is
the reason that the preprocessor was used so liberally. It is one of the
best ways to compress C source code.</p>
<p>Second, when possible, variables in the program were made global. Their
names are not descriptive and they are used for a variety of purposes
throughout the program. Because of this, it is difficult to determine
exactly what the code does even after preprocessing and beautifying the
code.</p>
<p>Third, all function names are a single character and are obviously not
descriptive of they’re actual purpose. Again this serves the dual
purpose of compression and obfuscation.</p>
<p>Fourth, most string variables have been encoded. This encoding serves
to obfuscate the program as well as reduce the number of countable
characters and get the program under the size limit of this year’s IOCCC.
There are some places where other simple encoding methods are used to
hide the real purpose of strings. These layers of obscurity cannot be
penetrated by just preprocessing and beautifying the program.</p>
<p>Fifth, various small obfuscations have been used in places all over the
program. Short circuit evaluation is used as a substitute for <code>if()</code>
statements in some places. The ternary operator is used. In the
author’s opinion, use of the ternary operator is almost always a strong
argument for employee turnover.</p>
<p>Last, if you have succeeded in wading through the previous layers of
obfuscation, you are confronted by the fact that the game that it
implements is an obscure game. Casual inspection of the program might
lead one to believe that it is an implementation of classic chess, but
this is not so.</p>
<h4 id="q-what-about-the-compiler-warnings">Q: What about the compiler warnings?</h4>
<p>A: When compiled with <code>gcc -Wall</code>, the compiler generated the following
warnings:</p>
<blockquote>
<p>suggest parentheses around <code>+</code> or <code>-</code> in operand of <code>&</code><br>
array subscript has type ‘<code>char</code>’<br>
return type defaults to ‘<code>int</code>’<br>
control reaches end of non-void function<br>
value computed is not used</p>
</blockquote>
<p>The <code>value computed is not used</code> warning happens because I use the <code>&&</code>
operator and take advantage of short circuit evaluation instead of using
an <code>if()</code> statement.</p>
<p>The <code>suggest parentheses...</code> warnings are given because of expressions
that depend on operator precedence details in the C language.
Eliminating these warnings would reduce obfuscation.</p>
<p>The other warnings are there because it would require more code to
eliminate them and that can’t be done given the size limit.</p>
<h4 id="q-why-does-this-program-crash-when-it-loses">Q: Why does this program crash when it loses?</h4>
<p>A: What better way to admit defeat? The author thought this was
appropriate sportsmanship for a program of this genre and can think of
no worse job than trying to find an elusive bug in an intentionally
obfuscated program.</p>
<p>[<strong>Judges’ note</strong>: This was followed by a description of the bug, and
the comment:]</p>
<p>Note, if this program wins, the author thinks it would be good to leave
this information out of the remarks and encourage others to try and
figure it out for themselves.</p>
<p>[Should you be too lazy (or time-efficient or affected by ‘real life’ :-) ) to
figure it out yourself, here’s the author’s fix.]</p>
<p>This bug can be fixed in a number of ways, but there is a way that adds only one
byte to the source code. In the statement <code>s=(e=-V(n-1,o))>s?Y=G,e:s;</code> change
the <code>></code> to a <code>>=</code> and the bug will be gone.</p>
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<!-- AFTER: last line of markdown file: 2001/dgbeards/README.md -->
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
<div id="inventory">
<h1 id="inventory-for-2001dgbeards">Inventory for 2001/dgbeards</h1>
</div>
<h2 id="primary-files">Primary files</h2>
<ul>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/dgbeards.c">dgbeards.c</a> - entry source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/Makefile">Makefile</a> - entry Makefile</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/dgbeards.alt.c">dgbeards.alt.c</a> - alternate source code</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/dgbeards.orig.c">dgbeards.orig.c</a> - original source code</li>
</ul>
<h2 id="secondary-files">Secondary files</h2>
<ul>
<li><a href="2001_dgbeards.tar.bz2">2001_dgbeards.tar.bz2</a> - download entry tarball</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/README.md">README.md</a> - markdown source for this web page</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/dgbeards/.path">.path</a> - directory path from top level directory</li>
<li><a href="index.html">index.html</a> - this web page</li>
</ul>
<hr style="width:10%;text-align:left;margin-left:0">
<h4>
Jump to: <a href="#">top</a>
</h4>
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
<!-- START: this line starts content from: inc/after-content.default.html -->
</div>
<!-- END: this line ends content from: inc/after-content.default.html -->
<!-- START: this line starts content from: inc/footer.inventory.html -->
<!--
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
You are free to share and adapt this file under the terms of this license:
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
For more information, see:
https://creativecommons.org/licenses/by-sa/4.0/
-->
<div class="footer">
<div id="copyright"><h3>Copyright © 1984-2024 by Landon Curt Noll:
<a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean"
target="_blank"
rel="license noopener noreferrer">Some Rights Reserved</a></h3>
<p>
This work is <b>licensed by Landon Curt Noll</b> under
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
target="_blank"
rel="license noopener noreferrer"
style="display:inline-block;">CC BY-SA 4.0</a></b>.
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/cc.png"
alt="cc inside circle symbol">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/by.png"
alt="person inside circle symbol">
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
src="../../png/sa.png"
alt="arrow looping back on itself inside circle symbol"><br>
You should <b>carefully review</b> the
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en"
target="_blank"
rel="license noopener noreferrer">CC BY-SA 4.0 LEGAL CODE</a></b>
before using the licensed material.<br>
You may wish to review the
<b><a href="../../license.html"
target="_blank"
rel="license noopener noreferrer">highlights of some of the key features and terms</a></b>
of <b>CC BY-SA 4.0</b>.<br>
</p>
</div>
<div id="coda"><h3>Coda</h3>
<p>
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2001%2Fdgbeards%2Findex.html" rel="nofollow">Nu HTML check this web page</a><br>
<a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a><br>
</p>
</div>
</div>
<!-- END: this line ends content from: inc/footer.inventory.html -->
<!-- START: this line starts content from: inc/bottom.default.html -->
</body>
</html>
<!-- END: this line ends content from: inc/bottom.default.html -->