;-; I just started learning python for school and I have to make a score list,, it's pretty complicated so I'm really struggling :( I wanted to make empty lists for each number and append the score based on the conditions, but I don't know how to check for the conditions
I need to calculate the scores based on the placement of the numbers and the conditions
These are the conditions for each number:
number 1:
when (1) in W or Z, score for (1) = 3 if not score = 1
number 2:
when there's one (2) in the table then score for each (2) is 1 point
when there's two (2) in the table then score for each (2) is 2 point
when there's three (2) in the table then score for each (2) is 3 point
when there's four (2) in the table then score for each (2) is 4 point
each (2) after four is 1 point (eg if there's 5 then its 4 + 4 + 4 + 4 + 1).
number 3:
when (3) is alone, (3) is 0 points
when (3) beside (2), (3) is 1 point it scores 1 point
for each adjacent (3) or (4), and 2 points for each adjacent (1).
number 4:
(4) scores 1 point per different number adjacent to it.
number 5: (5) scores 1 point per connected (5) in the same row (not column).
if two (5) are connected, it is 2 points each,
three (5) connected, 3 points each,
max four connected because table is 4x4
I need to calculate the points for each number and print it out in this manner (eg)
1 : 1 +3 = 4
2: ....... = .
3: ........ = .
I'm using this code to generate random numbers from the list and asking the user to place it.
num_list = ['1','2','3','4','5']
import random
num = random.choice(num_list)
table = [[' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ']]
ss = {"W1":[0,0],
"W2":[1,0],
"W3":[2,0],
"W4":[3,0],
"X1":[0,1],
"X2":[1,1],
"X3":[2,1],
"X4":[3,1],
"Y1":[0,2],
"Y2":[1,2],
"Y3":[2,2],
"Y4":[3,2],
"Z1":[0,3],
"Z2":[1,3],
"Z3":[2,3],
"Z4":[3,3]}
ans = input('where would you like to place it: ')
index_ = ss[ans][0]
columns_ = ss[ans][1]
table[index_][columns_] = num
print(table)
Aucun commentaire:
Enregistrer un commentaire