Open Side Menu Go to the Top

04-20-2012 , 03:08 PM
Quote:
Originally Posted by myNameIsInga
Anyone know how well Chess games perform on mobile platforms? Is the processing power to low for them to be any good? Not a good enough chess player to judge for myself
Android and iPhones both can run Shredder, which is one of the strongest chess engines in the world (although the mobile version is a downgrade in strength and no opening book).

If you input a standard position from the middle game and ask Shredder for the best move at what it deems 2600 strength, it will take around 15 seconds.


It is very impressive and only 7.99. I realize this may be an over-answer...but it gives you an idea of a smartphone's power with regards to chess.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
04-20-2012 , 03:14 PM
Yeah... two things to know here:

1) Chess engines are absurdly good and fast at this point.
2) Your phone's processor is pretty damn comparable to a laptop's processor. A new phone's CPU is ROUGHLY 1/3 as slow as a new laptop's. That's obviously significant, but it's far from crippling.

(GPUs are presumably much worse on phones. Not sure because I don't really get the GPU nomenclature.)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 03:37 PM
to neko(or any other haskell users), sorry for this again but

i need to count number of values in a list and put that number in a tuple with the value using the following to functions

Code:
count :: Eq a => a -> [a] -> Int
count n [] = 0
count n (x:xs) = if n == x then 1 + count n xs else count n xs

rd0:: Eq a => [a] -> [a]
rd0[] = []
rd0(x:xs) = x : rd0([c | c <- xs, c /= x])
sooo entering "abccbda"
will return : [(2,'a'), (2,'b'), (2,'c'), (1,'d')]

i thought something along the lines of but no work

Code:
f1:: Eq a => [a] -> [(Int, a)]
f1(x:xs) = [(y,z) | y <- (count n xs), z <- (rd0(x:xs))]
        where n = rd0(x:xs)

Last edited by Burnss; 04-20-2012 at 03:58 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 03:47 PM
Thanks for the input on chess and phones guys. Not looking to play chess or create a chess engine, but wanted an idea of if searching a game tree of a large game is realistic on phones. And it seems that it may be.

Brother and I have been toying with the idea of creating a Go game to run on Android. Searching in Go the same way as in Chess isn't possible since the game is to big, but most modern Go engines use either montecarlo or maybe combined with local search. Have some ideas Id like to play around with. Be an interesting side project. Seems that there may be a point in using search for some things since it works for chess on phones.

Thanks!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 04:51 PM
Quote:
Originally Posted by Ryanb9
Yeah I have a class that polls events and adds them to a que and my main loop is inside that class >.<. And the game im trying to copy is Minish Cap.
Heh... yeah, I would avoid making classes out of things like "input event handler", or "renderer", or especially "game". These are things that you're not going to ever have more than one of, so making them into classes is just going to waste your time and make things more complicated than they need to be. Resist the urge to make everything "generic"... this is the siren's song that will crash your ship into the object oriented rocks.

You'll probably have the urge to make a base class called "Renderable". Dont do that either.

Your renderer function should look something like this...
Code:
void render_everything()
{
   render_background();
 
   render_sprites();

   render_UI();
}

I think doing a 2d tile/sprite game like Minish Cap is a great kind of project... totally do-able. And I think you'll find the more time you spend on the actual gameplay and not trying to abstract key-presses, mouse movements, and webcam motion-captures into a generic event base class, the better the final product will be.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 05:20 PM
Quote:
Originally Posted by sng_jason
Heh... yeah, I would avoid making classes out of things like "input event handler", or "renderer", or especially "game". These are things that you're not going to ever have more than one of, so making them into classes is just going to waste your time and make things more complicated than they need to be. Resist the urge to make everything "generic"... this is the siren's song that will crash your ship into the object oriented rocks.

You'll probably have the urge to make a base class called "Renderable". Dont do that either.

Your renderer function should look something like this...
Code:
void render_everything()
{
   render_background();
 
   render_sprites();

   render_UI();
}

I think doing a 2d tile/sprite game like Minish Cap is a great kind of project... totally do-able. And I think you'll find the more time you spend on the actual gameplay and not trying to abstract key-presses, mouse movements, and webcam motion-captures into a generic event base class, the better the final product will be.
What! I thought everything was supposed to be made generic and be 100% object oriented! And in C# obviously! Are you telling me my teachers lied to me?!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 05:30 PM
Thanks Jason xD. And if you dont mind I have one more thing I'm looking for some help on. I have a class called Tile that has two ints, a PictureID and TypeID(walkable,ice,etc). So...I have a map creator that makes maps and saves them to a .map file. Then in the game, I have Area's which load a file which has locations to .map files. The area's are huge because they contain lots of maps so I load all the maps but I only render the maps in the players current screen. Thing is, I have some TileTypeID's which are entities (items or enemies). My Entity class needs to include Area because I need to get tiles around me to see if they are valid tiles to move to etc... So I need Entity to #include Area because Entities need to check tiles around them. But I also want (something like...) Area to #include Entity because if Tile#20 is TypeID of enemy, I want Area to make a new enemy.

The best thing I have come up with is this... when Area is load Maps, and a Map is loading Tiles, I check for any TypeID's that match the enum of "ItemSword" or "EnemyOctorock" etc and if they do load the TypeID,X,andY coord of that tile into a vector. This works but it seems sloppy to me and I was hoping you might know of a better way to do this.

sorry for TLDR
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 05:36 PM
Jason, this no OO in games got me curious; if OO is out the door, what are the advantages of C++ over C? Do you still use stuff like vector<>?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 05:48 PM
Aspire One 722 seems pretty cool so far. I got the red one because red is faster ldo. Installed Xubuntu 12.04 beta2 (6 days or whatnot untill release), pretty much everything worked out of the box (sticking to the open Radeon drivers). Installed Jupiter for power management + added a grub config line to save some power and am now in the process of installing Ruby via RVM
20 minutes battery life left untill the first charge/drain cycle is done.

Will instal Eclipse after the next charge and that should be a decent test of how much beef the machine has.

Libre Office is running fairly well, the Logitech R800 presenter thingy worked via plug+play as well. Gonna test monitor switching after my next recharge as well.

Pretty slick machine. I think I ultimately decided to get it because you could buy it without Windows, which is something I kind of want to support. The preinstalled Linpus Linux was command line only with non detected wireless card etc...gotta work on that, I wonder why they don't just ship with Ubuntu.

Quote:
Brother and I have been toying with the idea of creating a Go game to run on Android. Searching in Go the same way as in Chess isn't possible since the game is to big, but most modern Go engines use either montecarlo or maybe combined with local search. Have some ideas Id like to play around with. Be an interesting side project. Seems that there may be a point in using search for some things since it works for chess on phones.
Yeah that's something I may also be interested in down the line. 9x9 Go is pretty strong these days, bigger boards and it gets crushed by amateurs though..thus I'd begin with a 9x9. I also have a couple of board games for which I want to code AIs so I'll clone them. Stuff like Mr.Jack Pocket should work fairly well, maybe give a Ticket to Ride clone a shot as well (I'm a huge boardgame fan with a nice collection to draw from for these experiments )

