Create an n by m array

Assignment Help Basic Computer Science
Reference no: EM13165712

Create an n by m array (n, m input by user). Initialize all cells in array to 0. The bug starts at cell 1,1. The bug can jump from its cell to any neighboring cell (left, right, up, down, diagonal) -- so there are at most 8 neighboring cells. Though, for example, cell 1, 1, has only 3 neighboring cells, If the bug tries to jump of of the array, ignore that move. A move is determined by generating a random number between 1 and 8.

1 -- jump left
2 -- jump right
3 -- jump up
4 -- jump down
5 -- jump up and right
6 -- jump up and left
7 -- jump down and right
8 -- jump down and left

Count how many moves it takes until the bug has visited each cell at least once. Display the array after each move, with a count for each cell of how many times the bug has visited that cell as well as what is the bug's current location.

Reference no: EM13165712

Questions Cloud

A[0..n-1] and b[0...n-1] are sorted arrays : A[0..n-1] and B[0...n-1] are sorted arrays where each contains n numbers. Design an O(n*log(n)) algorithm to find the median of all elements in arrays X and Y.
Evaluate the molarity of the hcl solution : How many mmoles of HCl reacted with the Na2CO3? c. Calculate the molarity of the HCl solution.
State what is the order of the reaction with respect to h2o2 : If a second experiment is done with half as much H2O2 as the experiment in question 1, and the solution turns blue in 180 seconds, what is the order of the reaction with respect to H2O2?
State potassium iodide required sodium thiosulfate titrant : In an acidic solution (with an excess of iodate), the titration of a 25 mL sample of potassium iodide required 26.51 mL of 0.0949M sodium thiosulfate titrant.
Create an n by m array : Create an n by m array (n, m input by user). Initialize all cells in array to 0. The bug starts at cell 1,1. The bug can jump from its cell to any neighboring cell (left, right, up, down, diagonal) -- so there are at most 8 neighboring cells. Thou..
Disubstituted alkene was formed in which the olefinic proton : disubstituted alkene was formed in which the olefinic protons exhibited a vicinal coupling of 9.0Hz in the H NMR. What is the stereochemistry
Marie program that will input a variable : To develop a MARIE program that will input a variable number of user entered Decimal whole number grades, validating each one (0-100) in a subroutine
Write a function that computes length of a character string : Write a function that computes the length of a character string (i.e. write your own implementation of the strlen function.
State hydrangeas are flowers that retain blue coloration : Hydrangeas are flowers that retain blue coloration when grown in acidic soil and pink when grown in neutral or alkaline soil

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Calculate roots of function by newton-raphson approximation

Best known iterative method for calculating roots of a function f (that is, x-values for which f(x) is 0) is Newton-Raphson approximation.

  True and false

A.  (True | False) In the MSP430's active mode, the MCLK and SMCLK clocks are up and running and ACLK is not running (it is turned off).

  Which installation is suitable for customer tracking system

Which installation options are available for Customer Tracking System? Which would you suggest? How can you determine if implementation has been successful?

  Discuss the issues that managing and implementing

Discuss the issues that managing and implementing the technology architecture you would have and how you would overcome these challenges. Be sure to discuss at least three challenges.

  What is the order of the public key?

the weaknesses that arise in Elgamal encryption if a public key of small order is used. We look at the following example. Assume Bob uses the group Z ? 29 with the primitive element ?= 2. His public key is ?= 28.

  Discussion on computer future

After reading about programming languages and their capabilities, consider all of the devices in your home that have a computer. Where will computer programming and the use of computers go in the future?

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Procedure for checking suitcases for secret compartments

You are responsible for checking suitcases for secret compartments in which bulky items like jewelry might be hidden. Explain procedure you would follow to check for these compartments.

  Explaining organization management responsibilities

Describe in scholarly detail common organization management responsibilities.

  Why is it important to educate users about risks

what is a primary security risk that users should acknowledge when using macros? Why is it important to educate users of these risks once their dilemma is resolved?

  Local telephone calls and long distance telephone calls

Will the distinction between local telephone calls and long distance telephone calls ever disappear? What may cause this to happen?

  Deliverable associated required to complete process

Explain in scholarly detail department expense predicting processes and deliverable associated required to complete process.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd