Page 1 of 1

2048

Posted: Mon Jun 02, 2014 5:27 pm
by Dadido3
Hello,

I'm here to share my little clone of the game 2048.

It also includes some AIs, which are not really intelligent yet.
They mostly get to the 1024 Tile, sometimes 2048.
But thats where you are coming in, just try to write your own AI and upload the results here.
There is an example include for an AI which just randomly moves.
Just copy it, change the name and include it to the main file.

Image

Links Have Fun!

Re: 2048

Posted: Mon Jun 02, 2014 9:51 pm
by falsam
Nice job. A suggestion: Sends a message when the game is blocked. Thank you Dadido3 :)

Re: 2048

Posted: Mon Jun 02, 2014 10:22 pm
by Fred
Good :)

Re: 2048

Posted: Tue Jun 03, 2014 7:40 am
by davido
Nice.
Thank you for sharing. :D

Re: 2048

Posted: Wed Jun 04, 2014 9:10 am
by Kwai chang caine
Great !!!
Thanks for sharing 8)

Re: 2048

Posted: Wed Jun 04, 2014 12:09 pm
by Kwai chang caine
Two hours of "Works" and only 3168 points with 256 max :oops:
Decidedly ...kcc is also strong in game than in programming :|
Again thanks for this code 8)

Re: 2048

Posted: Mon Jun 09, 2014 10:27 am
by Poshu
Just tried:
- with a few modifications, it works on OSx
- Did you change something to the random placement for the new tile? It felt much easier than the web version
- There is no message when you create the first 2048 tiles!
- Colors are different, and I felt lost...

Re: 2048

Posted: Mon Jun 09, 2014 3:40 pm
by Dadido3
Poshu wrote:Just tried:
- with a few modifications, it works on OSx
- Did you change something to the random placement for the new tile? It felt much easier than the web version
- There is no message when you create the first 2048 tiles!
- Colors are different, and I felt lost...
Thanks for the feedback.

Could you give me the changes you made to make it work on OS X?
And do you also store the settings somewhere?
Or did you just commented out all the setting stuff?

Because of the random tile generation: I updated the game yesterday.
Now there is a 10% chance that a 4 will appear, and a 90% chance that a 2 will appear, the same behaviour as in the original version.
Before the update it was 50/50.

Regarding the message: If you want the message add it ;)
I see no real benefit in it, it's more annoying than helpful in my opinion.

Summary of the update:
  • The "Simple" Ai works now much better, it gets mostly to the 2048 tile and sometimes 4096
  • As mentioned above: A 2 will now spawn with a probability of 90%
  • Added a "Game Over" message
  • Added a highscore (only local)

Re: 2048

Posted: Mon Jun 09, 2014 4:24 pm
by davido
Even better.
Thank you. :D

Re: 2048

Posted: Mon Jun 09, 2014 9:19 pm
by Poshu
here it is (it's a lazy fix, because I just wanted it to work :p) :

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
	
	Procedure.s SHGetFolderPath(CSIDL)
	  Protected *String = AllocateMemory(#MAX_PATH+1)
	  SHGetFolderPath_(0, CSIDL, #Null, 0, *String)
	  Protected String.s = PeekS(*String)
	  FreeMemory(*String)
	  ProcedureReturn String
	EndProcedure
	
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
	#CSIDL_APPDATA = 0
	
	Procedure.s SHGetFolderPath(CSIDL)
		ProcedureReturn GetHomeDirectory() + "Library/Application Support/"
	EndProcedure
CompilerEndIf