Find shortest path with Conway's Game of Life? - conways-game-of-life

Imagine N x N board. There is a robot in one box and exit place in another box. Is there any way to find shortest path from robot to exit place with using Conway's Game of Life ? I am really stucked

Although Conway's game of life is technically turing-complete, I'd advise you to try literally anything else to try to compute this sort of stuff.

Related

How should i make infinte ground ?

I'm trying to make a simplified version of crazy taxi . For the first step i need to make an infinite ground . I'VE searched online but couldn't find any examples .
Can i find any example of how to do this ?
https://www.youtube.com/watch?v=rhTPxrJICVg&list=PLLH3mUGkfFCXQcNBz_FZDpqJfQlupTznd
N3K makes an infinite runner in Subway Surfers style, meaning ground coming from the back and going towards the camera.
The above link is to his tutorial series.
This is a very broad question I try to give a very simplified answer to get you going.
To create endless road you need some sort of procedural function that generates corners for your track. If you do not need to backtrack you can cook something up yourself like (in X distance turn X degrees to the right). If you do need to backtrack you need something like perlin/simplex noise that always generates the same value based on 1 or more other values. You could use total distance to get the curve in the road.
You simply keep generating the world on the fly and unload pieces of the world you don't need any more. If the player can alter the world like destroying street furniture or leaving skitmarks you need to implement a chunk system. When you backtrack and generate a cerain part of the world with your procedural function you can have permanent changes the player made in that specific part by saving and loading to the chunk. Much like Minecraft does it actually.

To use GKAgents or not