Re: No OOP in games...meh there's some and it makes sense but events gonna event.

Quote:
You'll probably have the urge to make a base class called "Renderable".
Sprite :P

Last edited by clowntable; 04-20-2012 at 05:54 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 06:09 PM
Quote:
Originally Posted by myNameIsInga
Jason, this no OO in games got me curious; if OO is out the door, what are the advantages of C++ over C? Do you still use stuff like vector<>?
pretty sure he's not saying no OO. he's just saying keep your OO architecture simple. sorry if i'm putting words in your mouth jason, but no other interpretation makes sense.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 06:16 PM
Quote:
Originally Posted by gaming_mouse
pretty sure he's not saying no OO. he's just saying keep your OO architecture simple. sorry if i'm putting words in your mouth jason, but no other interpretation makes sense.
Yeah I read it as OO is good but OOOOOOOOOOOOO is not.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 06:25 PM
Quote:
Originally Posted by myNameIsInga
Thanks for the input on chess and phones guys. Not looking to play chess or create a chess engine, but wanted an idea of if searching a game tree of a large game is realistic on phones. And it seems that it may be.

Brother and I have been toying with the idea of creating a Go game to run on Android. Searching in Go the same way as in Chess isn't possible since the game is to big, but most modern Go engines use either montecarlo or maybe combined with local search. Have some ideas Id like to play around with. Be an interesting side project. Seems that there may be a point in using search for some things since it works for chess on phones.

Thanks!
Just to be clear, modern chess engines don't really search the game tree. Obviously they do a bit, but how they decide where to search and what evaluation function they use (and how they implement all the various algorithms) is quite fancy. I think most of them search pretty deep but prune the tree like crazy so that they don't have to search very wide.

