I need someone to write me a basic code please!!

Hi, I am learning basic programming with R, and I desperately need someone to write me a PSEUDO code and code for it please: Here's the situation

"you have been sentenced to die tomorrow, but you're offered a way out...
you get given 12 red balls and 12 blue balls together with two urns, you can distribute these however you want amongst the two urns. When the executioner arrives tomorrow he will randomly select an urn and draw a ball from it, if its blue you live, red you die. All balls must be in the urns and no urn should be empty."
let k be the number of balls you put in the first urn,
let i be the number of blue balls you put in the first urn.
The code then needs to:
randomly select an urn, randomly select a ball.
it should do this N times and give an output of how many times you survive out of the N repetitions.
N, i and k dont have to be inputted by the user!
Thank you in advance.


Ambassador to the humans
Hi! :welcome: We are glad that you posted here! This looks like a homework question though. Our homework help policy can be found here. We mainly just want to see what you have tried so far and that you have put some effort into the problem. I would also suggest checking out this thread for some guidelines on smart posting behavior that can help you get answers that are better much more quickly.
The homework is to just investigate the problem, i thought id try using R to investigate it, some people are using theory, python etc, so if i had a basic code to get me started i could modify it for certain conditions, like bias from the executioner, more balls or more urns. I have already proved theoretically that, by conditioning the urn the executioner picks, that the probability of your survival is 12i-ki+6k/k(24-k) where i is the number of blue balls in the first urn and k is the number of balls in the first urn, i did this by using the law of total probability.
The actual code is not the homework, just i thought i'd compare it to the theory, and see if I can see anything else from it, like an extension really
thanks for the information:)
start with this hint:

    ... Pick urn 1 ...
   rbinom(1,k,pb) ...  # k = number balls in urn 1, pb = proportion blue balls in urn 1
but a simulation really isn't needed here, there's a simple probability statement for this. you can use your code to reassure yourself that you're using the right probability statement