title: Replacing one specific item inside a 2dArray in numPy
body: <p>I'm trying to script a battleship game (i.e. where you say "B4" and the enemy says "HIT")</p>
  
  <p>Actually i'm trying to let the pc randomly pick the ship position. Everything is ok but now i need to change the value of the choosen box in "X" or something different.</p>
  
  <pre class="lang-py prettyprint-override"><code>from random import *
  import numpy as np
  
  def nuovaPartita():
  
      campo = np.arange(100).reshape(10,10)
      navi = [
          [True, True],
          [True, True],
          [True, True],
          [True, True],
          [True, True, True],
          [True, True, True],
          [True, True, True],
          [True, True, True, True],
          [True, True, True, True],
          [True, True, True, True, True]
      ]
  
      direzioni = [0,1,2,3]
  
  
  
      for x in navi:
          posTrovata = False
          while posTrovata == False:
  
              lenNave = len(x)
              scegliCasella = choice(choice(campo))
              scegliDirezione = choice(direzioni)
              posCasella = np.where(campo == scegliCasella)
  
              R = int(posCasella[0])
              C = int(posCasella[1])
              print("============================\nHo scelto la casella: {}\nLunghezza nave: {}".format(scegliCasella, lenNave))
  
              if scegliDirezione == 0:                     
                  print("Vado in alto")
                  chunk = campo[R-(lenNave - 1): R+1, C]
                  if int(chunk.shape[0]) &lt; lenNave:
                      print("Assolutamente")
                      posTrovata = False
                  else: 
                      posTrovata = True
                      print("La nave si trova nelle caselle")
                      print(chunk)
  
              elif scegliDirezione == 1:
                  print("Vado a destra")
                  chunk = campo[R, C: C + lenNave ]
                  if int(chunk.shape[0]) &lt; lenNave:
                      print("Assolutamente")
                      posTrovata = False
                  else: 
                      posTrovata = True
                      print("La nave si trova nelle caselle")
                      print(chunk)
  
  
              elif scegliDirezione == 2:
                  print("Vado in basso")
                  chunk = campo[R: R+lenNave, C]
                  if int(chunk.shape[0]) &lt; lenNave:
                      print("Assolutamente")
                      posTrovata = False
                  else: 
                      posTrovata = True
                      print("La nave si trova nelle caselle")
                      print(chunk)
  
  
              elif scegliDirezione == 3:
                  print("Vado a sinistra")
                  chunk = campo[R, C - lenNave: C]
                  if int(chunk.shape[0]) &lt; lenNave:
                      print("Assolutamente")
                      posTrovata = False
                  else: 
                      posTrovata = True
                      print("La nave si trova nelle caselle")
                      print(chunk)
  
  
      print(campo)
  
  
  def main():
      nuovaPartita()
  
  
  if __name__ == "__main__":
  
      main()
  
  </code></pre>
  
  <p>Now, if i display the field (named "campo") I get this</p>
  
  <pre><code>[[ 0  1  2  3  4  5  6  7  8  9]
   [10 11 12 13 14 15 16 17 18 19]
   [20 21 22 23 24 25 26 27 28 29]
   [30 31 32 33 34 35 36 37 38 39]
   [40 41 42 43 44 45 46 47 48 49]
   [50 51 52 53 54 55 56 57 58 59]
   [60 61 62 63 64 65 66 67 68 69]
   [70 71 72 73 74 75 76 77 78 79]
   [80 81 82 83 84 85 86 87 88 89]
   [90 91 92 93 94 95 96 97 98 99]]
  </code></pre>
  
  <p>Now, assume I have a warship on [54, 55, 56, 57] and a warship on [31, 41, 51], how could I replace those boxes int with, for example, "x"?</p>