-
Notifications
You must be signed in to change notification settings - Fork 0
Submit robot
keywet06 edited this page Aug 6, 2020
·
3 revisions
- You must submit a c++ file
- Don't submit code can only play under than 3000 score.
- This is the example of AI
#include "api.hpp"
namespace robotname {
int solve(int data[4][4]) { /* some code */ }
} // namespace robotname
- The declaration of the main function you should write is:
int robotname::solve(int data[4][4]);
- The namespace
robotname
should be named with your robot's name - The array
data
is the numbers on 2048 -
(int)(1)
is refered to 2;(int)(2)
is refered to 4; ...;(int)(n)
is refered to (1 << n); ... - The return type is: 0->up, 1->right, 2->down, 3->left.
- Auto2048 provides some functions for you to call(the functions in
api.hpp
):
void solve(int x, int data[4][4], int &score);
int test(int x);
int test();
int step(int x, int data[4][4]);
-
The function to run the step
void solve(int x, int data[4][4], int &score);
-
int x
: the direction you give -
int data[4][4]
: the data you give -
int &score
: add the score you get
-
-
The function to test a direction
int test(int x);
-
int x
: the direction on 2048 - return
int
: if the data changed
-
-
The function to test all directions
int test();
- return
int
: if it has a direction can make data change
- return
-
The function to test the step
int step(int x, int data[4][4]);
- return
int
& 1: if it has the direction can make data change - return
int
& ~1: the score added
- return