Zeksy
Zeksy
CC#
Created by Zeksy on 6/7/2024 in #help
My First Ever C-Sharp Mini Project!
:salute:
10 replies
CC#
Created by Zeksy on 6/7/2024 in #help
My First Ever C-Sharp Mini Project!
I see, I don't get most of this code maybe because I just started but will dive deep into it shortly
10 replies
CC#
Created by Zeksy on 6/7/2024 in #help
My First Ever C-Sharp Mini Project!
It was also my first Python project when I was learning it a year ago, pretty glad of where I stand in terms of py now so I thought I'd recreate the same thing in c# to progress further. Here's what the py code looked like if anyone is interested xD
import random
choices = ["rock", "paper", "scizor"]

choicesDictionary = {

"rock": {
"alias": ["r", "rocks", "1"],
"win": "scizor",
"lose": "paper",
},

"paper": {
"alias": ["p", "papers", "2"],
"win": "rock",
"lose": "scizor",
},

"scizor": {
"alias": ["s", "scizors", "3"],
"win": "paper",
"lose": "rock",
},


}

playerChoice = input("Make your choice:\n")

if playerChoice not in choices:
for choice in choicesDictionary.keys():
if playerChoice in choicesDictionary[choice]["alias"]:
playerChoice = choice
break

while playerChoice not in choices:
playerChoice = input("Make your choice:\n")
if playerChoice not in choices:
for choice in choicesDictionary.keys():
if playerChoice in choicesDictionary[choice]["alias"]:
playerChoice = choice

computer = random.choice(choices)

if choicesDictionary[playerChoice]["win"] == computer: status = "You won the game!"
if choicesDictionary[playerChoice]["lose"] == computer: status = "You lost the game!"
if playerChoice == computer: status = "The game resulted in a draw!"


print(f"The game started! You chose {playerChoice}")
print(f"Computer chose {computer}! {status}")
import random
choices = ["rock", "paper", "scizor"]

choicesDictionary = {

"rock": {
"alias": ["r", "rocks", "1"],
"win": "scizor",
"lose": "paper",
},

"paper": {
"alias": ["p", "papers", "2"],
"win": "rock",
"lose": "scizor",
},

"scizor": {
"alias": ["s", "scizors", "3"],
"win": "paper",
"lose": "rock",
},


}

playerChoice = input("Make your choice:\n")

if playerChoice not in choices:
for choice in choicesDictionary.keys():
if playerChoice in choicesDictionary[choice]["alias"]:
playerChoice = choice
break

while playerChoice not in choices:
playerChoice = input("Make your choice:\n")
if playerChoice not in choices:
for choice in choicesDictionary.keys():
if playerChoice in choicesDictionary[choice]["alias"]:
playerChoice = choice

computer = random.choice(choices)

if choicesDictionary[playerChoice]["win"] == computer: status = "You won the game!"
if choicesDictionary[playerChoice]["lose"] == computer: status = "You lost the game!"
if playerChoice == computer: status = "The game resulted in a draw!"


print(f"The game started! You chose {playerChoice}")
print(f"Computer chose {computer}! {status}")
I just re-created it in c# and guess it wasn't bad even tho this one has a lot better readablity
10 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
Alright I'll keep that in mind
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
makes sense, and how about dictionaries
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
Right, if I wanted to make a list like list = [True, 4.5, 5, "hello"] id have to make it object? and ONLY when im really making a list like that
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
I see
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
Ah right, I first made it string but then tried putting some bools etc into it didn't work, so I turned it to object
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
What do you mean by that? the List object type specifically
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
it didnt show that when i pasted the same code in vs
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
oh
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
Well not really an error as it runs the code regardless but i dunno its highlighted with yellow
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
it shows it this way
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
I think I already did, had to put these symbols do they dont show error https://prnt.sc/hM8CThjU2Dp9
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
I believe I just got it
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
looks all decent
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
thats why I looked up if I can write in vsc instead
38 replies
CC#
Created by Zeksy on 6/6/2024 in #help
Where do I code?!
Yes, I got that impression the first time I rolled in lmao
38 replies