Question

This problem investigates a two-level randomization problem useful tor applications lke video game programming (Think: Progra

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB Script:

close all
clear
clc

v = 1:20;
v_new = randLocation(v)

v = [30; 6.22; 11; 8.95; -13; 54];
v_new = randLocation(v)

function v = randLocation(v)
numElements = length(v);
randInd = randi(numElements);
v(randInd) = 0;
end

Output:

v_new =
1 2 3 4 0 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
v_new =
30.0000
6.2200
0
8.9500
-13.0000
54.0000

Add a comment
Know the answer?
Add Answer to:
This problem investigates a two-level randomization problem useful tor applications lke video game programming (Think: Programming a computer on easy" to play against you at tic-tac-loe, where it...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You will create a PYTHON program for Tic-Tac-Toe game. Tic-Tac-Toe is normally played with two people....

    You will create a PYTHON program for Tic-Tac-Toe game. Tic-Tac-Toe is normally played with two people. One player is X and the other player is O. Players take turns placing their X or O. If a player gets three of his/her marks on the board in a row, column, or diagonal, he/she wins. When the board fills up with neither player winning, the game ends in a draw 1) Player 1 VS Player 2: Two players are playing the game...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT