Skip to content

Commit

Permalink
Rename IVChecker -> IvJudge.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Oct 1, 2023
1 parent 5e47c67 commit afb7093
Show file tree
Hide file tree
Showing 49 changed files with 531 additions and 528 deletions.
24 changes: 12 additions & 12 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@ file(GLOB MAIN_SOURCES
Source/Pokemon/Inference/Pokemon_BerryNameReader.h
Source/Pokemon/Inference/Pokemon_BoxGenderDetector.cpp
Source/Pokemon/Inference/Pokemon_BoxGenderDetector.h
Source/Pokemon/Inference/Pokemon_IVCheckerReader.cpp
Source/Pokemon/Inference/Pokemon_IVCheckerReader.h
Source/Pokemon/Inference/Pokemon_IvJudgeReader.cpp
Source/Pokemon/Inference/Pokemon_IvJudgeReader.h
Source/Pokemon/Inference/Pokemon_NameReader.cpp
Source/Pokemon/Inference/Pokemon_NameReader.h
Source/Pokemon/Inference/Pokemon_NatureReader.cpp
Expand All @@ -865,8 +865,8 @@ file(GLOB MAIN_SOURCES
Source/Pokemon/Options/Pokemon_EggHatchFilter.cpp
Source/Pokemon/Options/Pokemon_EggHatchFilter.h
Source/Pokemon/Options/Pokemon_EncounterBotOptions.h
Source/Pokemon/Options/Pokemon_IVCheckerOption.cpp
Source/Pokemon/Options/Pokemon_IVCheckerOption.h
Source/Pokemon/Options/Pokemon_IvJudgeOption.cpp
Source/Pokemon/Options/Pokemon_IvJudgeOption.h
Source/Pokemon/Options/Pokemon_NameSelectOption.cpp
Source/Pokemon/Options/Pokemon_NameSelectOption.h
Source/Pokemon/Options/Pokemon_NameSelectWidget.cpp
Expand All @@ -876,8 +876,8 @@ file(GLOB MAIN_SOURCES
Source/Pokemon/Pokemon_DataTypes.h
Source/Pokemon/Pokemon_EncounterStats.cpp
Source/Pokemon/Pokemon_EncounterStats.h
Source/Pokemon/Pokemon_IVChecker.cpp
Source/Pokemon/Pokemon_IVChecker.h
Source/Pokemon/Pokemon_IvJudge.cpp
Source/Pokemon/Pokemon_IvJudge.h
Source/Pokemon/Pokemon_NatureChecker.cpp
Source/Pokemon/Pokemon_NatureChecker.h
Source/Pokemon/Pokemon_Notification.cpp
Expand Down Expand Up @@ -920,8 +920,8 @@ file(GLOB MAIN_SOURCES
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxNatureDetector.h
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxShinyDetector.cpp
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxShinyDetector.h
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IVCheckerReader.cpp
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IVCheckerReader.h
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IvJudgeReader.cpp
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IvJudgeReader.h
Source/PokemonBDSP/Inference/PokemonBDSP_DialogDetector.cpp
Source/PokemonBDSP/Inference/PokemonBDSP_DialogDetector.h
Source/PokemonBDSP/Inference/PokemonBDSP_MapDetector.cpp
Expand Down Expand Up @@ -1280,8 +1280,8 @@ file(GLOB MAIN_SOURCES
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxNatureDetector.h
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxShinyDetector.cpp
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxShinyDetector.h
Source/PokemonSV/Inference/Boxes/PokemonSV_IVCheckerReader.cpp
Source/PokemonSV/Inference/Boxes/PokemonSV_IVCheckerReader.h
Source/PokemonSV/Inference/Boxes/PokemonSV_IvJudgeReader.cpp
Source/PokemonSV/Inference/Boxes/PokemonSV_IvJudgeReader.h
Source/PokemonSV/Inference/Boxes/PokemonSV_StatsResetChecker.cpp
Source/PokemonSV/Inference/Boxes/PokemonSV_StatsResetChecker.h
Source/PokemonSV/Inference/Dialogs/PokemonSV_DialogArrowDetector.cpp
Expand Down Expand Up @@ -1557,8 +1557,8 @@ file(GLOB MAIN_SOURCES
Source/PokemonSwSh/Inference/PokemonSwSh_DialogTriangleDetector.h
Source/PokemonSwSh/Inference/PokemonSwSh_FishingDetector.cpp
Source/PokemonSwSh/Inference/PokemonSwSh_FishingDetector.h
Source/PokemonSwSh/Inference/PokemonSwSh_IVCheckerReader.cpp
Source/PokemonSwSh/Inference/PokemonSwSh_IVCheckerReader.h
Source/PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.cpp
Source/PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.h
Source/PokemonSwSh/Inference/PokemonSwSh_MarkFinder.cpp
Source/PokemonSwSh/Inference/PokemonSwSh_MarkFinder.h
Source/PokemonSwSh/Inference/PokemonSwSh_PokemonSpriteReader.cpp
Expand Down
26 changes: 14 additions & 12 deletions SerialPrograms/SerialPrograms.pro
Original file line number Diff line number Diff line change
Expand Up @@ -427,20 +427,20 @@ SOURCES += \
Source/PanelLists.cpp \
Source/Pokemon/Inference/Pokemon_BerryNameReader.cpp \
Source/Pokemon/Inference/Pokemon_BoxGenderDetector.cpp \
Source/Pokemon/Inference/Pokemon_IVCheckerReader.cpp \
Source/Pokemon/Inference/Pokemon_IvJudgeReader.cpp \
Source/Pokemon/Inference/Pokemon_NameReader.cpp \
Source/Pokemon/Inference/Pokemon_NatureReader.cpp \
Source/Pokemon/Inference/Pokemon_PokeballNameReader.cpp \
Source/Pokemon/Inference/Pokemon_ReadHpBar.cpp \
Source/Pokemon/Inference/Pokemon_TrainIVCheckerOCR.cpp \
Source/Pokemon/Inference/Pokemon_TrainPokemonOCR.cpp \
Source/Pokemon/Options/Pokemon_EggHatchFilter.cpp \
Source/Pokemon/Options/Pokemon_IVCheckerOption.cpp \
Source/Pokemon/Options/Pokemon_IvJudgeOption.cpp \
Source/Pokemon/Options/Pokemon_NameSelectOption.cpp \
Source/Pokemon/Options/Pokemon_NameSelectWidget.cpp \
Source/Pokemon/Options/Pokemon_StatsResetFilter.cpp \
Source/Pokemon/Pokemon_EncounterStats.cpp \
Source/Pokemon/Pokemon_IVChecker.cpp \
Source/Pokemon/Pokemon_IvJudge.cpp \
Source/Pokemon/Pokemon_NatureChecker.cpp \
Source/Pokemon/Pokemon_Notification.cpp \
Source/Pokemon/Pokemon_ShinySparkleSet.cpp \
Expand All @@ -462,7 +462,7 @@ SOURCES += \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxGenderDetector.cpp \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxNatureDetector.cpp \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxShinyDetector.cpp \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IVCheckerReader.cpp \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IvJudgeReader.cpp \
Source/PokemonBDSP/Inference/PokemonBDSP_DialogDetector.cpp \
Source/PokemonBDSP/Inference/PokemonBDSP_MapDetector.cpp \
Source/PokemonBDSP/Inference/PokemonBDSP_MarkFinder.cpp \
Expand Down Expand Up @@ -638,7 +638,7 @@ SOURCES += \
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxGenderDetector.cpp \
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxNatureDetector.cpp \
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxShinyDetector.cpp \
Source/PokemonSV/Inference/Boxes/PokemonSV_IVCheckerReader.cpp \
Source/PokemonSV/Inference/Boxes/PokemonSV_IvJudgeReader.cpp \
Source/PokemonSV/Inference/Boxes/PokemonSV_StatsResetChecker.cpp \
Source/PokemonSV/Inference/Dialogs/PokemonSV_DialogArrowDetector.cpp \
Source/PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.cpp \
Expand All @@ -663,6 +663,7 @@ SOURCES += \
Source/PokemonSV/Inference/PokemonSV_MoneyReader.cpp \
Source/PokemonSV/Inference/PokemonSV_PokePortalDetector.cpp \
Source/PokemonSV/Inference/PokemonSV_PokemonSummaryReader.cpp \
Source/PokemonSV/Inference/PokemonSV_StatHexagonReader.cpp \
Source/PokemonSV/Inference/PokemonSV_SweatBubbleDetector.cpp \
Source/PokemonSV/Inference/PokemonSV_TournamentPrizeNameReader.cpp \
Source/PokemonSV/Inference/PokemonSV_WhiteButtonDetector.cpp \
Expand Down Expand Up @@ -770,7 +771,7 @@ SOURCES += \
Source/PokemonSwSh/Inference/PokemonSwSh_BoxShinySymbolDetector.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_DialogBoxDetector.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_FishingDetector.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_IVCheckerReader.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_MarkFinder.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_PokemonSpriteReader.cpp \
Source/PokemonSwSh/Inference/PokemonSwSh_QuantityReader.cpp \
Expand Down Expand Up @@ -1471,7 +1472,7 @@ HEADERS += \
Source/PanelLists.h \
Source/Pokemon/Inference/Pokemon_BerryNameReader.h \
Source/Pokemon/Inference/Pokemon_BoxGenderDetector.h \
Source/Pokemon/Inference/Pokemon_IVCheckerReader.h \
Source/Pokemon/Inference/Pokemon_IvJudgeReader.h \
Source/Pokemon/Inference/Pokemon_NameReader.h \
Source/Pokemon/Inference/Pokemon_NatureReader.h \
Source/Pokemon/Inference/Pokemon_PokeballNameReader.h \
Expand All @@ -1480,13 +1481,13 @@ HEADERS += \
Source/Pokemon/Inference/Pokemon_TrainPokemonOCR.h \
Source/Pokemon/Options/Pokemon_EggHatchFilter.h \
Source/Pokemon/Options/Pokemon_EncounterBotOptions.h \
Source/Pokemon/Options/Pokemon_IVCheckerOption.h \
Source/Pokemon/Options/Pokemon_IvJudgeOption.h \
Source/Pokemon/Options/Pokemon_NameSelectOption.h \
Source/Pokemon/Options/Pokemon_NameSelectWidget.h \
Source/Pokemon/Options/Pokemon_StatsResetFilter.h \
Source/Pokemon/Pokemon_DataTypes.h \
Source/Pokemon/Pokemon_EncounterStats.h \
Source/Pokemon/Pokemon_IVChecker.h \
Source/Pokemon/Pokemon_IvJudge.h \
Source/Pokemon/Pokemon_NatureChecker.h \
Source/Pokemon/Pokemon_Notification.h \
Source/Pokemon/Pokemon_ShinySparkleSet.h \
Expand All @@ -1508,7 +1509,7 @@ HEADERS += \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxGenderDetector.h \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxNatureDetector.h \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_BoxShinyDetector.h \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IVCheckerReader.h \
Source/PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IvJudgeReader.h \
Source/PokemonBDSP/Inference/PokemonBDSP_DialogDetector.h \
Source/PokemonBDSP/Inference/PokemonBDSP_MapDetector.h \
Source/PokemonBDSP/Inference/PokemonBDSP_MarkFinder.h \
Expand Down Expand Up @@ -1686,7 +1687,7 @@ HEADERS += \
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxGenderDetector.h \
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxNatureDetector.h \
Source/PokemonSV/Inference/Boxes/PokemonSV_BoxShinyDetector.h \
Source/PokemonSV/Inference/Boxes/PokemonSV_IVCheckerReader.h \
Source/PokemonSV/Inference/Boxes/PokemonSV_IvJudgeReader.h \
Source/PokemonSV/Inference/Boxes/PokemonSV_StatsResetChecker.h \
Source/PokemonSV/Inference/Dialogs/PokemonSV_DialogArrowDetector.h \
Source/PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.h \
Expand All @@ -1711,6 +1712,7 @@ HEADERS += \
Source/PokemonSV/Inference/PokemonSV_MoneyReader.h \
Source/PokemonSV/Inference/PokemonSV_PokePortalDetector.h \
Source/PokemonSV/Inference/PokemonSV_PokemonSummaryReader.h \
Source/PokemonSV/Inference/PokemonSV_StatHexagonReader.h \
Source/PokemonSV/Inference/PokemonSV_SweatBubbleDetector.h \
Source/PokemonSV/Inference/PokemonSV_TournamentPrizeNameReader.h \
Source/PokemonSV/Inference/PokemonSV_WhiteButtonDetector.h \
Expand Down Expand Up @@ -1827,7 +1829,7 @@ HEADERS += \
Source/PokemonSwSh/Inference/PokemonSwSh_BoxShinySymbolDetector.h \
Source/PokemonSwSh/Inference/PokemonSwSh_DialogBoxDetector.h \
Source/PokemonSwSh/Inference/PokemonSwSh_FishingDetector.h \
Source/PokemonSwSh/Inference/PokemonSwSh_IVCheckerReader.h \
Source/PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.h \
Source/PokemonSwSh/Inference/PokemonSwSh_MarkFinder.h \
Source/PokemonSwSh/Inference/PokemonSwSh_PokemonSpriteReader.h \
Source/PokemonSwSh/Inference/PokemonSwSh_QuantityReader.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#include "PokemonLA/Inference/PokemonLA_MountDetector.h"
#include "PokemonLA/Inference/Objects/PokemonLA_ArcPhoneDetector.h"
#include "Common/Cpp/Concurrency/PeriodicScheduler.h"
#include "Pokemon/Inference/Pokemon_IVCheckerReader.h"
#include "Pokemon/Inference/Pokemon_IvJudgeReader.h"
#include "Kernels/Kernels_Alignment.h"
#include "Kernels/ScaleInvariantMatrixMatch/Kernels_ScaleInvariantMatrixMatch.h"
#include "Kernels/SpikeConvolution/Kernels_SpikeConvolution.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "PokemonLA/Inference/PokemonLA_MountDetector.h"
#include "CommonFramework/InferenceInfra/VisualInferencePivot.h"
#include "Pokemon/Pokemon_Strings.h"
#include "PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IVCheckerReader.h"
#include "PokemonBDSP/Inference/BoxSystem/PokemonBDSP_IvJudgeReader.h"
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_BattleBallReader.h"
#include "PokemonLA/Programs/PokemonLA_LeapPokemonActions.h"
#include "PokemonLA/Inference/PokemonLA_OverworldDetector.h"
Expand Down
51 changes: 0 additions & 51 deletions SerialPrograms/Source/Pokemon/Inference/Pokemon_IVCheckerReader.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*
*/

#include "Pokemon_IVCheckerReader.h"
#include "Pokemon_IvJudgeReader.h"

namespace PokemonAutomation{
namespace Pokemon{

namespace {

std::string iv_checker_value_to_string(IVCheckerValue value){
std::string iv_checker_value_to_string(IvJudgeValue value){
const char* names[] = {
"UnableToDetect",
"NoGood",
Expand All @@ -28,11 +28,11 @@ std::string iv_checker_value_to_string(IVCheckerValue value){

}

IVCheckerReader::IVCheckerReader(const std::string& json_path)
IvJudgeReader::IvJudgeReader(const std::string& json_path)
: SmallDictionaryMatcher(json_path)
{}

OCR::StringMatchResult IVCheckerReader::read_substring(
OCR::StringMatchResult IvJudgeReader::read_substring(
Logger& logger,
Language language,
const ImageViewRGB32& image,
Expand All @@ -48,7 +48,7 @@ OCR::StringMatchResult IVCheckerReader::read_substring(



std::string IVCheckerReader::Results::to_string() const{
std::string IvJudgeReader::Results::to_string() const{
return "HP: " + iv_checker_value_to_string(hp)
+ ", Att: " + iv_checker_value_to_string(attack)
+ ", Def: " + iv_checker_value_to_string(defense)
Expand Down
51 changes: 51 additions & 0 deletions SerialPrograms/Source/Pokemon/Inference/Pokemon_IvJudgeReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* IV Judge Reader
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/

#ifndef PokemonAutomation_Pokemon_IvJudgeReader_H
#define PokemonAutomation_Pokemon_IvJudgeReader_H

#include "CommonFramework/OCR/OCR_SmallDictionaryMatcher.h"
#include "Pokemon/Pokemon_IvJudge.h"

namespace PokemonAutomation{
namespace Pokemon{



class IvJudgeReader : public OCR::SmallDictionaryMatcher{
public:
static constexpr double MAX_LOG10P = -1.40;
static constexpr double MAX_LOG10P_SPREAD = 0.50;

public:
struct Results{
IvJudgeValue hp = IvJudgeValue::UnableToDetect;
IvJudgeValue attack = IvJudgeValue::UnableToDetect;
IvJudgeValue defense = IvJudgeValue::UnableToDetect;
IvJudgeValue spatk = IvJudgeValue::UnableToDetect;
IvJudgeValue spdef = IvJudgeValue::UnableToDetect;
IvJudgeValue speed = IvJudgeValue::UnableToDetect;

std::string to_string() const;
};

IvJudgeReader(const std::string& json_path);

OCR::StringMatchResult read_substring(
Logger& logger,
Language language,
const ImageViewRGB32& image,
const std::vector<OCR::TextColorRange>& text_color_ranges,
double min_text_ratio = 0.01, double max_text_ratio = 0.50
) const;

};



}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "CommonFramework/OCR/OCR_TrainingTools.h"
#include "CommonFramework/Tools/ProgramEnvironment.h"
#include "Pokemon/Pokemon_Strings.h"
#include "Pokemon_IVCheckerReader.h"
#include "Pokemon_IvJudgeReader.h"
#include "Pokemon_TrainIVCheckerOCR.h"

namespace PokemonAutomation{
Expand Down Expand Up @@ -55,8 +55,8 @@ void TrainIVCheckerOCR::program(ProgramEnvironment& env, CancellableScope& scope
"IVCheckerOCR.json",
MODE == TrainOCRMode::INCREMENTAL, THREADS,
OCR::BLACK_TEXT_FILTERS(),
IVCheckerReader::MAX_LOG10P,
IVCheckerReader::MAX_LOG10P_SPREAD
IvJudgeReader::MAX_LOG10P,
IvJudgeReader::MAX_LOG10P_SPREAD
);
}

Expand Down
Loading

0 comments on commit afb7093

Please sign in to comment.