Homework Help for Engineering

554 results

Engineering is the knowledge oriented towards the invention and use of techniques for the exploitation of natural resources or for industrial activities.

For unlimited access to Homework Help, a Homework+ subscription is required.

Avatar image
sapphiregiraffe9958295 asked for the first time
Avatar image
pxxx16342 asked for the first time
Avatar image
mirra asked for the first time
in Engineering·
29 Oct 2021
You will implement the two player version. One player will be the computer (i.e. your program) and the other a use! of your program. In what follows, let's refer to the computer player as Robot and user player as Human. You may assume that Robot will always deal the cards.
 
As part of this assignment I provided the file called a4_GAME_xxxxxx.py. Replace x x x x x x in the file name with your student number. You should open that file and run it to see what it does already. All of your code must go inside of that file. The file already has some functions that are fully coded for you and other functions for which only docstrings and partial or no code are provided. Designing your program by decomposing it into smaller subproblems (to be implemented as functions) makes programming easer, less prone to errors and makes your code more readable.
No part of the given code can be changed. Your code must go into clearly indicated places. No code can be added to the main. You can design some extra functions of your own if you like.
Functions make_deck, wait_for_player and shuffle_deck are already fully coded for you.
You need to develop the remaining functions: deal_cards, remove_pairs, print_deck, get_valid_input, and play_game. The functions must meet the requirements as specified in their docstrings (and as implied by the example program runs below and as implied by the video instructions).
 
The main bulk of your code (the game playing part) will go into the function called play_game. That function should use/call the other functions that you are required to develop (i.e. deal_cards, remove_pairs, print_deck, and get valid input).
 
When developing function get_valid_input you may assume that Human will enter integer when asked for an integer, but you may not assume that it will be in the correct range.
 
The function get_valid_input gets the input from Human about which face-down card of Robot it wants. When it is Robot's turn to play you must implement it such that Robot takes a random card from Human. Also recall that what Human calls 3rd card, for example, is in position/index 2 in Robot's deck (as it is represented by a list).
 
Study the example of the program run below carefully to understand how your program should behave. The behaviour of the program that you see in the run is required s all aspects of it. Also watch the video I made to get even better idea of how your program must behave. The video can be found here: https://youtu.be/ Dmh5Rsdwn18
 
Some suggestions:
  • Study the provided code and understand what it does and how it should be used.
  • Spend some time thinking about various parts of the game that need to be implemented. For example, it needs to be able to display Human's deck to Human, it needs to be able to ask Human for what card she wants, it needs to be able to remove pairs from either Human or Robot's deck... etc. The provided functions do quite of bit of that job for you.
  • When you are coding individual functions recall that you can test each function in the shell without finishing the remaining functions. For example, when implementing function remove_pairs you can test it in the shell by typing something like:

Thus you can code and test your functions one by one (without completing the other parts)
  • The game alternates between Robot and Human. Think about how you can represent whose turn it is to play, in your program. One way is to have a variable that you set to zero when it is Robot's turn and to one when it is Human's turn. You also need to figure out what to test to see if the game is over.

 

 

The output:

=================================================== =======================
Game 1
=================================================== =======================
Hello. My name is Robot and I deal the cards.
Your hand of cards is:
7 ♣ 9 ♢ 10 ♣ 9 ♠ J ♠ 8 ♣ 3 ♡ Q ♢ 6 ♡ J ♢ 3 ♢ 6 ♠ Q ♡ 7 ♢ 7 ♡ 5 ♣ Q ♠ 9 ♡ K ♠ 6 ♣ 5 ♢ 2 ♠ A ♣ 4 ♡ 4 ♣
2 ♣
Don't worry, I can't see your cards or their order.
Now discard all pairs from your hand. I will do it me
too.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
10 ♣ 9 ♢ 6 ♣ 7 ♣ Q ♢ 8 ♣ K ♠ A ♣
I have 9 cards. If 1 is the position of my first card and
9 position of my last map, which of my maps do you want?
Please enter an integer from 1 to 9: 1
You asked for my 1st card.
Here it is. It's an A ♢
With A ♢ added, your hand is:
10 ♣ 9 ♢ 6 ♣ 7 ♣ Q ♢ 8 ♣ K ♠ A ♣ A ♢
After you've discarded all the pairs and shuffled the cards, your hand is:
6 ♣ 7 ♣ K ♠ Q ♢ 8 ♣ 10 ♣ 9 ♢
Press Enter to continue.
*************************************************** *********
My turn.
I took your 6th card.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
6 ♣ 7 ♣ K ♠ Q ♢ 8 ♣ 9 ♢
I have 7 cards. If 1 is the position of my first card and
7 the position of my last map, which of my maps do you want?
Please enter an integer from 1 to 7: 6
You asked for my 6th card.
Here it is. It's a 7 ♠
With 7 ♠ added, your hand is:
6 ♣ 7 ♣ K ♠ Q ♢ 8 ♣ 9 ♢ 7 ♠
After you've discarded all the pairs and shuffled the cards, your hand is:
6 ♣ K ♠ Q ♢ 8 ♣ 9 ♢
Press Enter to continue.
*************************************************** *********
My turn.
I took your 4th card.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
6 ♣ K ♠ Q ♢ 9 ♢
I have 5 cards. If 1 is the position of my first card and
5 the position of my last card, which of my cards do you want?
Please enter an integer from 1 to 5: 5
You asked for my 5th card.
Here it is. It's a 6 ♢
With 6 ♢ added, your hand is:
6 ♣ K ♠ Q ♢ 9 ♢ 6 ♢
After you've discarded all the pairs and shuffled the cards, your hand is:
9 ♢ Q ♢ K ♠
Press Enter to continue.
*************************************************** *********
My turn.
I took your 1st card.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
Q ♢ K ♠
I have 3 cards. If 1 is the position of my first card and
3 the position of my last card, which of my cards do you want?
Please enter an integer from 1 to 3: 2
You asked for my 2nd card.
Here it is. It's a Q ♣
With Q ♣ added, your hand is:
Q ♢ K ♠ Q ♣
After you've discarded all the pairs and shuffled the cards, your hand is:
K ♠
Press Enter to continue.
*************************************************** *********
My turn.
I took your 1st card.
Press Enter to continue.
*************************************************** *********
You have completed all the cards.
Congratulation! You, Human, you won.

