Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mackw assignment 2 #6

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c06ce52
onid folder created in class projects folder
Sep 26, 2018
7199ac8
Changed assignment 1 readme
Sep 26, 2018
7eeabe2
adventurer function
taylormack253 Oct 5, 2018
67ab86a
playSmithy
taylormack253 Oct 5, 2018
4713af7
council room
taylormack253 Oct 7, 2018
9ae7d89
village
taylormack253 Oct 7, 2018
2b679ca
Great Hall
taylormack253 Oct 8, 2018
7c9b8ee
import
Oct 8, 2018
c0f18c0
merge error'
Oct 8, 2018
81ccab7
fixing merging issues
Oct 8, 2018
dd84af4
removal of merge files
Oct 8, 2018
18d6051
fix build errors
taylormack253 Oct 8, 2018
1e1cca4
Merge branch 'mackw-assignment-2' of https://github.com/taylormack253…
taylormack253 Oct 8, 2018
06b8d67
fix more build errors
taylormack253 Oct 8, 2018
c6184c8
fix even more build errors
taylormack253 Oct 9, 2018
784de00
fixed smithy output
taylormack253 Oct 9, 2018
9b0c197
council room strat added
taylormack253 Oct 9, 2018
beeec67
great hall strat added
taylormack253 Oct 9, 2018
5ffa531
estates and duchys added
taylormack253 Oct 9, 2018
10153a6
fixed council room buys
taylormack253 Oct 9, 2018
9dc37ed
more council room fixes
taylormack253 Oct 9, 2018
f7f7587
more cuncil room changes
taylormack253 Oct 9, 2018
8ad2c9d
council room fixes
taylormack253 Oct 9, 2018
adccbdd
council room fixes
taylormack253 Oct 9, 2018
acf7691
council room testing
taylormack253 Oct 9, 2018
3d59d6a
council room fixed
taylormack253 Oct 9, 2018
372c5ad
council room vs adventurer
taylormack253 Oct 9, 2018
1bce257
adventurer vs council room
taylormack253 Oct 9, 2018
7f09a77
Revert "fixed smithy output"
taylormack253 Oct 12, 2018
63eca45
default playdom
taylormack253 Oct 12, 2018
2382809
bugs to adventurer and smithy added
taylormack253 Oct 14, 2018
e088219
bugs added to counill room and great hall
taylormack253 Oct 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions projects/mackw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Wlliam Taylor Mack (mackw)

This is my assignment-1 submission!
39 changes: 39 additions & 0 deletions projects/mackw/dominion/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
CFLAGS= -Wall -fpic -coverage -lm -std=c99

rngs.o: rngs.h rngs.c
gcc -c rngs.c -g $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
gcc -c dominion.c -g $(CFLAGS)

playdom: dominion.o playdom.c
gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)
#To run playdom you need to entere: ./playdom <any integer number> like ./playdom 10*/
testDrawCard: testDrawCard.c dominion.o rngs.o
gcc -o testDrawCard -g testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
gcc -o badTestDrawCard -g badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
gcc -o testDrawCard -g testDrawCard.c dominion.o rngs.o $(CFLAGS)

testAll: dominion.o testSuite.c
gcc -o testSuite testSuite.c -g dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
gcc -c interface.c -g $(CFLAGS)

runtests: testDrawCard
./testDrawCard &> unittestresult.out
gcov dominion.c >> unittestresult.out
cat dominion.c.gcov >> unittestresult.out


player: player.c interface.o
gcc -o player player.c -g dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player

clean:
rm -f *.o playdom.exe playdom player player.exe *.gcov *.gcda *.gcno *.so *.out testDrawCard testDrawCard.exe
39 changes: 39 additions & 0 deletions projects/mackw/dominion/Makefile~
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
CFLAGS = -Wall -fpic -coverage -lm -std=c99

rngs.o: rngs.h rngs.c
gcc -c rngs.c -g $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
gcc -c dominion.c -g $(CFLAGS)

playdom: dominion.o playdom.c
gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)
#To run playdom you need to entere: ./playdom <any integer number> like ./playdom 10*/
testDrawCard: testDrawCard.c dominion.o rngs.o
gcc -o testDrawCard -g testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
gcc -o badTestDrawCard -g badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
gcc -o testDrawCard -g testDrawCard.c dominion.o rngs.o $(CFLAGS)

testAll: dominion.o testSuite.c
gcc -o testSuite testSuite.c -g dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
gcc -c interface.c -g $(CFLAGS)

runtests: testDrawCard
./testDrawCard &> unittestresult.out
gcov dominion.c >> unittestresult.out
cat dominion.c.gcov >> unittestresult.out


player: player.c interface.o
gcc -o player player.c -g dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player

clean:
rm -f *.o playdom.exe playdom player player.exe *.gcov *.gcda *.gcno *.so *.out testDrawCard testDrawCard.exe
2 changes: 2 additions & 0 deletions projects/mackw/dominion/READM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
run make all #To compile the dominion code
run ./playdom 30 # to run playdom code
Binary file added projects/mackw/dominion/badTestDrawCard
Binary file not shown.
44 changes: 44 additions & 0 deletions projects/mackw/dominion/badTestDrawCard.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

#define DEBUG 0
#define NOISY_TEST 1

int checkDrawCard(int p, struct gameState *post) {
int r;

r = drawCard (p, post);
}

int main () {

int i, n, r, p, deckCount, discardCount, handCount;

int k[10] = {adventurer, council_room, feast, gardens, mine,
remodel, smithy, village, baron, great_hall};

struct gameState G;

printf ("Testing drawCard.\n");

printf ("RANDOM TESTS.\n");

SelectStream(2);
PutSeed(3);

for (n = 0; n < 2000; n++) {
for (i = 0; i < sizeof(struct gameState); i++) {
((char*)&G)[i] = floor(Random() * 256);
}
p = floor(Random() * 1000);
checkDrawCard(p, &G);
}

printf ("ALL TESTS OK\n");

exit(0);
}
20 changes: 20 additions & 0 deletions projects/mackw/dominion/badTestDrawCard.dSYM/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.badTestDrawCard</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
70 changes: 70 additions & 0 deletions projects/mackw/dominion/betterTestDrawCard.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

#define DEBUG 0
#define NOISY_TEST 1

int checkDrawCard(int p, struct gameState *post) {
int r;

r = drawCard (p, post);

assert (r == 0);
}

int main () {

int i, n, r, p, deckCount, discardCount, handCount;

int k[10] = {adventurer, council_room, feast, gardens, mine,
remodel, smithy, village, baron, great_hall};

struct gameState G;

printf ("Testing drawCard.\n");

printf ("RANDOM TESTS.\n");

SelectStream(2);
PutSeed(3);

for (n = 0; n < 2000; n++) {
for (i = 0; i < sizeof(struct gameState); i++) {
((char*)&G)[i] = floor(Random() * 256);
}
p = floor(Random() * 2);
G.deckCount[p] = floor(Random() * MAX_DECK);
G.discardCount[p] = floor(Random() * MAX_DECK);
G.handCount[p] = floor(Random() * MAX_HAND);
checkDrawCard(p, &G);
}

printf ("ALL TESTS OK\n");

exit(0);

printf ("SIMPLE FIXED TESTS.\n");
for (p = 0; p < 2; p++) {
for (deckCount = 0; deckCount < 5; deckCount++) {
for (discardCount = 0; discardCount < 5; discardCount++) {
for (handCount = 0; handCount < 5; handCount++) {
memset(&G, 23, sizeof(struct gameState));
r = initializeGame(2, k, 1, &G);
G.deckCount[p] = deckCount;
memset(G.deck[p], 0, sizeof(int) * deckCount);
G.discardCount[p] = discardCount;
memset(G.discard[p], 0, sizeof(int) * discardCount);
G.handCount[p] = handCount;
memset(G.hand[p], 0, sizeof(int) * handCount);
checkDrawCard(p, &G);
}
}
}
}

return 0;
}
Loading