Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please create a number game in Excel with the following requirements and rules so that your program always wins the game against me. There are

Please create a number game in Excel with the following requirements and

rules so that your program always wins the game against me. There are 2

players: your code vs me and the target is to have the highest sum at the end

of the game.

There should be 2 buttons on Excel sheet. First one is the START button. When

I click on this button, there will appear 40 numbers (all are random integers

between 1 and 100) in the first row. 40 numbers should be generated randomly

which means that each time I start the game, the data set will be different.

For instance when I click on start button number generation can be like this:

We will not use the start button again unless we want to restart the game.

There will be a second button on the sheet which is called PLAY button. After

generating the data set, you will start to play the game. To see your move I will

click on Play button and one of the numbers from either most right or most left

side will disappear from the screen. Lets assume that your code deleted most

left number which was 95. You will earn 95 points by this move and the sheet

will be like this:

Then I will pick a number from most right or most left by selecting that cell,

deleting it and adding that number to my sum manually. Lets assume that I

select 43, deleted it and added this to my sum (B4). The updated screen will

be like this:

Now its your turn. I will click on Play button again and as previously your code

did, a number would be picked from most right or most left and that number

will be added to your sum (B3). Then I will make my move and I will click again

on the Play button for your move. I will repeat the same steps until there is no

number left in the screen. At the end of the game, the one who has a greater

sum will win the game.

If I click on Start at anytime during the game, the game should restart.

Please write a code with VBA which never loses the game against me.image text in transcribed

Please create a number game in Excel with the following requirements and rules so that your program always wins the game against me. There are 2 players: your code vs me and the target is to have the highest sum at the end of the game. There should be 2 buttons on Excel sheet. First one is the START button. When I click on this button, there will appear 40 numbers (all are random integers between 1 and 100) in the first row. 40 numbers should be generated randomly which means that each time I start the game, the data set will be different. For instance when I click on start button number generation can be like this: A B C D E F G H I J K L M N O AC AD AE AH AI AJ AK AL AM AN 1 41 80 46 60 75 64 33 47 29 3 74 52 74 52 54 EZ ZZ 62 85 62 24 2 16 55 11 34 87 37 61 38 49 10 4 77 21 22 22 11 E 43 2 We will not use the start button again unless we want to restart the game. There will be a second button on the sheet which is called PLAY button. After generating the data set, you will start to play the game. To see your move I will click on play button and one of the numbers from either most right or most left side will disappear from the screen. Let's assume that your code deleted most left number which was 95. You will earn 95 points by this move and the sheet will be like this: A B C D E F G H I J K L M N OF Q R S T U V W X Y Z AA AB AC AD AE AF AG AH AI AJ AK AL AM AN 80 46 60 75 64 33 47 29 3 74 52 74 62 6 62 22 62 85 62 24 2 16 56 11 34 87 61 21 2 22 11 6 43 3 You 41 4 Bora Then I will pick a number from most right or most left by selecting that cell, deleting it and adding that number to my sum manually. Let's assume that I select 43, deleted it and added this to my sum (B4). The updated screen will be like this: Q R S T U V W X Y Z MAB 62 54 E2 22 62 85 62 24 2 16 55 11 34 87 37 61 38 29 AGAI AJ AK AL AM AN 77 21 22 22 11 6 80 46 60 75 64 33 2 3 Vou 41 4 Bora 43 Now it's your turn. I will click on play button again and as previously your code did, a number would be picked from most right or most left and that number will be added to your sum (B3). Then I will make my move and I will click again on the Play button for your move. I will repeat the same steps until there is no number left in the screen. At the end of the game, the one who has a greater sum will win the game. If I click on Start at anytime during the game, the game should restart. Please write a code with VBA which never loses the game against me

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

3. Describe the communicative power of group affiliations

Answered: 1 week ago