Copied most of main() from 2048.c, added populate_grid() function