Skip to main content
added 566 characters in body
Source Link
using System;

namespace RockPaperScissors
{
    public sealed class ComputerPlayer : Player
    {
        public ComputerPlayer(string name) : base(name) { }
        public override void MakeMove()
        {
            Move = RandomMoveGenerator.MakeRandomMoveGenerateRandomMove();

            Console.WriteLine($"{this.Name} made a {this.Move}");
        }
    }
}
using System;
using System.Linq;

namespace RockPaperScissors
{
    public static class RandomMoveGenerator
    {
        private readonly static Random random = new Random();
        private static readonly Move[] moves = Enum.GetValues(typeof(Move))
                                                   .Cast<Move>()
                                                   .ToArray();
        public static Move MakeRandomMoveGenerateRandomMove() => moves[random.Next(moves.Length)];
    }
}
using System;

namespace RockPaperScissors
{
    public sealed class ComputerPlayer : Player
    {
        public ComputerPlayer(string name) : base(name) { }
        public override void MakeMove()
        {
            Move = RandomMoveGenerator.MakeRandomMove();

            Console.WriteLine($"{this.Name} made a {this.Move}");
        }
    }
}
using System;
using System.Linq;

namespace RockPaperScissors
{
    public static class RandomMoveGenerator
    {
        private readonly static Random random = new Random();
        private static readonly Move[] moves = Enum.GetValues(typeof(Move))
                                                   .Cast<Move>()
                                                   .ToArray();
        public static Move MakeRandomMove() => moves[random.Next(moves.Length)];
    }
}
using System;

namespace RockPaperScissors
{
    public sealed class ComputerPlayer : Player
    {
        public ComputerPlayer(string name) : base(name) { }
        public override void MakeMove()
        {
            Move = RandomMoveGenerator.GenerateRandomMove();

            Console.WriteLine($"{this.Name} made a {this.Move}");
        }
    }
}
using System;
using System.Linq;

namespace RockPaperScissors
{
    public static class RandomMoveGenerator
    {
        private readonly static Random random = new Random();
        private static readonly Move[] moves = Enum.GetValues(typeof(Move))
                                                   .Cast<Move>()
                                                   .ToArray();
        public static Move GenerateRandomMove() => moves[random.Next(moves.Length)];
    }
}
added 566 characters in body
Source Link

RandomMoveGenerator

using System;
using System.Linq;

namespace RockPaperScissors
{
    public static class RandomMoveGenerator
    {
        private readonly static Random random = new Random();
        private static readonly Move[] moves = Enum.GetValues(typeof(Move))
                                                   .Cast<Move>()
                                                   .ToArray();
        public static Move MakeRandomMove() => moves[random.Next(moves.Length)];
    }
}

ConsoleHelper

ConsoleHelper

RandomMoveGenerator

using System;
using System.Linq;

namespace RockPaperScissors
{
    public static class RandomMoveGenerator
    {
        private readonly static Random random = new Random();
        private static readonly Move[] moves = Enum.GetValues(typeof(Move))
                                                   .Cast<Move>()
                                                   .ToArray();
        public static Move MakeRandomMove() => moves[random.Next(moves.Length)];
    }
}

ConsoleHelper

added relevant tag
Link
Peter Csala
  • 9.9k
  • 1
  • 15
  • 33
deleted 8 characters in body
Source Link
Loading
deleted 44 characters in body
Source Link
Loading
Tweeted twitter.com/StackCodeReview/status/1391543508239065097
deleted 49 characters in body
Source Link
Loading
added 11324 characters in body
Source Link
Loading
added 46 characters in body; edited title
Source Link
Loading
Post Undeleted by ImNotThatCSharp
Post Deleted by ImNotThatCSharp
Source Link
Loading