I am developing (or atleast trying to develop)
a decently big real time tactics game (something similar to RTS) using SpriteKit.
I am using GamePlay kit for pathfinding.
Initially I used SKActions to move the sprites within the Path but fast enough I realized that it was a big mistake.
Then I tried to implement it with GKAgents (this is my current state)
I feel that GKAgents are very raw and premature also they are following some strange Newton Law #1 that makes them to move forever (I can't think of any scenario where it would be useful - maybe for presentations at WWDC)
as well as I see that they have some Angular speed to perform rotations
which I don't need at all and can't really find how to disable it...
As well as GKBehaviors given a GKGoals seems to make some weird thing...
Setting behavior to avoid obstacles makes my units to joggle around them...
Setting behavior with follow path goal completely ignores everything unless the maxPredictionTime is low enough...
I am not even willing to tell what happens when I combine both them.
I feel broken...
I feel like I have 2 options now:
1) to struggle more with those agents and trying to make them behave as I wish
2) To roll all the movement on my own with help by GKObstacleGraph and a path Finding (which is buggy as well I have to say at some points the path to the point will generate the most awful path like "go touch that obstacle then reverse touch that one then go to the actual point (which from the beginning could be achieved by a straight line)").
Question is:
What would be the best out of those options ?
One of the best ways (in SpriteKit/GameplayKit) to get the kind of behavior you're after is to recognize that path planning and path following need not be the same operation. GameplayKit provides tools for both — GKObstacleGraph is good for planning and GKAgent is good for following a planned path — and they work best when you combine the strengths of each.
(It can be a bit misleading that GKAgent provides obstacle avoidance; don't think of this in the same way as finding a route around obstacles, more like reacting to sudden obstacles in your way.)
To put it another way, GKObstacleGraph and GKAgent are like the difference between navigating with a map and safely driving a car. The former is where you decide to take CA-85 and US-101 instead of I-280. (And maybe reevaluate your decision once in awhile — say, to pick a different set of roads around a traffic jam.) The latter is where you, continuously moment-to-moment, change lanes, avoid potholes, pass slower vehicles, slow down for heavy traffic, etc.
In Apple's DemoBots sample code, they break this out into two steps:
Use GKObstacleGraph to do high level path planning. That is, when the bad guys are "here" and the hero is "way over there", and there are some walls in between, select a series of waypoints that roughly approximates a route from here to there.
Use GKAgent behaviors to make the character roughly follow that path while also reacting to other factors (like making the bad guys not step on each other and giving them vaguely realistic movement curves instead of simply following the lines between waypoints).
You can find most of the relevant stuff behind this in TaskBotBehavior.swift in that sample code — start from addGoalsToFollowPath and look at both the places that gets called and the calls it makes.
As for the "moving forever" and "angular speed" issues...
The agent simulation is a weird mix of a motivation analogy (i.e. the agent does what's needed to move it toward where it "wants" within constraints) and a physics system (i.e. those movements are modeled like forces/impulses). If you take away an agent's goals, it doesn't know that it needs to stop — instead, you need to give it a goal of stopping. (That is, a movement speed goal of zero.) There might be a better model than what Apple's chosen here — file bugs if you have suggestions for design improvements.
Angular speed is trickier. The notion of agents' intrinsic physical constraints being sort of analogous to, say, vehicles on land or boats at sea is pretty well baked into the system. It can't really handle things like space fighters that have to reorient to vector their thrust, or walking creatures that can just as happily walk sideways or backwards as forward — at least, not on its own. You can get some mileage toward changing the "feel" of agent movement with the maxAcceleration property, but you're limited by the fact that said property covers both linear and angular acceleration.
Remember, though, that the interface between what the agent system "wants" and what "actually happens" in your game world is under your control. The easiest way to implement GKAgentDelegate is to just sync the velocity and position properties of the agent and the sprite that it represents. However, you don't have to do it that way — you could calculate a different force/impulse and apply it to your sprite.
I can't comment yet so I post as an answer. I faced the same problem recently: agent wiggling around the target or the agent that keeps moving even if you remove the behavior. Then I realized that the behavior is just the algorithm controling the movement, but you can still access and set the agent's speed, position and angle by hand.
In my case, I have a critter entity that chases for food in the scene. When it makes contact with the food agent, the food entity is removed. I tried many things to make the critter stop after eating the food (it would keep going in a straight line). And all I had to do was to set its speed to 0. That is because the behavior will influence not the position directly, but the speed/angle combination instead (from what I understand). When there is no goal for the entity, it doesn't "want" to change it's state, so whatever speed and direction it reached, it will keep. It will simply not update/change it. So unless you create a goal to make it want to stop, it will wiggle/keep going. The easy way is to set the behavior to nil and set the speed to 0 yourself.
If the behavior/goal system doesn't do it for the type of animation you are looking for, you can still use the Agent system and customize the movement with the AgenDelegate protocol and the update method and make it interact with other agents later on. You can even synchronize the agent with a node that is moved with the physics engine or with actions (or any other way).
I think the agent system is nice to keep around since you can use it later, even if it's only for special effects. But just as mixing actions and physics can give some weird results, mixing goal/behaviors and any other "automated" tool will probably result in an erratic behavior.
You can also use the agent system for other stuff than moving an actual sprite around. For example, you could use an agent to act as a "target seeker" to simulate reaction time for your enemies. The agent moves around the scene and finds other agents, when it makes contact with a suitable target, the enemy entity would attack it (random idea).
It's not a "one size fits all" solution, but it's a very nice tool to have.

obstacle avoidance implementation in matlab

This could be a really broad question, but if you can help me with ideas, it would be a great help to me.
I am trying to implement basic path finding algorithm in matlab. I have to create a map where the robot can navigate and also avoid obstacles and reach destination. I have the algorithm fine with me. But am struggling with the gui as I haven't used much of Gui in matlab.
This is the following idea I had.
I created a plot and just defined 4 coods for each obstacle, destination as a circle and a start point. But am stuck when I think how I can detect whether the robot has hit an obstacle or not. One way is to create the equation of line and try to see if the point ever comes to lie on it. But the movement is based ona random generated variable. Thus it is possible for the robot to cross the line and get inside the polygon.
My apologies for bein too elaborate, but can you please tell me the best way to implement this in matlab? It is mandatory to do this in matlab. Please suggest me a better and easy way to program it. Thanks in advance.
If your obstacles are all polygons you could try to use the ray casting algorithm described on the following wikipedia site.
Point in polygon algorithm
With this you should be able to determine if the robot position lies within an obstacle, or you could determine if the next movement will bring the robot into contact with the obstacle.
If you are looking for a simple algorithm that can take care of obstacles inherently i would suggest the potential fields algorithm (can get stuck in certain cases)
Potential Fields
else you can also try the A* algorithm, which is better in my opinion; Good description of A*

Help Required in Collision Detection Using Box2d

After some sample projects, I have started with my first game in cocos 2d and box 2d where objects fall from a parachute and you kill them using slingshot. Now i'm stuck # couple of things for a while:
Collision Issue:
Using Box 2d i have made collision with objects. However when i add a counter to get a count of my collision i doesn't work. Counter increases even though the percentile is moved out of the screen.Don't know how to get rid of this.
I'm trying to get random rotation to my sprites which fall from above, Like a parachute experience. Now all of then rotate # a same angle.
Lastly i need to get rid of the surrounding sprites when collision happens. Ex: When the percentile collides with a falling object, in a radius of 2.5 cms the other sprites should also disappear.
I Badly need help and suggestions, hence all the 3 questions # once :-). I have provided the link for my project so that you can look # the source code. Desperately looking for your help guys!!!
Download Source Code:
http://jumbofiles.com/6fn5mmpnq1q8/Karthik.zip.html
Budding Developer,
Karthik
You have a pretty good tutorial here: http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12
I think that one can solve your problems :)
You can get the best tutorial for the particular requirement you have described over here.....
The link for that is as follows
http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone
The tutorial is of 2 parts and describes the code briefly.. The code of that is described and you can get good amount of help from there.
ques 1 + 3: you need read link which share by Mikael and Marine
ques 2: in cocos2d, if you want get random value, you can use support function (such as: rand(), random(), CCRANDOM_0_1() ....)... i think, you need set rotation value for object. i dont know your problem, you need explain it (link is "File Not Found or Deleted / Disabled due to inactivity or DMCA")

Car crash simulation

I want to ask you How can I make simulation of car crash ?
On the internet I found http://www.gamedev.net/reference/articles/article1459.asp .
I think about using finite-element-method, but now I think it is too difficult for me :/
Do you know any good, not too accurate and not very hard-to-learn methods to simulate collision of two bodies ( two cubic cars ) with deforming?
My first idea was to made these cars with some number of rigid bodies, and connect them, but I don't know if it is good idea :/
Try reading this paper for starters. This and the references therein should point you in the right direction, more or less.