=================================================== =======================
Game 2
=================================================== =======================
Hello. My name is Robot and I deal the cards.
Your hand of cards is:
6 ♠ Q ♡ Q ♣ 9 ♡ A ♡ 3 ♠ 4 ♣ 6 ♣ J ♢ 10 ♢ 5 ♢ 3 ♣ J ♡ K ♠ K ♡ A ♣ 8 ♡ 10 ♣ 4 ♢ 5 ♣ 3 ♡ 10 ♠ 3 ♢ 7 ♢
Q ♠ J ♠
Don't worry, I can't see your cards or their order.
Now discard all pairs from your hand. I will do it me
too.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
Q ♣ 10 ♣ J ♢ 7 ♢ 9 ♡ 8 ♡
I have 5 cards. If 1 is the position of my first card and
5 the position of my last card, which of my cards do you want?
Please enter an integer from 1 to 5: 7
Invalid position. Please enter an integer from 1 to 5: 5
You requested my 5th card.
Here it is. It's an 8 ♣
With 8 ♣ added, your hand is:
Q ♣ 10 ♣ J ♢ 7 ♢ 9 ♡ 8 ♡ 8 ♣
After you've discarded all the pairs and shuffled the cards, your hand is:
10 ♣ 7 ♢ J ♢ Q ♣ 9 ♡
Press Enter to continue.
*************************************************** *********
My turn.
I took your 2nd card.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
10 ♣ J ♢ Q ♣ 9 ♡
I have 3 cards. If 1 is the position of my first card and
3 the position of my last card, which of my cards do you want?
Please enter an integer from 1 to 3: 2
You asked for my 2nd card.
Here it is. It's a 9 ♣
With 9 ♣ added, your hand is:
10 ♣ J ♢ Q ♣ 9 ♡ 9 ♣
After you've discarded all the pairs and shuffled the cards, your hand is:
J ♢ Q ♣ 10 ♣
Press Enter to continue.
*************************************************** *********
My turn.
I took your 3rd card.
Press Enter to continue.
*************************************************** *********
Your turn.
Your hand is:
J ♢ Q ♣
I have 1 card. If 1 is the position of my first card and
1 the position of my last card, which of my cards do you want?
Please enter an integer from 1 to 1: 1
You asked for my 1st card.
Here it is. It's a Q ♢
With Q ♢ added, your hand is:
J ♢ Q ♣ Q ♢
After you've discarded all the pairs and shuffled the cards, your hand is:
J ♢
Press Enter to continue.
I have finished all the cards.
You lost! Me, Robot, I won.

Avatar image
mousslai875 asked for the first time
Avatar image
nokwandamohaleroe asked for the first time
Avatar image
helpmeplss asked for the first time
Avatar image
byzantiummuskrat3607426 asked for the first time

Figure (a) below shows a mono truss that will be used for the extension of a council building to be built in Dubbo, NSW. The timber species used in the truss is Seasoned Radiata Pine. For analysis purposes, all members of the truss can be assumed to be pin-iointed.
 
The tributary area supported by the mono truss is 10m by 7.5 m in plan projection. You are required to check the connection at node 2 (Figure (a) and (b)). All the members at node 2 have a cross-section of 150 x 50 mm. The side plates to be used at node 2 are also from Radiata Pine and are 35 mm thick.
 
Analyse the truss and identify the force in members connected to the joint. Also determine the critical load case and relevant values of k1.
Point loads F1 and F2 applied at joint 2 and 4 represent the Permanent and Imposed loads on the truss, respectively, where the imposed load is occupancy live load. Self-weight of the timber can be ignored in the analysis and design of the truss.
Possible load combinations as per AS1170.0 (2002) are:
1. 1.35 G
2. 1.2 G + 1.5 Q
 
F1=1.8 kN (Permanent load)
F2=2.3 kN (Imposed load- considered as 5 months duration load)
 
You are first required to analyse the truss to find the internal actions on joint 2 for both load combinations. Based on the calculated internal actions for the two load cases, you are then required to undertake two design checks as detailed below.
- Members of the bottom chord are connected using 60 mm long 2.5 nails (Figure (c), Section B-B). Check the suitability of the joint to carry the design load.
- The vertical member is connected using an M10 bolt (Figure (c), Section A-A). Check the suitability of the joint to carry the design load.
 
 
(Connection arrangement/spacing check is not required)

Start filling in the gaps now
Log in