Skip to main content
75 votes
Accepted

Monopoly simulator

You really need to remove some of your global variables. As an example I'd change all your browns to use a list instead. brown = [0, 0] As you do a lot of logic ...
Peilonrayz's user avatar
  • 43.4k
29 votes

Monopoly simulator

You have a lot of verbose repetition, you should learn to simplify things with loops and functions. First, you're printing the board with each line getting a print statement, but you could just use a ...
SuperBiasedMan's user avatar
27 votes

Simple text-based RPG in Java

OOP This task really begs for object oriented programming. As a first step, I suggest moving the maxhp, playerhp, ...
janos's user avatar
  • 111k
25 votes
Accepted

Two player dice roll game

This… … … is a mouthfull. The sheer amount of comments make the code very hard to read as it gets buried under tons upon tons of other information. Most of them being just there to state the obvious ...
301_Moved_Permanently's user avatar
17 votes

A dice game called "Greed"

Style You're not being charged by the character; there's no need to abbreviate "count", or "ret" (which I would call "score" instead). Also, main has inconsistent brackets with the rest of the ...
Errorsatz's user avatar
  • 1,354
17 votes

Two player dice roll game

You got an excellent grade for this assignment, but there is still room for improvement! Readability First and foremost, you'll learn that code readability is very important, as code is harder to read ...
gazoh's user avatar
  • 3,359
14 votes
Accepted

Find the total number of ways W, in which a sum S can be reached in N throws of a dice

1. Review The sum \$s=0\$ can be reached in \$n=0\$ throws in exactly one way, but: ...
Gareth Rees's user avatar
  • 49.6k
14 votes

Dice simulator program

Here are a few suggestions on how to simplify and format your code. Break directly from the loop In your loop construct there really is no point in keeping track of ...
Stephen Rauch's user avatar
14 votes

2 player dice game with login system

FUNCTIONS! Divide your code into functions to make it more readable. In a couple of places, your code is 12 levels of indentation deep! That's the equivalent of 48 characters! Spacing Operators ...
Solomon Ucko's user avatar
  • 1,566
12 votes

DnD Die in Java with regex

Bug in the validation pattern The INPUT_VALIDATION_PATTERN doesn't work correctly, as it matches the invalid input "D"....
mindoverflow's user avatar
11 votes

Simple text-based RPG in Java

Some of your switch cases are unnecessarily long, repetitive and include lots of code. You could easily replace them with indexed arrays, making it easier to read, shorter, and easier to expand with ...
user985366's user avatar
  • 1,725
11 votes
Accepted

Dice game where two players try to get to 49

The simple answer is "yes". But let's take a look at why that's true and how you could make this look better. First some general notes: Variable Names: In static typed languages it's common to use ...
TheAtomicOption's user avatar
10 votes

Simple Python Dice

Your limits are inconsistent: you can’t set the number of sides to the declared minimum: 3 ...
AJNeufeld's user avatar
  • 33.9k
10 votes
Accepted

An ASCII histogram of a die rolled n times

The roll function generates a random sequence of integers. The loop body shows me that you know how to seed a pseudo-RNG with a true source of randomness but you're ...
Indiana Kernick's user avatar
10 votes

Arbitrary Dice with Probability

Since you need to roll many times in the chance_overlap function, you might want to optimize making n rolls, using ...
Graipher's user avatar
  • 41k
10 votes
Accepted

Razzle Dazzle simulator

First, your use of camelCase isn't ideal in Python. For variable and function names, snake_case is preferred. I'll be using that with any re-written code that I show. I think ...
Carcigenicate's user avatar
9 votes
Accepted

Simple dice game - JavaScript MVC implementation

MVC thing is hard to be taken right. And yet it is the most popular (my guess) approach in the modern web development. There are different ways to say what MVC means in particular application. I ...
sineemore's user avatar
  • 1,785
9 votes

A dice game called "Greed"

Nice separation of functionality, well done! There are some important details that the other review doesn’t address: int greed(list_type die_rolls) Here you are ...
Cris Luengo's user avatar
  • 6,082
9 votes
Accepted

2 player dice game with login system

This only addresses one aspect of your code, but I think it's an important point to communicate: Login systems If you ever actually need a login system, you should investigate cybersecurity and good ...
Graham's user avatar
  • 1,379
9 votes

DnD Die in Java with regex

We don't know how your Die fits into the game as a whole, but the way you're rolling your results seems counter-intuitive to me. I'd expect to be able to call ...
forsvarir's user avatar
  • 11.7k
8 votes
Accepted

Exurbb (automated turn based) Battle Simulator

Summary A lot of work still needs to be done on this. Fix all the suggestions below then resubmit for further review. Dice Rolling. ...
Loki Astari's user avatar
  • 95.5k
8 votes

Dice game where two players try to get to 49

thanks for sharing your code! There are a few pretty big issues with your current code. Variable Names Your current variable names tell us absolutely nothing about what the variable is, or what it'...
chatton's user avatar
  • 1,496
8 votes

Simple Python Dice

You spent 55 lines and a stateful class on something that can be accomplished in 3 lines (1 line if you don't count the imports) using only standard library functions: ...
jpmc26's user avatar
  • 1,233
8 votes
Accepted

2-player dice game

Login Make a function login and move all the code to do with logged_in1 into it. Use ...
Peilonrayz's user avatar
  • 43.4k
8 votes

Arbitrary Dice with Probability

The right functions def roll(die): number = random.randint(0,len(die)-1) b = die[number] return b Can be: ...
esote's user avatar
  • 3,770
8 votes

c++ dice game using random numbers

The 2 previous answers provide a lot of good points, here are a few more suggestions: Generating Random Numbers As of C++11 there are better random number generators to use that the C standard library ...
pacmaninbw's user avatar
  • 24k
7 votes

Dice roller in Python

Input validation A 0-sided dice for example 3d0 will raise an exception with an ugly stack trace. Since technically it's in "3d8 format", perhaps an additional ...
janos's user avatar
  • 111k
7 votes
Accepted

Dice simulation and counting pairs

Minor things The java naming standard for classes is CamelCase (DiceSimulation instead of diceSimulation) A constant of ...
AlanT's user avatar
  • 3,599
7 votes

Simple text-based RPG in Java

Format As pointed by others, the formatting could be arranged. Any decent IDE have a code formatter ;) Also, classes name should start with an upper case letter ;) Using enum when it makes sense ...
Ronan Dhellemmes's user avatar
7 votes

Basic python dice simulator with log function

There's some things I really like about your code. For one, you used str.format, which is in many ways superior to '%'-...
Daniel's user avatar
  • 4,490

Only top scored, non community-wiki answers of a minimum length are eligible