Skip to main content
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 ...
RoToRa's user avatar
  • 11.3k
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 ...
vnp's user avatar
  • 56.8k
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 ...
Alexander Ivanchenko's user avatar
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 ...
RoToRa's user avatar
  • 11.3k
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 ...
Michael Kay's user avatar
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 ...
ApexPolenta's user avatar
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, ...
cariehl's user avatar
  • 947
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 ...
Linny's user avatar
  • 10.3k
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 ...
Adi's user avatar
  • 21
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 ...
toolic's user avatar
  • 3,892
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: <...
toolic's user avatar
  • 3,892
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 ...
radarbob's user avatar
  • 7,684
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 "...
Mike Millar's user avatar
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, ...
Mike Millar's user avatar

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