Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mode question - answer #5

Open
HhvrshH opened this issue Jul 15, 2023 · 6 comments
Open

Mode question - answer #5

HhvrshH opened this issue Jul 15, 2023 · 6 comments

Comments

@HhvrshH
Copy link

HhvrshH commented Jul 15, 2023

Hi, Macroxue. THX for this amazing work. I have question for you. Can i run this script in mode when i send to console command right with massive like this [16,512,2,0,64,256,0,2,16,128,0,0,8,4,0,0] and got best direction? This is very needing function for me.

@macroxue
Copy link
Owner

Yes, you can. Please see Server mode.

Once the AI is running in server mode with ./2048b -S 8080 -I -v, you can issue an HTTP get request and pass in the board layout. For example, wget -qO- http://localhost:8080/move?board=EDC1BA9187611110; echo returns u, suggesting an up move for the following board.

---------------------------------
| 16384 |  8192 |  4096 |     2 |
---------------------------------
|  2048 |  1024 |   512 |     2 |
---------------------------------
|   256 |   128 |    64 |     2 |
---------------------------------
|     2 |     2 |     2 |       |
---------------------------------

@HhvrshH
Copy link
Author

HhvrshH commented Jul 20, 2023

THX for your answering it's help me strongly. I tried solving some modified version of 2048 where after some needing score value reaching board starts generate new cell with 8 and 16 value. It leads that AI solve this type of game worse than classic 2048. Maybe, I can or You can do some small modification on game where AI should get their solving base for do it better to this type of game?

@macroxue
Copy link
Owner

It would require a lot of changes to handle the spawning of 8 and 16 tiles. These tiles definitely make the game harder than the classic 2048. Below are a few places that require changes. You can give it a try. Good luck.

https://github.com/macroxue/2048-ai/blob/master/tuple.h#L242
https://github.com/macroxue/2048-ai/blob/master/node.h#L114
https://github.com/macroxue/2048-ai/blob/master/2048.cc#L181
https://github.com/macroxue/2048-ai/blob/master/plan.h#L69

@HhvrshH
Copy link
Author

HhvrshH commented Jul 22, 2023

THX

@alpha-106
Copy link

Thanks, its working for me now. However I find it quite tedious to input the state every move, can I use any other method to update the state?

@macroxue
Copy link
Owner

You can update your program to get moves from the AI. Please check this 2048 clone which has been modified to work with the AI server. You can look at this commit for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants