Skip to content

Commit

Permalink
readme update, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
selimanac committed May 29, 2024
1 parent 630c52d commit 4228669
Show file tree
Hide file tree
Showing 6 changed files with 1,379 additions and 1,727 deletions.
Binary file added .github/xfire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,19 @@ astar.toogle_zero(true)

### Monkey Mart

![DAABBCC](/.github/monkey_mart.jpg?raw=true)
![Monkey Mart](/.github/monkey_mart.jpg?raw=true)

**Developer:** [Tiny Dobbins](http://tinydobbins.com/)
**Release Date:** 8 Dec, 2022
**Poki:** https://poki.com/en/g/monkey-mart
**Poki:** https://poki.com/en/g/monkey-mart
**Google Play:** https://play.google.com/store/apps/details?id=com.tinydobbins.monkeymart
**App Store:** https://apps.apple.com/tr/app/monkey-mart/id6480208265

### Xfire

![Xfire](/.github/xfire.png?raw=true)

**Developer:** [171Dev](https://www.171dev.uk)
**Release Date:** 28 May, 2024
**itch.io:** https://benjames171.itch.io/xfire
**Source:** https://github.com/benjames-171/xfire
136 changes: 62 additions & 74 deletions astar/include/Map.hpp
Original file line number Diff line number Diff line change
@@ -1,91 +1,79 @@
#ifndef Map_hpp
#define Map_hpp

#include <dmsdk/sdk.h>
#include <math.h>
#include <micropather.h>
#include <stdio.h>
#include <math.h>
#include <dmsdk/sdk.h>
using namespace micropather;

typedef struct {
int x;
int y;
int x;
int y;
} Position;

typedef struct {
int tile_id;
float* costs;
}Tile;

typedef struct {
int tile_id;
float *costs;
} Tile;

class Map : public Graph
{
class Map : public Graph {
private:
Map(const Map&);
void operator=(const Map&);

MicroPather* pather = NULL;



// E: 1/0
// N: 0/1
// W: -1/0
// S: 0/-1

// SW: -1/-1
// SE : 1/-1
// NW: -1/1
// NE : 1/1

// E N W S NE NW SW SE
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1};

int result;

Map(const Map &);
void operator=(const Map &);
MicroPather *pather = NULL;
// E: 1/0
// N: 0/1
// W: -1/0
// S: 0/-1

// SW: -1/-1
// SE : 1/-1
// NW: -1/1
// NE : 1/1
// E N W S NE NW SW SE
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int result;

public:
int worldWidth, worldHeight, tileCount, worldDirection;
int *world;
Position pathFrom = {0,0};
Position pathTo = {5,5};
MPVector<void*> path;
MPVector<StateCost> nears;
Tile* Costs;

Map(){};
~Map();

enum
{
SOLVED,
NO_SOLUTION,
START_END_SAME,
};
int worldWidth, worldHeight, tileCount, worldDirection;
int *world;
Position pathFrom = {0, 0};
Position pathTo = {5, 5};
MPVector<void *> path;
MPVector<StateCost> nears;
Tile *Costs;

enum Direction
{ DIRECTION_FOUR = 4,
DIRECTION_EIGHT = 8
};

void Setup(int _worldWidth, int _worldHeight, int _worldDirection, int _allocate, int _typicalAdjacent, bool _cache);
void SetMap(int *_world);
void ResetPath();
void ClearPath();
int WorldAt(int x, int y);
void SetToWorldAt(int x, int y, int value);
void NodeToXY( void* node, int* x, int* y );
void* XYToNode( size_t x, size_t y );

virtual float LeastCostEstimate( void* nodeStart, void* nodeEnd );
int Passable( int nx, int ny );
virtual void AdjacentCost( void* node, MPVector<StateCost> *neighbors );
virtual void PrintStateInfo( void* node ){};
float totalCost;
int Solve();
int SolveNear(float maxCost);
void Clear();
};
Map(){};
~Map();

enum {
SOLVED,
NO_SOLUTION,
START_END_SAME,
};

enum Direction { DIRECTION_FOUR = 4, DIRECTION_EIGHT = 8 };

void Setup(int _worldWidth, int _worldHeight, int _worldDirection,
int _allocate, int _typicalAdjacent, bool _cache);
void SetMap(int *_world);
void ResetPath();
void ClearPath();
int WorldAt(int x, int y);
void SetToWorldAt(int x, int y, int value);
void NodeToXY(void *node, int *x, int *y);
void *XYToNode(size_t x, size_t y);

virtual float LeastCostEstimate(void *nodeStart, void *nodeEnd);
int Passable(int nx, int ny);
virtual void AdjacentCost(void *node, MPVector<StateCost> *neighbors);
virtual void PrintStateInfo(void *node){};
float totalCost;
int Solve();
int SolveNear(float maxCost);
void Clear();
};

#endif /* Map_hpp */
Loading

0 comments on commit 4228669

Please sign in to comment.