May 31, 2002: A viewer from the Netherlands,
informed me today about a possible enhancement to the Expressions100
program originally posted in November ,2000. The problem was
to: Insert + and - signs as necessary into the string
123456789 to form an expression that evaluates to 100.
Mark pointed out that allowing a leading minus sign generates one extra
solution. Sure enough, with this change, there are 12
ways instead of 11. This is equivalent to specifying the digit
string 0123456789 in the problem definition, so it's not exactly
the same problem. But still interesting enough that I've replaced the original version with
Expressions100B that has this "feature".
May 30, 2002: We're taking a break
after last week's marathon to finish the Four In A Row
program. Let's build another of our number t-shirt series.
Here's, T-Shirt
#4, which finds the "smallest prime that remains prime when added
to its reversal". Only 30 lines of user Delphi code
here!
May 26, 2002: It has been a long "one or
two weeks", but here at last is Version
2 of Four In A Row that was promised back on May 4th.
This version adds a number of features including:
-
User control of board size and winning token row size
,
-
"Suggest" and "Retract"
buttons,
-
computer play,
-
and the ability to control the "IQ" of the
program when it is playing or suggesting
moves.
The program looks for
good moves using the "Knuth/Moore NegMax
variation of the alpha-beta minimax game tree search algorithm ". Whew! I pretty much understand it now, but I 'd be embarrassed
to tell you how many hours were spent debugging those crucial 75 or so
lines of code. The result is a fairly playable game that still
leaves plenty of room for enhancement. Would-be Computer
Science students, have at it. I'm going to work on
beating the program when its IQ is set to 120.
May 14, 2002: Thanks to Francis M. for
catching a couple of bugs in the source code for posted
programs. Towers
of Hanoi 2 and Towers
of Hanoi 3 both used the
integer edit component, TIntEdit, but it wasn't included.
I've since decided that, in general, it's not a good
idea to require specialized components in other distributed programs
and I have generally stopped using them. I just changed TIntEdit components
back to TEdits in the two tower programs and reposted
them. While at it, I changed the ring animation in Tower
3 so that rings now move up off of a peg, across to the receiving peg
and then down. Previous animation had used magic rings that
could pass right through the pegs as they moved in a straight line
from one position to the next.
Also the beginner's Cannon
simulation program had a reference to Unit1 in its Uses
clause, even though Unit1 was not referenced or required. I
had renamed Unit1, but somehow the Uses clause hadn't been
updated. So that program has been corrected and reposted
also.
Thanks again Francis. for taking the time to email
me. To all viewers - you can help make this site better if
you emulate Francis and let me know when you find something that
doesn't work. I'll appreciate it.
May
10, 2002: Here's a beginner's level program that solves a problem with
a stack of cannonballs, technically a square pyramidal pentahedron.
(A pentahedron is a solid with 5 surfaces.)
How big would the stack have to be before you could rearrange the balls
into a single square layer? Pentahedral
Cannonball Stacks will give you the answer with a dozen lines of user
written code. (I've included Version 2, about 50 lines longer,
which also draws a larger copy of the picture you see here.)
May 9, 2002: This year's World Championship ACM Programming
Competition was won by a team from China. Three
man teams had five hours to work on eight problems sharing one
computer. I glanced at the problems and decided I might
get the easiest one (problem #1 I think). The competitors
were the best 64 out of 3000 teams from 1300 universities, so they are
some pretty sharp cats. I'll be interested in
seeing detailed results when they are
available. Here's a link
to more info.
Also, ran across a well written article at
delphi.about.com discussing considerations and techniques when
resizing
forms for various monitor resolutions. When possible, I've
tried to avoid the problem here by restricting form sizes to 640 by 480
pixels. It would be nice to seamlessly scale
the forms up to larger screen sizes and there are components that
apparently do the job. They just aren't a standard part of Delphi
(yet).
|
Red
wins! |
May 6, 2002: Here is the
first version of Four In A Row - an extended version of Tic-Tac-Toe
that is played on a 7 by 6 board, requires 4 markers in a row to win, and
has the added restriction that columns must be filled from the bottom
up. This is the human vs. human version. If things work out,
we'll build on this framework to add computer play in a week or
two.
May 3,2002: Macro Cantu, Delphi guru and
author of several excellent books, has just made an introductory
text, Essential Delphi, available as a free PDF file
download from http://www.marcocantu.com/edelphi/.
There is also a downloadable file of associated Delphi source
code. I haven't been through the entire book yet, but if you're
a beginner, and maybe even if you are not, it's definitely worth a
look.
May
1, 2002: Someone asked me the other day if 8 solutions to the
standard Eight Queens problem could be placed on a chessboard so as
to occupy all 64 squares. I didn't know the answer, but I do
now. Even better, I got to implement the clever Niklaus
Wirth algorithm while solving the problem. Wirth's technique is one of those
"lateral thinking" solutions
that makes you say "Wow! I wish I had thought of
that". The source code for EightQueens_Wirth is now available on the previously published
EightQueens Plus
page. Just scroll down to the addendum
section.
|