Giter Site home page Giter Site logo

opp-mine-sweeper-game's Introduction

🌜 소개

Hits

  • 🌊Yeram Kim🌊
  • 홍익대학교 게임학부 게임소프트웨어학과 4학년 재학중😼
  • 클라이언트 프로그래머 지망😊

🌜 공부 하는 것들..

Solved.ac프로필

opp-mine-sweeper-game's People

Contributors

yeram522 avatar

Watchers

 avatar

opp-mine-sweeper-game's Issues

🐞.run() while문 탈출시 힙 충돌 오류

image

Game2D.cpp

void Game2D::run()
{.
.
.
while (*isLooping) {
		clear();

		if (GetNumberOfConsoleInputEvents(hStdi
.
.
.

위의 while문 루프를 탈출하면, HEAP CORRUPTION DETECTED 오류가 생긴다.
처음에는 isLooping 변수 문제인줄 알았느데, Game2D소멸자가 호출되면서 canvas배열 메모리가 해제되며 뭔가 충돌이 일어 난 다는 것을 알았다..ㅠㅠ 근데 왜 해제할때 충돌이 나는지 모르겠다. 걍 delte를 안하면 또 오류가 안생김!!ㅠㅠ왤까

🐞[ERROR] member function declared with 'override' does not override a base class member

main.cpp
image

Game2D.h
image

Game2D의 함수를 아예 사용하지 않는 다는 것을 가정하고, virtual/override 를 사용해서 명시해뒀는데,
member function declared with 'override' does not override a base class member
라고 빨간 줄이 떴다.

내가 이 함수에게 적용한 다른 함수 같은 경우에는 오버라이드 된 자식의 함수의 반환형과 매개변수가 void였고, 부모 함수도 마찬가지였다. 그래서 부모함수는 무시하고 바로 자식 함수를 오버라이드 해라! 라고 간접적으로 컴파일러에게 알려주는 용으로 사용하였다.

하지만, Game2D에 선언한 함수는 오버라이드된 함수와 비교했을 때, 매개변수의 개수가 다르다는 점이 있다.
따라서 굳이 명시하지 않아도, 함수를 사용할 때 자동적으로 자식의 함수가 불러져 올 것이다.

그래서 매개변수의 갯수를 부모 함수와 같게 해주고 viirtual, override 키워드를 사용했는데
그래도 여전히 오류가 해결되지 않았다.

💡 키워드를 사용하지 않고 매개변수 갯수르 다르게 해줘서 오류는 해결했지만, 왜 키워드를 사용하면 오류가 날까?
알아봐야겠다!!

🐞랜덤지뢰 생성 개수 버그

image
정상출력

image
비정상적인출력 👉 Flag와 Spot의 개수가 다름.

🤔 정말 랜덤하게 Flag개수와 지뢰개수가 일치할 떄도 있고, 일치하지 않을 때도 있다.ㅜㅜ

🐞 주변 지뢰 카운트 함수 알고리즘 오류

image
어떤 문제가 있는지는, 새 파일 불러다가 찬찬히 디버깅 해봐야 할 것 같다..ㅠ
우선 오늘은 너무 피곤..ㅠㅠ쉬고, 주말에 달려야집...

Filed.cpp

void Field::Compute_Near_Mine(const int _size,Field* _fields)
{
	//전체필드만큼 반복문을 돌리고,
	//\n인 필드와 *지뢰 필드는 계산에서 제외한다.
	//배열에 초과하는 필드는 거른다.
	for (int index = 1; index < _size + 1; index++)//배열 field 탐색
	{
		if (_fields[index-1].GetState() == STATE_SPOT || (index % 11==0 && index>=11)) continue;//지뢰 필드인 경우 탐색하지 않음.

		for (int point = index - 1; point < index + 2; point++)// |i-1|i|i+1| i를 기준으로 둘레 탐색.
		{
			if (point % 11 == 0 && point>=11) continue;
			
			int up = point - 11 * (point / 11);//11은 width+1 나중에 바꿔줄거임. 보기 쉽게.
			int down = point + 11 * (point / 11);//11은 width+1 나중에 바꿔줄거임. 보기 쉽게.

			if (point < 11)
			{
				up = 0;
				down = point + 11 * (point / 11 + 1);
			}
			
			//1~size 범위에 만족하고 필드에 지뢰가 있으면.
			if (up >= 1 && up < _size-11)
			{
				if (_fields[up - 1].GetState() == STATE_SPOT)
				{
					
					_fields[index - 1].Changestate(_fields[index - 1].GetState() + 1);
				}
			}
			
			if (down >= 12  && down < _size)
			{
				if (_fields[down - 1].GetState() == STATE_SPOT)
				{
					_fields[index - 1].Changestate(_fields[index - 1].GetState() + 1);
				}
			}

			if(_fields[point-1].GetState() == STATE_SPOT && point != index) 
				_fields[index - 1].Changestate(_fields[index - 1].GetState() + 1);
		}
	}
	
}

🐞[ERROR] E0245 : a nonstatic member reference must be relative to a specific object

virtual/override 함수 사용 과정에서 override,virtula 명시했는데ㅠㅠ계속 빨간줄임..ㅠㅠ

Game2D.cppGetClickedField(mer);

if (mer.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
		{
			printf("left button press %d %d\n", mer.dwMousePosition.X, mer.dwMousePosition.Y);
			GetClickedField(mer);
		}
		else if (mer.dwButtonState == RIGHTMOST_BUTTON_PRESSED)
		{

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.