Chess is estimated to have about 10^45 (give or take, ya know, a few factors of 10) game states, so with a GHz processor, which the ridic assumption that checking one game state takes one clock cycle, it would take the age of the universe to compute about one in 10^19 of the game states.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 06:55 PM
Quote:
Originally Posted by NoahSD
Just to be clear, modern chess engines don't really search the game tree. Obviously they do a bit, but how they decide where to search and what evaluation function they use (and how they implement all the various algorithms) is quite fancy. I think most of them search pretty deep but prune the tree like crazy so that they don't have to search very wide.

Chess is estimated to have about 10^45 (give or take, ya know, a few factors of 10) game states, so with a GHz processor, which the ridic assumption that checking one game state takes one clock cycle, it would take the age of the universe to compute about one in 10^19 of the game states.
Im quite aware they don't do a minimax search of the entire tree, but I think the basic approach is still some type of search with as you say a very aggressive pruning of the tree. Suspect they make heavy use of lookup tables for openings and end game as well. A big challenge I guess lies in finding a good way of evaluating the position.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 07:09 PM
Quote:
Originally Posted by myNameIsInga
Im quite aware they don't do a minimax search of the entire tree, but I think the basic approach is still some type of search with as you say a very aggressive pruning of the tree. Suspect they make heavy use of lookup tables for openings and end game as well. A big challenge I guess lies in finding a good way of evaluating the position.
This made me wonder is there a ... sport ... where instead of you playing chess vs him, your AI plays chess vs his AI with the same kind of time-limit-per-turn as normal chess? That sounds like fun xD
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 07:16 PM
Quote:
Originally Posted by sng_jason
Your renderer function should look something like this...
mine looks like this.
Code:
Game::OnRender()
{
   CSurface::OnDraw(Surf_Screen, Surf_Background);
 
   Area_Control.OnRender(Surf_Screen);

   for( .. EntityList.size() ..)
          p_Entity->OnRender(Surf_Screen);
  
   CSurface::OnDraw(Surf_Screen, Surf_Overlay);

}
this is an example function (maybe will give an idea of how bad im doing things >.<)
Spoiler:

Code:
void CPlayer::OnAnimate_Roll()
{
if(Anim_Control.BlitRow == ROW_MOVE_LEFT) 
	{
		if(Anim_Control.SetForcedFrames(0,ROW_ROLL_LEFT,SpriteColumnsInRow.at(ROW_ROLL_LEFT),&Event_Roll))
			CSounds::PlaySoundEffect(SoundEffect_Roll);
	}
	else if(Anim_Control.BlitRow == ROW_MOVE_RIGHT) 
	{
		if(Anim_Control.SetForcedFrames(0,ROW_ROLL_RIGHT,SpriteColumnsInRow.at(ROW_ROLL_RIGHT),&Event_Roll))
			CSounds::PlaySoundEffect(SoundEffect_Roll);
	}
	else if(Anim_Control.BlitRow == ROW_MOVE_UP) 
	{
		if(Anim_Control.SetForcedFrames(0,ROW_ROLL_UP,SpriteColumnsInRow.at(ROW_ROLL_UP),&Event_Roll))
			CSounds::PlaySoundEffect(SoundEffect_Roll);
	}
	else if(Anim_Control.BlitRow == ROW_MOVE_DOWN) 
	{
		if(Anim_Control.SetForcedFrames(0,ROW_ROLL_DOWN,SpriteColumnsInRow.at(ROW_ROLL_DOWN),&Event_Roll))
			CSounds::PlaySoundEffect(SoundEffect_Roll);
	}
	else if(!ACRow_Roll)
		Event_Roll = false; 

	if(ACRow_Roll)
	{
		if(ACRow_Left)	OnCreateDust( CRNG::GetRandomNumber(1,4), X+16,Y+6 );
		if(ACRow_Right)	OnCreateDust( CRNG::GetRandomNumber(1,4), X-8,Y+6 );
		if(ACRow_Up)	OnCreateDust( CRNG::GetRandomNumber(1,4), X+6,Y+16 );
		if(ACRow_Down)	OnCreateDust( CRNG::GetRandomNumber(1,4), X+6,Y );
	}

}

Last edited by Ryanb9; 04-20-2012 at 07:25 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 07:20 PM
Quote:
Originally Posted by Ryanb9
This made me wonder is there a ... sport ... where instead of you playing chess vs him, your AI plays chess vs his AI with the same kind of time-limit-per-turn as normal chess? That sounds like fun xD
Yes.. absolutely. There are also hybrid competitions where the computers are allowed to take human input. For example, http://en.wikipedia.org/wiki/World_C...s_Championship
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 10:07 PM
Quote:
Originally Posted by NoahSD
Yes.. absolutely. There are also hybrid competitions where the computers are allowed to take human input. For example, http://en.wikipedia.org/wiki/World_C...s_Championship
I believe the type of chess tournament you are looking for is called "Advanced Chess" It is when each player has a computer to help them figure out what moves they should play. This helps them avoid blunders and analyze various lines.

