Ok, faggots...

Ok, faggots, give me an algorithm to show all the possible moves a knight can make in a chess board given it’s current position as input.
>inb4 do you own homework
Pic related is the desired output
I’ll post my solution in an hour.

do you own homework, faggot

You just increase/decrease one coord by one and the other by two.

do you own homework, faggot

Backtracking

Protest against your teacher. Chess coordinates are given with letters and numbers, not an ordered pair.

Chess is a crappy tactical turn based RPG developed by a bunch of monkeys.

Right away you'll notice Chess has no storyline. Instead, all you notice is the the White army and the Black army are fighting each other over
a battlefield. Note the "a battlefield," because Chess only has one story map.

As for the actual combat, it's extremely dull. Each unit can kill another with only one hit. This means units with a real good movement
ability dominate the field (more on that bellow). There aren't even any combat animations or anything that happens in combat. One unit moves
on it's space and "captures" it, and the piece is removed from the game with no form of action or special effects.

Yawn.

Chess has shitty class balance. The Queen is flat out overpowered while your actual front line units, the Pawns. can't do shit. I think the
developers were afraid that no one would use the female character so they buffed up her abilities really high but now theres no point in using any
other unit.

The rest of the units suck. Rooks can only move in 4 directions, same with Bishops. Boring. Also, whats up with the Knight? It has the most bizzare
combat abilities of all the units. They're retardly hard to use cause they jump around like retards to move and attack. The devs should have named
this unit Ninja, since Knights didn't jump around like that in real life.

Worst part, is the king. You see, the devs decided that if your king gets captured, you instantly lose the game. W-T-F? This wouldn't be a problem,
except that he can't move for crap. Seriously, the most important unit in the game can only move 1 space a turn? Good luck keeping him alive while
every other unit in the game dances around him.

Unbalanced classes, lackluster gameplay, and not to mention repetitive 1 hour+ games. Chess is not worth the time or your money.
Buy Final Fantasy Tactics or Disgaea instead.

3 out of 10.

Nice to see Sup Forums is here.

I'll make something in c++ chump

Go drink some bleach, shit for brains.

>t. web dev

I don't understand. gave you the answer.

that answer is wrong.

This... is actually impressive. Never thought anyone could get that much out of chess.

Sure it is, retard.

If the answer is right provide an algorithm using it.

>algorithm to show all the possible moves a knight can make in a chess board
#define ABS(a) ({ typeof (a) _a = (a); _a > 0 ? _a : -_a; })

int movesRequired(int A, int B) {
int X = 0, Y = 0;
int count = 0;
if (!(((A-X) % 2) ^ ((Y-B) % 2)))
return -1;
while (X != A && Y != B) {
int distX = A-X;
int distY = B-Y;
if (ABS(distX) > ABS(distY)) {
X += distX>0?2:-2;
Y += distY>0?1:-1;
} else {
X += distX>0?1:-1;
Y += distY>0?2:-2;
}
count++;
}
return count;
}

What's that even supposed to do?

>Do my homework for me. I spent the year playing Pokemon instead of paying attention in high school programming 100.

void knightMov(int a,int b){
int x,y;
cout

>Two for loops
You're right, that is pathetic

sir tn3s baraka mn tflya !

Stop it Rajesh, I've been proven this board can't code for shit.
Keep the smartphones and GPUs threads kids. way to go.

Read this sentence

shit like this is not esoteric or cool to read

it's fucking dogshit

make your shit readable instead of trying to make code a kool kids secret klub

It would be acceptable if it actually gave a solution to the problem.
truly the work of a pedantic retard.

is this pasta?

def possibilities(x,y,w,h):
"""1

Prelude> let list x y = [(a+x,b+y)| a let inverse (a,b) = (b,a)
Prelude> let valid x = x = 1
Prelude> let validpositions = filter (\(a,b) -> valid a && valid b)
Prelude> let final x y = validpositions $ completelist x y
Prelude> final 2 3
[(4,4),(4,2),(3,5),(1,5),(3,1),(1,1)]

indexed from one

What about Chess 2?

mmmm fuck yeah

>I’ll post my solution in an hour.

exposed for retard

List func(int[] i)
{
return new List() { new int[] { 1, 2 }, new int[] { -1, 2 }, new int[] { 1, -2 }, new int[] { -1, -2 }, new int[] { -2, -1 }, new int[] { 2, 1 }, new int[] { -2, 1 }, new int[] { 2, -1 } }
.Select(o => new int[] { o[0] + i[0], o[1] + i[1] })
.Where(o => (o[0] > 0 && o[1] > 0) && (o[0]