You are not logged in. Please login at www.codechef.com to post your questions!

×

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

This question is marked "community wiki".

asked 14 Sep '15, 22:25

pushkarmishra's gravatar image

4★pushkarmishra
1.3k156581
accept rate: 4%

edited 19 May '16, 21:01

admin's gravatar image

0★admin ♦♦
19.8k350498541

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×15,852
×858
×158

question asked: 14 Sep '15, 22:25

question was seen: 2,386 times

last updated: 19 May '16, 21:01