+ 10

Printing dice side by side on python

https://code.sololearn.com/c4BJpuE2fNqc/?ref=app Hi all! That's my game code. In this code each player rolls 2 dice. # <- this is a die Dice printing like this # # I want to print dice like this # # I tried to print dice side by side. I can do it with a code that prints every possible dice. If 1 1 print # # if 1 2 print # # if 1 3 print # # if 1 4... But it not looks good. "Anyone have an idea how can we print dice side by side with a short code?" Please tell me if u have an idea ^_^

11th May 2018, 1:51 PM
Ayastar
Ayastar - avatar
6 Respostas
+ 6
Nice concept. I made a code to show how you'll print 2 dies side by side. It's a bit complicated right now.. That's what i could come up with. It's commented and i guess you'll get the idea of how to do the other cases.. I'll try for a better solution. If someone knows it pls tell! https://code.sololearn.com/cu2td1Gu41bx/?ref=app
11th May 2018, 3:26 PM
Yash✳️
Yash✳️ - avatar
+ 6
Oh, thank u. It really works (;
11th May 2018, 7:31 PM
Ayastar
Ayastar - avatar
+ 4
solution 1: place the 6 different dice side views into a list of 6 elements. each element is a list of as many strings as rows you want to print. then if you have for example dices 4,3 you print out the 1st row of 4th element of the list 1st row of the 3th element of the list and so on using a for loop.
11th May 2018, 7:21 PM
tamaslud
tamaslud - avatar
+ 4
solution 2: use print format and place or not no place dots accordong to the dice value. similar to the following card code https://code.sololearn.com/cL6TH3s0lEBt/?ref=app
11th May 2018, 7:23 PM
tamaslud
tamaslud - avatar
+ 3
that's a really nice work. you are doing well. BTW thanks for the follow
11th May 2018, 1:54 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 3
in my newest code i printed 4 numbers side by side like a 7segment display. the segments stored in a tuple for each number from 0 to 9. the dice printout should be similar. there are 7 dot positions what shoul be 'o' or ' ' according to dice value 1 to 6. i hope it helps. https://code.sololearn.com/cKVERNcDZoXP/?ref=app
13th May 2018, 2:10 PM
tamaslud
tamaslud - avatar