Skip to content

Commit

Permalink
Tick counter
Browse files Browse the repository at this point in the history
  • Loading branch information
DestructiveReasoning committed Jul 20, 2015
1 parent 1892245 commit 6c6bff3
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 65 deletions.
62 changes: 0 additions & 62 deletions PKGBUILD

This file was deleted.

1 change: 1 addition & 0 deletions PKGBUILD
62 changes: 62 additions & 0 deletions PKGBUILD.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Maintainer: Harley Wiltzer <[email protected]>
pkgname=conway-git
pkgver=0.1.1
pkgrel=1
pkgdesc="A conway's game of life player that uses ncurses"
arch=('x86_64')
url="https://github.com/DestructiveReasoning/Conway"
license=('BSD')
groups=()
depends=('ncurses')
makedepends=('git')
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=conway-git.install
source=($pkgname::git+https://github.com/DestructiveReasoning/Conway.git)
noextract=()
md5sums=('SKIP') #generate with 'makepkg -g'

_gitroot=https://github.com/DestructiveReasoning/Conway.git
_gitname=conway

build() {
cd "$srcdir"
msg "Connecting to GIT server...."

if [[ -d "$_gitname" ]]; then
cd "$_gitname" && git pull origin
msg "The local files are updated."
else
git clone "$_gitroot" "$_gitname"
fi

msg "GIT checkout done or server timeout"
msg "Starting build..."

rm -rf "$srcdir/$_gitname-build"
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
cd "$srcdir/$_gitname-build"

#
# BUILD HERE
#
#./autogen.sh
# ./configure --prefix=/usr
make
}

package() {
cd "$srcdir/$_gitname"
install -Dm 755 a.out "$pkgdir/usr/bin/$_gitname"
if [ ! -d "$HOME/.conway" ]; then
mkdir "$HOME/.conway"
fi
cp conwaylogo "$HOME/.conway/conwaylogo"
#make DESTDIR="${pkgdir}" install
}

# vim:set ts=2 sw=2 et:
md5sums=('SKIP')
12 changes: 9 additions & 3 deletions Source.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ int row, col;
int x,y;
int area;
int ticks;
int totalTicks = 0;
int color;
WINDOW *win = NULL;
WINDOW *game = NULL;
Expand Down Expand Up @@ -123,7 +124,7 @@ int main(int argc, char *argv[])

initCurses();
showSplash();

totalTicks = 0;
refresh();
getch();

Expand Down Expand Up @@ -227,6 +228,7 @@ int main(int argc, char *argv[])
{
cells[q] = 0;
}
totalTicks = 0;
render(cells, area/2);
updateWin(cells,area/2);
break;
Expand Down Expand Up @@ -343,7 +345,7 @@ int checkNeighbors(int x, int y, int cells[])
void update(int cells[], int size)
{
int numticks = ticks;
while(ticks >= 0)
while(ticks > 0)
{
int c;
// wclear(game);
Expand Down Expand Up @@ -373,6 +375,7 @@ void update(int cells[], int size)
wrefresh(game);
usleep(SLEEP_TIME);
ticks--;
totalTicks++;
}
ticks = numticks;
}
Expand All @@ -392,6 +395,7 @@ void updateWin(int cells[], int size)
mvwprintw(win,rows/2 - 2,2,"Board Size: [%d, %d]",xs,ys);
mvwprintw(win,rows/2 - 1,2,"Cells Alive: %d",cellsAlive);
mvwprintw(win,rows/2,2,"Ticks Remaining: %d",ticks);
mvwprintw(win,rows/2 + 2,2,"Total ticks: %d",totalTicks);
wrefresh(win);
}

Expand Down Expand Up @@ -462,6 +466,8 @@ void showSplash()

mvprintw(curcol + 1,cols/2 - 3, "CONWAY");
attroff(A_BOLD);
mvprintw(curcol + 2,cols/2 - 16, "Powered by Destructive Reasoning");
mvprintw(curcol + 2, cols/2 - 13, "Developed by Harley Wiltzer");
mvprintw(curcol + 3,cols/2 - 16, "Powered by Destructive Reasoning");
move(0,0);
attroff(COLOR_PAIR(YELLOW));
}
Binary file modified a.out
Binary file not shown.

0 comments on commit 6c6bff3

Please sign in to comment.