We overheard two boys playing marbles near Quizmaster Towers, and this is what they said.

A: I've got more marbles than you have!

B: I bet you haven't - see for yourself

A: Okay, you have got more than me, but I'm the better player so I'll soon have more than you

B: You think so?

A: I do, and if I win three marbles from you I'll have twice as many as you'll have

B: You're on

[pause while they played]

A: Oh you're so lucky, I've never seen such a fluke

B: Told you I'd win

A: Yes, but you only won two

B: I might've won only two from you, but now I've three times as many marbles as you have

A: Right, you won't beat me again

[pause while they played again]

A: Oh I give up

B: Well you're going to have to give up, as I've got all your marbles

So how many marbles does player B now have?

From A's statement about winning three marbles we have A + 3 = 2(B - 3) or

A + 3 = 2B - 6 [1]

And from B's statement about winning two marbles we have 3(A - 2) = B + 2 or

3A - 6 = B + 2

Doubling both sides of this gives

6A - 12 = 2B + 4 [2]

If we subtract [1] from [2] we get

5A - 15 = 10

Adding 15 to both sides gives

5A = 25

And so A started with five marbles

Putting A = 5 back into [1] we get

5 + 3 = 2B - 6

So

2B = 5 + 3 + 6 = 14

B = 7

So B started with seven marbles and has won all of A's five marbles, and he now has 12