http://en.wikipedia.org/wiki/Advanced_Chess
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 10:45 PM
Quote:
Originally Posted by MelchyBeau
It is when each player has a computer to help them figure out what moves they should play. This helps them avoid blunders and analyze various lines.
kinda like online poker heh
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-20-2012 , 11:16 PM
Quote:
Originally Posted by Burnss
to neko(or any other haskell users), sorry for this again but

i need to count number of values in a list and put that number in a tuple with the value using the following to functions

Code:
count :: Eq a => a -> [a] -> Int
count n [] = 0
count n (x:xs) = if n == x then 1 + count n xs else count n xs

rd0:: Eq a => [a] -> [a]
rd0[] = []
rd0(x:xs) = x : rd0([c | c <- xs, c /= x])
sooo entering "abccbda"
will return : [(2,'a'), (2,'b'), (2,'c'), (1,'d')]

i thought something along the lines of but no work

Code:
f1:: Eq a => [a] -> [(Int, a)]
f1(x:xs) = [(y,z) | y <- (count n xs), z <- (rd0(x:xs))]
        where n = rd0(x:xs)

You're sort of on the right track. You want to iterate over all of the unique elements in your input (a.k.a rd0 xs) and then count the number of times they occur in the input.

So if you did:

Code:
let f xs = [count x xs | x <- rd0 xs]
then calling f "abccbda" we can imagine following the values through the function like so:

Code:
f xs        = [count x xs | x <- rd0 xs]
f "abccbda" = [count x "abccbda" | x <- rd0 "abcccbda"]
            = [count x "abccbda" | x <- "abcd"]
            = [2, 2, 2, 1]
So we're pretty much already at the solution since we can just create a tuple of x and the count of x:
Code:
let f xs = [(count x xs,x) | x <- rd0 xs]
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2012 , 12:43 AM
Any difference between a class with nothing but static functions and a class with normal functions that is only used via a static ... "instance" of that class?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2012 , 12:46 AM
Quote:
Originally Posted by Ryanb9
Any difference between a class with nothing but static functions and a class with normal functions that is only used via a static ... "instance" of that class?
The first one is stateless.

The second one is a singleton and can have state.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2012 , 01:30 AM
Quote:
Originally Posted by Chips Ahoy
The first one is stateless.

The second one is a singleton and can have state.
Don't think the singleton part is even true. For example, multiple other classes could have static member instances of the class in question, all with different state. Can't think offhand of a good use for that, but probably some exists.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2012 , 04:17 AM
Quote:
Originally Posted by Ryanb9
Any difference between a class with nothing but static functions and a class with normal functions that is only used via a static ... "instance" of that class?
Not really afaik. The only real difference is that with the singleton pattern you have more flexibility because you can use virtual functions.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2012 , 06:16 AM
Quote:
Originally Posted by Ryanb9
This made me wonder is there a ... sport ... where instead of you playing chess vs him, your AI plays chess vs his AI with the same kind of time-limit-per-turn as normal chess? That sounds like fun xD
I know this exists for other games in various AI departments. My ex-university had this for some Iranian card game and now Bridge as well. Students coded AIs in Prolog for the games in AI3 (AI1=Prolog, AI2=Russell/Norvig pretty much) and at the end of the semester they competed in a tournament. Our AI shipped the cheese ldo mostly because we optimized the right stuff, I think some other AIs were more sophisticated overall.

For ethical poker bots this exists as well.
http://www.computerpokercompetition.org/

I think it would be fun to submit a HU bot for this that basically plays with the heuristics I use. Maybe for 2013
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-21-2012 , 08:49 AM
Quote:
Originally Posted by Neko
You're sort of on the right track. You want to iterate over all of the unique elements in your input (a.k.a rd0 xs) and then count the number of times they occur in the input.

So if you did:

Code:
let f xs = [count x xs | x <- rd0 xs]
then calling f "abccbda" we can imagine following the values through the function like so:

Code:
f xs        = [count x xs | x <- rd0 xs]
f "abccbda" = [count x "abccbda" | x <- rd0 "abcccbda"]
            = [count x "abccbda" | x <- "abcd"]
            = [2, 2, 2, 1]
So we're pretty much already at the solution since we can just create a tuple of x and the count of x:
Code:
let f xs = [(count x xs,x) | x <- rd0 xs]
you're possibly my fav poster on 2+2 atm! ha, will try to do the rest all by myself
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m