11
votes
A chess engine in Java: generating white pawn moves
The code in general is fine. If it were a C program (or some other classic language) I would even say good. However this is Java and especially by using integers to represent the pieces you completely ...
10
votes
A chess engine in Java: generating white pawn moves
The methods related to InitialDoubleMove are misnamed. It took me a while to understand what their purpose is. Consider renaming them to ...
6
votes
A chess engine in Java: generating white pawn moves - take II
Coupling
I essentially extracted the move generating logic to a dedicated class
implementing an expansion interface. That way, my code will stay well
modularized.
Modularizing the logic is a ...
6
votes
A chess engine in Java: generating white pawn moves - take II
No offense, but it got worse :) Everything is quite over engineered.
It's not part of the posted code, but combining the enums with the bit masks is pointless. Do one or the other, not both.
You have ...
6
votes
A chess engine in Java: generating white pawn moves
Do you just want elegant code, or do you want efficiency?
I'm inclined to think that the memory allocated to a State needs to be a lot less than an array of 64 integers. It's fairly easy to get it ...
4
votes
First tic tac toe game. want to see if valid or needs improvement
I have a few suggestions, but I'll just mention two.
I would recommend defining the game board as just a 3 by 3 array containing only X, O, or blank. The way you've coded it here makes easy to print ...
3
votes
Dice evaluation in a Yahtzee-type game
Clarity of variable names
I like the solution here, though I was thrown off at first by the roll and number variables. At first, ...
2
votes
Accepted
another first tic-tac-toe game
Returning true and false
In your generate win conditions function, instead of returning true or false if the condition evaluates ...
2
votes
A chess engine in Java: generating white pawn moves
Very good first attempt.
Code follows C-style patterns.
For more Java/OOPS-style, try incorporating these into the code:
Solid Patterns
1.1. Segregate Actors and Actions
1.2. Actors are Pieces on ...
2
votes
Accepted
"Element Fusion" game where 2048 meets Chemistry
The GUI looks great, the game is a lot of fun to play and (unfortunately) it is quite addictive.
Bug or feature
After playing it a hundred times or so, I began to notice that the game was ending ...
2
votes
"Element Fusion" game where 2048 meets Chemistry
Overview
The code layout is good, and you used meaningful names for classes,
functions and variables.
Documentation
The code should have a header comment describing the purpose of the code, such as:
<...
2
votes
First tic tac toe game. want to see if valid or needs improvement
Start Over
Start from scratch. You need to build a sense of the big picture of coding Tic-Tac-Toe. That perspective serves for any coding project.
The before and after will give you insight that ...
1
vote
Accepted
Dice evaluation in a Yahtzee-type game
There was a few issues with evaluating [1,2,1,1,0,0].
When evaluating for straights this will fail.
When evaluating, the code would evaluate this as just a "Pair".
(Should result in "...
1
vote
Dice evaluation in a Yahtzee-type game
I really appreciate all the feedback, and would like to give credit to "cariehl" for noticing the bugs. By subtracting from "straightIndex", what happens looks like this " +1, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
game × 1973python × 506
beginner × 428
java × 422
c++ × 305
javascript × 231
object-oriented × 211
c# × 197
python-3.x × 186
tic-tac-toe × 142
performance × 129
console × 106
playing-cards × 95
c × 75
rock-paper-scissors × 74
hangman × 64
random × 52
swing × 51
algorithm × 48
c++11 × 48
pygame × 48
dice × 47
snake-game × 46
objective-c × 43
community-challenge × 43