Prepare for the winners of **IOCCC28**. > However these are not the 2024 droids you are looking for. :-) The HTML menu (both JavaScript and non-JavaScript) has been updated. The `Status -> Rules and guidelines' have been replaced with two separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`. Added a new top level `social.html` page: built from a new `social.md`. Sorted rules for building specific web pages in the top level `Makefile`. Added `make social` to make the `social.html` page from `social.md`. The `bin/gen-top-html.sh` now is able to process a argument of **social** to process the new top level `social.html` page. Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13" to "2.0.1 2025-07-25". Below `About -> Home page` a new `About -> IOCCC social media` menu item as added. Because the menu change touched every HTML file, we changed the general copyright date range for HTML files from "1984-2024" to "1984-2025" due to the extensive changes made for **IOCCC28**. Those markdown files that were modified in 2025 had their copyright date range also changed from "1984-2024" to "1984-2025". Rebuilt tarballs and sitemap due to the extensive HTML rebuilding. Ran `make update` to perform the above.
776 lines
31 KiB
HTML
776 lines
31 KiB
HTML
<!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:wght@100..900&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/rules.html" class="sub-item-link">
|
||
IOCCC rules
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../next/guidelines.html" class="sub-item-link">
|
||
IOCCC 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="../../quick-start.html#enter" class="sub-item-link">
|
||
Enter the IOCCC
|
||
</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="../../social.html" class="sub-item-link">
|
||
IOCCC social media
|
||
</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/rules.html">
|
||
IOCCC rules
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../next/guidelines.html">
|
||
IOCCC 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="../../quick-start.html#enter">
|
||
Enter the IOCCC
|
||
</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="../../social.html">
|
||
IOCCC social media
|
||
</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/winner/blob/master/2001/dgbeards/dgbeards.c">C code</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/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%2Fwww.ioccc.org%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><strong>BTW</strong>: 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/winner/blob/master/2001/dgbeards/dgbeards.c">dgbeards.c</a> - entry source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2001/dgbeards/Makefile">Makefile</a> - entry Makefile</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2001/dgbeards/dgbeards.alt.c">dgbeards.alt.c</a> - alternate source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/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/winner/blob/master/2001/dgbeards/README.md">README.md</a> - markdown source for this web page</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/2001/dgbeards/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/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/winner/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-2025 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-2025 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%2Fwww.ioccc.org%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 -->
|