https://github.com/anod/prolog-game-cars
The Cars game in Visual Prolog 7.3
https://github.com/anod/prolog-game-cars
Last synced: 6 months ago
JSON representation
The Cars game in Visual Prolog 7.3
- Host: GitHub
- URL: https://github.com/anod/prolog-game-cars
- Owner: anod
- Created: 2011-12-22T18:02:34.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-22T18:55:21.000Z (over 14 years ago)
- Last Synced: 2025-04-28T13:12:29.686Z (about 1 year ago)
- Language: Prolog
- Homepage:
- Size: 13.7 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The Cars
This is study project for course "Programming Languages" @ Afeka College of Engineering.
Game with map of city, random roads, AI and User driven cars and traffic lights.
Main goal: The player should reach destination for the minimum time.
## Highlights
* Visual Prolog 7.3
* Randomized Prim algorithm for building maze
* BFS algorith to find short way between 2 points
## Information
### Explanation of usage :
* To run the game after compiling click File -> New (F7)
At the beginning you will see Main Menu of the game.
### Navigation:
* Main Menu - arrows Up,Down to select between items, Enter button to choose an item
* Game - Esc button to pause the game, Space or Enter to Continue
* Game Finish screen - Space or Enter show main menu
* Top Ten screen - Space or Enter in order to return to the main menu
### Control of the car:
* User car is yellow, need to reach green destination point
* W,A,S,D as described in requirements
* To turn on the road from one cell to another, car should be completely inside a cell.
### Implementation highlights:
* Random roads are generated by Randomized Prim algorithm
* Way between 2 points calculated using BFS algorithm. Each cell is the node of the graph that connected one to each other
* Every violation of traffic rules gives +10 seconds to the total times.
* There is 2 violation rules: user car drive on red light and user car drive to cell with other car in the same direction
* top ten stored in file: top.fac and restored each run
### Classes overview:
* lawn - main form where game is drawn
* gameController - receive events from lawn
* cityGenerator - generate map, buildings and random roads (using prim algorithm)
* cityTrafficLights - create traffic lights on junctions in the city and mange states of them
* car - basic car implementation
* car/carAI - computer car extends car
* car/carUser - user driven car, extends car
* carManager - create and handle car objects
* mapBFS - calculate way between 2 cells on the map
* draw - draw current screen on the lawn form
* topTenManager - manage list of top ten
* utils - helpers used by multiple classes
## Author
Alex Gavrishev, 2011