CHTTRS - Editorial

PROBLEM LINK:

Practice
Contest

Author: Alex Gu
Tester: Kevin Atienza
Editorialists: Pushkar Mishra and Suhash Venkatesh

DIFFICULTY:

Challenge

PROBLEM:

EXPLANATION:

Tester’s algorithm follows this closely: https://codemyroad.wordpress.com/2013/04/14/tetris-ai-the-near-perfect-player/ (even the coefficients). He added a small random value to the “score” of a state which seemed to affect the final total score he gets. (random(0,0.001))

Other specifics:

  • He represents the grid as a list of 15 bitmasks.
  • The most important part of the code (which computes the “score” of a state) is the “compute_score” function (enclosed within the “//////” lines).
  • For debugging, he uses the following snippet:
#define DEBUG 1
#ifdef ONLINE_JUDGE
#define DEBUG 0
#endif

and to print, he uses the following syntax

if (DEBUG) printf(...);

There are other (admittedly more recommended) patterns though.
Please contribute.

SAMPLE SOLUTIONS:

Tester

1 Like
//