When Not to Simulate a Game (UVa 11553)


Some programming puzzles can be solved by simulating a game or process. For example:

  • UVa 978 is based on simulating a conflict between warring lemmings.
  • For UVa 732, you have to simulate something more abstract: a stack that pushes and pops characters.

UVa 11553 may seem like a classic simulation problem: a board game between two players. But it soon becomes clear that this problem can’t be solved by simulating the players’ moves.

« Continue »

Command-Line Tools for Competitive Programming

Command Line

When they select their tools, programmers have a choice between command-line and GUI options. Most people use both. For example, I prefer to use GUI tools for diffing a set of files I’m preparing to commit to a source repository. I also like my editor to be graphical, though I use a lot of keyboard shortcuts. But command-line tools are preferable when I’ll be repeating the same action multiple times. It’s a lot more efficient to retrieve a typed command from the shell history than to do the same steps repeatedly using mouse clicks or even keyboard shortcuts. Today I’ll be explaining some commands that are useful for programming puzzles.

« Continue »