Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor bug fix. #50

Merged
merged 5 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ test_tree.py
test_graph.py
test_unit.py
test.py
build
dist
*.egg-info
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Srajan Chourasia
Copyright (c) 2024 Srajan Chourasia, Varun Patrikar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<picture align="center">
<!-- <source media="(prefers-color-scheme: dark)" srcset="traverseCraft/icons/logo/traverseCraftExtentedLogo.png"> -->
<img alt="Traverse Craft Logo" src="traverseCraft/icons/logo/traverseCraftLandscapeLogo.png">
<img alt="Traverse Craft Logo" src="https://github.com/srajan-kiyotaka/TraverseCraft/blob/main/traverseCraft/icons/logo/traverseCraftLandscapeLogo.png">
</picture>

<!-- ![Build Status](https://github.com/srajan-kiyotaka/TraverseCraft/blob/main/.github/workflows/python-app.yml/badge.svg) -->
Expand All @@ -13,7 +12,7 @@
![Supported OS: Windows](https://img.shields.io/badge/Windows-%234285F4.svg?logo=windows&logoColor=white)
![Supported OS: macOS](https://img.shields.io/badge/macOS-%23000000.svg?logo=apple&logoColor=white)
![Supported OS: Linux](https://img.shields.io/badge/Linux-%23FCC624.svg?logo=linux&logoColor=black)
[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue)](/docs/ "Go to library documentation")
[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue)](/docs/ReadMe.md "Go to library documentation")
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/srajan-kiyotaka/TraverseCraft/blob/main/LICENCE)
![Last Commit](https://img.shields.io/github/last-commit/srajan-kiyotaka/TraverseCraft.svg)
[![GitHub Repo Stars](https://img.shields.io/github/stars/srajan-kiyotaka/TraverseCraft.svg?style=social)](https://github.com/srajan-kiyotaka/Pothole-Mapping-Project)
Expand All @@ -30,9 +29,9 @@
</h1>
</center>

TraverseCraft is a cross-platform simulation tool written in Python, designed as a library for simulating various algorithms in real time. TraverseCraft allows users to create custom worlds, populate them with agents, and observe how different algorithms operate within these environments. The library leverages the [tkinter](https://docs.python.org/3/library/tkinter.html#module-tkinter) library for fast and responsive simulations. Whether you're a student, educator, or researcher, TraverseCraft provides an intuitive framework to create, visualize, and interact with different world type using their respective agents.
TraverseCraft is a ***cross-platform simulation tool*** written in Python, designed as a library for simulating various algorithms in real time. TraverseCraft allows users to create custom worlds, populate them with agents, and observe how different algorithms operate within these environments. The library leverages the [tkinter](https://docs.python.org/3/library/tkinter.html#module-tkinter) library for ***fast and responsive simulations***. Whether you're a student, educator, or researcher, TraverseCraft provides an intuitive framework to create, visualize, and interact with different world type using their respective agents.

Please visit the our official [website]() for more information.
Please visit the our official [website](https://github.com/srajan-kiyotaka/TraverseCraft/tree/main) for more information.

## Features

Expand Down Expand Up @@ -74,7 +73,7 @@ pip install traversecraft
conda install -c conda-forge traverse-craft
```

For detailed installation instructions, refer to our installation guide.
For detailed installation instructions, refer to our [installation guide]().

## Getting Started

Expand Down Expand Up @@ -127,7 +126,7 @@ If you use Traverse Craft in your research or publications, please cite our libr

```bibtex
@misc{traversecrafthq2024,
author = {Srajan Chourasia, Varun},
author = {Srajan Chourasia, Varun Patrikar},
title = {Traverse Craft: A Cross-Platform Simulation Tool},
year = {2024},
url = {https://github.com/srajan-kiyotaka/TraverseCraft},
Expand Down
6 changes: 1 addition & 5 deletions docs/graphAgent.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

The `GraphAgent` class represents an agent that operates within a graph world. This agent can move between nodes, execute algorithms, and update a heat map to visualize the agent's path.

## Initialization

### `__init__(self, world, agentName:str, agentColor:str="blue", startNodeId=None, heatMapView:bool=True, heatMapColor:str="#FFA732", heatGradient:float=0.05)`

The constructor initializes an instance of the `GraphAgent` class, which represents an agent operating within a graph-based world.
## Parameters

- **Parameters**:
- `world` (`CreateGraphWorld`): The graph world object that the agent belongs to.
Expand Down
8 changes: 1 addition & 7 deletions docs/graphWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

Class representing a graph world.

## Constructor

### `__init__(self, worldName: str, worldInfo: dict, radius: int = 20, fontSize: int = 12, fontBold: bool = True, fontItalic: bool = True, nodeColor: str = "gray", goalColor: str = "green", width: int = SCREEN_WIDTH, height: int = SCREEN_HEIGHT, lineThickness: int = 2, arrowShape: tuple = (10, 12, 5), buttonBgColor: str = "#7FC7D9", buttonFgColor: str = "#332941", textFont: str = "Helvetica", textSize: int = 24, textWeight: str = "bold", buttonText: str = "Start Agent", logoPath: str = None)`

The constructor method for CreateGraphWorld, which initializes an instance of the class representing a graph world. It takes various parameters such as worldName, worldInfo, and optional parameters for visualization settings like radius, fontSize, and nodeColor. It sets up the graphical representation of the world using Tkinter for visualization and constructs the graph data structure based on the provided worldInfo.

#### Parameters
## Parameters

- `worldName` (str): The name of the world.
- `worldInfo` (dict): Dictionary containing information about the world.
Expand Down
8 changes: 1 addition & 7 deletions docs/gridWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ Class representing the world created using grids.
- `coordinate`: `List[int]`
- `worldID`: `"GRIDWORLD"`

## Constructor

### `__init__(self, worldName:str, rows:int, cols:int, cellSize:int=10, pathColor:str="gray", blockColor:str="red", goalColor:str="green", cellPadding:int=2, borderWidth:int=1, buttonBgColor:str="#7FC7D9", buttonFgColor:str="#332941", textFont:str="Helvetica", textSize:int=24, textWeight:str="bold", buttonText:str="Start Agent", logoPath:str=None)`

The constructor initializes an instance of the CreateGridWorld class, setting up various attributes that define the world. It takes parameters such as worldName (the name of the world), rows (number of rows in the grid), cols (number of columns in the grid), and optional parameters for visual aspects like cell size, colors for paths, blocks, and goals, button appearance, and a logo image path. The constructor also validates input parameters to ensure they fall within acceptable ranges or have sensible defaults.

#### Parameters
## Parameters

- `worldName` (`str`): The name of the world.
- `rows` (`int`): The number of rows in the world (between 1 and 1000).
Expand Down
50 changes: 50 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from setuptools import setup, find_packages

with open("README.md", "r") as f:
long_description = f.read()

setup(
name='TraverseCraft',
version='0.4.5',
author='Srajan Chourasia, Varun Patrikar',
author_email='[email protected], [email protected]',
maintainer='Srajan Chourasia, Varun Patrikar',
maintainer_email='[email protected], [email protected]',
description='TraverseCraft: Cross-Platform Real-Time Algorithm Simulation Tool',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://official-website.com', # Official website
project_urls={
'Documentation': 'https://docs.traverseCraft.com',
'Source': 'https://github.com/srajan-kiyotaka/TraverseCraft/tree/main',
'Tracker': 'https://github.com/srajan-kiyotaka/TraverseCraft/tree/main/issues',
'Reference': 'https://reference.traverseCraft.com',
},
package_dir={'': 'traverseCraft'},
packages=find_packages(where='traverseCraft'),
python_requires='>=3.6',
install_requires=[
'prettytable',
],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Education',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Visualization',
],
keywords='algorithms, simulation, real-time, tkinter, education, research, visualization, machine learning, reinforcement learning, artificial intelligence, agent-based modeling, cross-platform, dynamic heatmap, world generation, customizable, interactive, framework, algorithm visualization, graph traversal, tree traversal, grid world',
)
20 changes: 10 additions & 10 deletions traverseCraft/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class CreateTreeWorld:
- textSize (int): The font size of the button text. Default is 24.
- textWeight (str): The font weight of the button text. Default is "bold".
- buttonText (str): The text displayed on the buttons. Default is "Start Agent".
- logoPath (str, optional): The file path to the logo image. Default is "design 1.png".
- logoPath (str, optional): The file path to the logo image. Default is traverseCraft logo.
Attributes:
- worldID (str): Class identifier for the tree world.
Expand Down Expand Up @@ -930,7 +930,7 @@ class CreateGraphWorld:
- textSize (int): The font size of the button text. Default is 24.
- textWeight (str): The font weight of the button text. Default is "bold".
- buttonText (str): The text displayed on the buttons. Default is "Start Agent".
- logoPath (str, optional): The file path to the logo image. Default is "design 1.png".
- logoPath (str, optional): The file path to the logo image. Default is traverseCraft logo.
Attributes:
- worldID (str): Class identifier for the graph world.
Expand Down Expand Up @@ -1013,7 +1013,7 @@ def __init__(self, worldName: str, worldInfo: dict, radius: int = 20, fontSize:i
self._canvas = Canvas(self._root, width=self._width, height=self._height, bg="white")
self._canvas.pack()
self.nodeMap = {}
## Construct Tree Data Structure ##
## Construct Graph Data Structure ##
if("edges" not in self._worldInfo):
self._worldInfo['edges'] = None
if("vals" not in self._worldInfo):
Expand Down Expand Up @@ -1203,7 +1203,7 @@ def _generateGraphDS(self, adj, rootId, parentId=None, edges=None, values=None,

def constructWorld(self):
"""
Constructs the tree world.
Constructs the graph world.
Parameters:
self (World): The World instance.
Expand Down Expand Up @@ -1254,10 +1254,10 @@ def _drawEdges(self, node):

def _drawNodes(self, node):
"""
Draw the nodes in the tree.
Draw the nodes in the graph.
Parameters:
node (TreeNode): The node to draw.
node (GraphNode): The node to draw.
Returns:
None
"""
Expand Down Expand Up @@ -1295,15 +1295,15 @@ def _drawNodes(self, node):

def _addStartButton(self):
"""
Add the "Start Agent" button to the tree world.
Add the "Start Agent" button to the graph world.
Parameters:
None
Returns:
None
"""
# Find the bottommost point of the tree
# Find the bottommost point of the graph
button_y = 100 + max(y for _, y in self._position.values())
button_x = (min(x for x, _ in self._position.values()) + max(x for x, _ in self._position.values())) // 2

Expand All @@ -1314,7 +1314,7 @@ def _addStartButton(self):

def changeNodeColor(self, nodeId, color):
"""
Changes the color of a node in the tree.
Changes the color of a node in the graph.
Args:
nodeId (int): The ID of the node to change the color of.
Expand All @@ -1330,7 +1330,7 @@ def changeNodeColor(self, nodeId, color):

def changeNodeText(self, nodeId, newText):
"""
Changes the text of a node in the tree.
Changes the text of a node in the graph.
Parameters:
nodeId (int): The ID of the node to change the text of.
Expand Down
Loading