Skip to content

Commit

Permalink
README added
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzer committed Jun 11, 2011
1 parent bb86d08 commit a8d2328
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
11 changes: 11 additions & 0 deletions src/jazzy/README → README
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
========================
Running from Eclipse
========================

Import this folder to Eclipse (with PyDev) and run JazzyServer.py from jazzy.server package:

Then point your browser to http://yoururl:8090/new.html to create a game and play.
You can start experimenting with localhost as yoururl and use services like dyndns for usage over the internet. Make sure to forward port 8090 to the server.


=============================
Running from Command Line
=============================
cd to the folder src/jazzy/server, then run
export PYTHONPATH=../../../src:$PYTHONPATH; python3 JazzyServer.py
25 changes: 19 additions & 6 deletions src/jazzy/logic/ClassicGame.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,36 @@ def setPawnSpeed(self, START_BOOST, NORMAL_SPEED):
self.board.fields[pawn_pos].START_BOOST = START_BOOST
self.board.fields[pawn_pos].NORMAL_SPEED = NORMAL_SPEED


def parsePossibleMoves(self, player):
if player is None or not(self.possibleMoves is None):
return

moveSet = self.findAllPieceMoves()
# filter
moveSet = self.filterMovesByRules(moveSet, player)
moveSet = self.filterMovesToCheck(moveSet, player)
print("I think you can move like this: " + str(moveSet))
self.possibleMoves = moveSet

def findAllPieceMoves(self):
# get all the player's pieces
pieces = self.board.findPlayersPieces(self.players[self.currentPlayerId])
# get all their candidate moves
self.possibleMoves = set()
moveSet = set()
for pos in pieces:
results = self.board.fields[pos].getPossibleMoves(pos)
print(str(results))
self.possibleMoves |= self.board.fields[pos].getPossibleMoves(pos)
# filter
self.possibleMoves = self.filterMoves(self.possibleMoves, player)
print("I think you can move like this: " + str(self.possibleMoves))
moveSet |= self.board.fields[pos].getPossibleMoves(pos)
return moveSet

def filterMoves(self, moveSet, player):
def filterMovesByRules(self, moveSet, player):
# add (!) castling options here
# add promotion variants
# add en passant moves
return moveSet

def filterMovesToCheck(self, moveSet, player):
# TODO filter moves to check and such
return moveSet

Expand Down

0 comments on commit a8d2328

Please sign in to comment.