Commit 751f52e3 authored by Yiğit Yusuf Çılgı's avatar Yiğit Yusuf Çılgı
Browse files

Initial commit

parents
# Project: algogame
# Makefile created by Dev-C++ 5.11
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = algogame.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm.exe -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
[Project]
FileName=algogame.dev
Name=algogame
Type=1
Ver=2
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
LogOutput=
LogOutputEnabled=0
OverrideOutput=0
OverrideOutputName=
HostApplication=
UseCustomMakefile=0
CustomMakefile=
CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000000000000000000
UnitCount=1
[VersionInfo]
Major=1
Minor=0
Release=0
Build=0
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
SyncProduct=1
[Unit1]
FileName=main.c
CompileCpp=0
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
File added
[Editor_0]
CursorCol=1
CursorRow=14
TopLine=1
LeftChar=1
[Editors]
Order=0
Focused=0
[Editor_1]
CursorCol=1
CursorRow=1
TopLine=1
LeftChar=1
#include <stdio.h>
#include <windows.h>
#include <time.h>
#define SOL 75
#define SAG 77
#define YUKARI 72
#define ASAGI 80
#define SOLSINIR 4
#define SAGSINIR 57
#define ALTSINIR 24
#define USTSINIR 6
void gotoxy(int x, int y);
void hidecursor();
int yemcagir;
int sayix,sayiy,i;
void yemle()
{
sayix = rand() % 15 + 5;
sayiy = rand() % 15 + 5;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos = {sayiy, sayix};
SetConsoleCursorPosition(hConsole, pos);
WriteConsole(hConsole, "*", 10, NULL, NULL);
}
void main()
{
printf("CIKIS ICIN SIFIRA BAS");
int karx=15,kary=13;
int x=15, y=10, ch1, ch2 ;
hidecursor();
gotoxy(karx, kary);
printf("c");
ch1 = getch();
ch2 = 0;
srand(time(NULL));
if (ch1 == 0xE0)
{
while(ch2=getch())
{
yemcagir=1+rand()%45;
if(yemcagir==40) yemle();
if(ch2 == 'X') exit(0);
if(ch2 == SOL)
{
if(karx>SOLSINIR)
{
gotoxy(--karx,kary);
printf("c");
gotoxy(karx+1,kary);
printf(" ");
}
}
if(ch2 == SAG)
{
if(karx<SAGSINIR)
{
gotoxy(++karx,kary);
printf("c");
gotoxy(karx-1,kary);
printf(" ");
}
}
if(ch2 == YUKARI)
{
if(kary>USTSINIR)
{
gotoxy(karx,--kary);
printf("c");
gotoxy(karx,kary+1);
printf(" ");
}
}
if(ch2 == ASAGI)
{
if(kary<ALTSINIR)
{
gotoxy(karx,++kary);
printf("c");
gotoxy(karx,kary-1);
printf(" ");
}
}
}
}
getch();
}
void hidecursor(){
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
void gotoxy(int x, int y)
{
COORD Pos = { x - 1, y - 1 };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
File added
File added
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment