Skip to content

KimMadsen/Minesweeper

Repository files navigation

March 30 2025

Entry for Minesweeper contest. Code produced by Google Gemini 2.5 Pro by successively giving it these prompts:

"Make a complete minesweeper game in Delphi. It must contain animated graphics and keep track of score, contain a nice intro and a nice failure and success end animation/screen."

Providing additional hint by followup prompt:

"Produce the dfm file too"

Providing additional hint by followup prompt:

"Change the code to not use predefined images, but instead draw them using drawing primitives. That includes all graphics and animations."

Providing additional hint by followup prompt:

"DFM files can't contain comments. And TMainMenu does not have a height since it does not count as part of the client area."

Which produced the current code, including DFM file. The code could not compile without simple changes, which I could have told it to make Im sure, but I instead decided to mark the changes with {HANDMODIFIED....

Two types of mistakes was made:

* thinking that InflateRect is a function. It is a procedure.
   so requires to be on a separate line.
   
    DrawFlag(ACanvas, InflateRect(DestRect, -BEVEL_WIDTH-1, -BEVEL_WIDTH-1));

* not specifying correct paranthesis for a statement:

      else if FGameState in [gsWon, gsLost] and (FEndTime > FStartTime) then
      
   Which fails because of missing paranthesis around the FGameState in [...] part.

In addition it forgot to link the imgBoardMouseDown event handler, that it did produce to the actual eventhandler OnMouseDown of the imgBoard control.

With those fixes, the code runs and works pretty well. It seems to me that, with an aggregated prompt, and a little fine tuning, it might very well have produced a fully functioning Delphi Minesweeper game without further human interaction needed, except for copy/paste/compile/run.

Kim Bo Madsen Components4Developers www.components4developers.com House of components for serious applications

About

AI generated minesweeper in Delphi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages