| |
#ifndef _PAT_MATCH_H |
| |
#define _PAT_MATCH_H |
| |
|
| #include <string> |
#include <string> |
| |
#include <iostream> |
| #include "BitmapFont.h" |
#include "BitmapFont.h" |
| #include "Assumption.h" |
#include "Assumption.h" |
| |
#include <vector> |
| |
|
| /* @ : 黒 */ |
/* @ : 黒 */ |
| /* . : 白 */ |
/* . : 白 */ |
| /* else(?) : どちらでも */ |
/* else(?) : どちらでも */ |
| class PatMatch{ |
class PatMatch{ |
| private: |
friend std::ostream& operator<<(std::ostream &os,const PatMatch &pm); |
| |
protected: |
| int width, height; |
int width, height; |
| string pat; |
std::string pat; |
| Assumption assumption; |
Assumption assumption; |
| public: |
public: |
| PatMatch(int w,int h,string s,Assumption as) |
PatMatch(int w,int h,std::string s,const Assumption &as); |
| :width(w), height(h), pat(s), assumption(as){ |
PatMatch(int w,int h,std::string s, const SimpleAssumption &sa); |
| assert(pat.length() == (unsigned int)width*height); |
int get(int x,int y) const; |
| } |
#if 0 |
| bool isMatch(const BitmapFont& bf, int x, int y) const{ |
bool isMatch(const BitmapFont& bf, int x, int y) const; |
| for(int i=0;i<width;i++) |
#endif |
| for(int j=0;j<height;j++){ |
int matchPenalty(const BitmapFont& bf, int x, int y) const; |
| if(bf.get(x+i,y+j)){ |
std::vector<pixel> getPixels(int x, int y) const; |
| if(pat[j*width+i]=='.') return false; |
|
| } |
|
| else if(pat[j*width+i]=='@') return false; |
|
| } |
|
| return true; |
|
| } |
|
| }; |
}; |
| |
std::ostream& operator<<(std::ostream &os,const PatMatch &pm); |
| |
#endif /* _PAT_MATCH_H */ |