fixed string equality test

This commit is contained in:
Matthew Slowe 2017-10-15 16:59:05 +01:00
parent cce371ecb4
commit 7d313a6baf
No known key found for this signature in database
GPG Key ID: DE311E1AC27AC583
31 changed files with 256 additions and 2 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

91
counties.txt Executable file
View File

@ -0,0 +1,91 @@
Aberdeenshire
Anglesey
Angus
Antrim
Argyll
Armagh
Ayrshire
Banffshire
Bedfordshire
Berkshire
Berwickshire
Brecknockshire
Buckinghamshire
Buteshire
Caernarfonshire
Caithness
Cambridgeshire
Cardiganshire
Carmarthenshire
Cheshire
Clackmannanshire
Cornwall
Cromartyshire
Cumberland
Denbighshire
Derbyshire
Devon
Dorset
Down
Dumbartonshire
Dumfriesshire
Durham
East Lothian
Essex
Fermanagh
Fife
Flintshire
Glamorgan
Gloucestershire
Hampshire
Herefordshire
Hertfordshire
Huntingdonshire
Invernessshire
Kent
Kincardineshire
Kirkcudbrightshire
Lanarkshire
Lancashire
Leicestershire
Lincolnshire
Londonderry
Merionethshire
Middlesex
Midlothian
Monmouthshire
Montgomeryshire
Morayshire
Nairnshire
Norfolk
Northamptonshire
Northumberland
Nottinghamshire
Orkney
Oxfordshire
Peeblesshire
Pembrokeshire
Perthshire
Radnorshire
Renfrewshire
Rossshire
Roxburghshire
Rutland
Selkirkshire
Shetland
Shropshire
Somerset
Staffordshire
Stirlingshire
Suffolk
Surrey
Sussex
Sutherland
Tyrone
Warwickshire
West Lothian
Westmorland
Wigtownshire
Wiltshire
Worcestershire
Yorkshire

0
src/Makefile Normal file → Executable file
View File

BIN
src/a.out Executable file

Binary file not shown.

0
src/dir.c Normal file → Executable file
View File

0
src/dir.h Normal file → Executable file
View File

0
src/dir.o Normal file → Executable file
View File

0
src/grid.h Normal file → Executable file
View File

0
src/grid.o Normal file → Executable file
View File

0
src/rnd.c Normal file → Executable file
View File

0
src/rnd.h Normal file → Executable file
View File

0
src/rnd.o Normal file → Executable file
View File

BIN
src/t Executable file

Binary file not shown.

17
src/t.c Executable file
View File

@ -0,0 +1,17 @@
char** t(int a, int b);
char** t(int a, int b) {
char t[a][b];
int i, j;
for (i=0; i<a; i++) {
for (j=0; j<b; j++) {
t[i][j] = 'x';
}
}
return t;
}
int main() {
char **thing = t(5, 8);
exit(1);
}

49
src/tags Executable file
View File

@ -0,0 +1,49 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
ALPHABET_SIZE rnd.c 9;" d file:
DIRECTION_E dir.h /^ DIRECTION_E,$/;" e enum:direction
DIRECTION_N dir.h /^ DIRECTION_N,$/;" e enum:direction
DIRECTION_NE dir.h /^ DIRECTION_NE,$/;" e enum:direction
DIRECTION_NW dir.h /^ DIRECTION_NW$/;" e enum:direction
DIRECTION_S dir.h /^ DIRECTION_S,$/;" e enum:direction
DIRECTION_SE dir.h /^ DIRECTION_SE,$/;" e enum:direction
DIRECTION_SW dir.h /^ DIRECTION_SW,$/;" e enum:direction
DIRECTION_W dir.h /^ DIRECTION_W,$/;" e enum:direction
EXIT_WORDTOOLONG grid.c /^ EXIT_WORDTOOLONG,$/;" e enum:exitcodes file:
NUM_DIRECTIONS dir.h 15;" d
RND_MAXINT rnd.c 10;" d file:
WORDSEARCH_DIR dir.h 2;" d
WORDSEARCH_GRID grid.h 2;" d
WORDSEARCH_MAXTRIES grid.h 4;" d
WORDSEARCH_RND rnd.h 2;" d
bounds grid.h /^typedef struct bounds {$/;" s
bounds grid.h /^} bounds;$/;" t typeref:struct:bounds
c rnd.c /^ char c;$/;" m struct:letter_frequency file:
direction dir.h /^enum direction {$/;" g
directions dir.c /^int directions[] = {$/;" v
exitcodes grid.c /^enum exitcodes {$/;" g file:
free_grid grid.c /^void free_grid(char** grid, int height) {$/;" f
get_bounds grid.c /^bounds *get_bounds(int height, int width, enum direction direction, int length)$/;" f
get_direction dir.c /^int get_direction(int simple)$/;" f
get_random_letter rnd.c /^char get_random_letter()$/;" f
init_grid grid.c /^char **init_grid(char** old, int height, int width)$/;" f
letter_frequencies rnd.c /^} letter_frequencies[] = {$/;" v typeref:struct:letter_frequency
letter_frequency rnd.c /^struct letter_frequency {$/;" s file:
main dir.c /^int main()$/;" f
main grid.c /^int main()$/;" f
main rnd.c /^int main()$/;" f
make_grid grid.c /^char **make_grid(char **words, int height, int width, int simple, int count)$/;" f
max_x grid.h /^ int max_x;$/;" m struct:bounds
max_y grid.h /^ int max_y;$/;" m struct:bounds
min_x grid.h /^ int min_x;$/;" m struct:bounds
min_y grid.h /^ int min_y;$/;" m struct:bounds
move_x grid.c /^int move_x(int x, enum direction d) {$/;" f
move_y grid.c /^int move_y(int y, enum direction d) {$/;" f
p rnd.c /^ int p; \/* pegged to 10000 rather than 1 *\/$/;" m struct:letter_frequency file:
place_word grid.c /^int place_word(char *word, char **grid, int height, int width, int simple)$/;" f
print_grid grid.c /^void print_grid(char** grid, int height) {$/;" f
random_number rnd.c /^int random_number(int min_num, int max_num)$/;" f

52
tags Executable file
View File

@ -0,0 +1,52 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
Bounds uk/org/mafoo/wordsearch/Bounds.java /^ protected Bounds(int min_y, int max_y, int min_x, int max_x) {$/;" m class:Bounds
Bounds uk/org/mafoo/wordsearch/Bounds.java /^class Bounds {$/;" c
CouldNotPlaceWordException uk/org/mafoo/wordsearch/CouldNotPlaceWordException.java /^ protected CouldNotPlaceWordException() {$/;" m class:CouldNotPlaceWordException
CouldNotPlaceWordException uk/org/mafoo/wordsearch/CouldNotPlaceWordException.java /^class CouldNotPlaceWordException extends Exception {$/;" c
Direction uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" g
DistributedRandomNumberGenerator uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^ public DistributedRandomNumberGenerator() {$/;" m class:DistributedRandomNumberGenerator
DistributedRandomNumberGenerator uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^public class DistributedRandomNumberGenerator {$/;" c
E uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
GridFactory uk/org/mafoo/wordsearch/GridFactory.java /^public class GridFactory {$/;" c
MAX_TRIES uk/org/mafoo/wordsearch/GridFactory.java /^ static final int MAX_TRIES = 500;$/;" f class:GridFactory
N uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
NE uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
NW uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
S uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
SE uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
SW uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
W uk/org/mafoo/wordsearch/Direction.java /^enum Direction { N, NE, E, SE, S, SW, W, NW; };$/;" e enum:Direction file:
addNumber uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^ public void addNumber(int value, double distribution) {$/;" m class:DistributedRandomNumberGenerator
chars uk/org/mafoo/wordsearch/GridFactory.java /^ private static char[] chars = new char[] {$/;" f class:GridFactory file:
clone2d uk/org/mafoo/wordsearch/GridFactory.java /^ private static char[][] clone2d(char[][] source) {$/;" m class:GridFactory file:
directions uk/org/mafoo/wordsearch/GridFactory.java /^ private static Direction[] directions = new Direction[] { Direction.N, Direction.NE, Direction.E, Direction.SE, Direction.S, Direction.SW, Direction.W, Direction.NW };$/;" f class:GridFactory file:
distSum uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^ private double distSum;$/;" f class:DistributedRandomNumberGenerator file:
distribution uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^ private HashMap<Integer, Double> distribution;$/;" f class:DistributedRandomNumberGenerator file:
drng uk/org/mafoo/wordsearch/GridFactory.java /^ static DistributedRandomNumberGenerator drng = new DistributedRandomNumberGenerator();$/;" f class:GridFactory
dump2d uk/org/mafoo/wordsearch/GridFactory.java /^ private static void dump2d(char[][] g) {$/;" m class:GridFactory file:
getBounds uk/org/mafoo/wordsearch/GridFactory.java /^ private static Bounds getBounds(int height, int width, Direction direction, int length) {$/;" m class:GridFactory file:
getDirection uk/org/mafoo/wordsearch/GridFactory.java /^ private static Direction getDirection(boolean simple) {$/;" m class:GridFactory file:
getDistributedRandomNumber uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^ public int getDistributedRandomNumber() {$/;" m class:DistributedRandomNumberGenerator
getRandomChar uk/org/mafoo/wordsearch/GridFactory.java /^ private static char getRandomChar() {$/;" m class:GridFactory file:
main uk/org/mafoo/wordsearch/GridFactory.java /^ public static void main(String[] args) throws IOException {$/;" m class:GridFactory
makeGrid uk/org/mafoo/wordsearch/GridFactory.java /^ public static char[][] makeGrid(List<String> words, int height, int width) {$/;" m class:GridFactory
makeGrid uk/org/mafoo/wordsearch/GridFactory.java /^ public static char[][] makeGrid(List<String> words, int height, int width, boolean simple) {$/;" m class:GridFactory
max_x uk/org/mafoo/wordsearch/Bounds.java /^ int max_x;$/;" f class:Bounds
max_y uk/org/mafoo/wordsearch/Bounds.java /^ int max_y;$/;" f class:Bounds
min_x uk/org/mafoo/wordsearch/Bounds.java /^ int min_x;$/;" f class:Bounds
min_y uk/org/mafoo/wordsearch/Bounds.java /^ int min_y;$/;" f class:Bounds
move_x uk/org/mafoo/wordsearch/GridFactory.java /^ private static int move_x(int x, Direction d) {$/;" m class:GridFactory file:
move_y uk/org/mafoo/wordsearch/GridFactory.java /^ private static int move_y(int y, Direction d) {$/;" m class:GridFactory file:
placeWord uk/org/mafoo/wordsearch/GridFactory.java /^ private static char[][] placeWord(String word, char[][] grid, boolean simple) throws CouldNotPlaceWordException {$/;" m class:GridFactory file:
rnd uk/org/mafoo/wordsearch/GridFactory.java /^ static Random rnd = new Random();$/;" f class:GridFactory
toString uk/org/mafoo/wordsearch/Bounds.java /^ public String toString() {$/;" m class:Bounds
uk.org.mafoo.wordsearch uk/org/mafoo/wordsearch/Bounds.java /^package uk.org.mafoo.wordsearch;$/;" p
uk.org.mafoo.wordsearch uk/org/mafoo/wordsearch/CouldNotPlaceWordException.java /^package uk.org.mafoo.wordsearch;$/;" p
uk.org.mafoo.wordsearch uk/org/mafoo/wordsearch/Direction.java /^package uk.org.mafoo.wordsearch;$/;" p
uk.org.mafoo.wordsearch uk/org/mafoo/wordsearch/DistributedRandomNumberGenerator.java /^package uk.org.mafoo.wordsearch;$/;" p
uk.org.mafoo.wordsearch uk/org/mafoo/wordsearch/GridFactory.java /^package uk.org.mafoo.wordsearch;$/;" p

0
uk/org/mafoo/wordsearch/Direction.java Normal file → Executable file
View File

0
uk/org/mafoo/wordsearch/Modes.java Normal file → Executable file
View File

0
uk/org/mafoo/wordsearch/Store.java Normal file → Executable file
View File

28
uk/org/mafoo/wordsearch/f Executable file
View File

@ -0,0 +1,28 @@
Letter Frequency
E 12.02
T 9.10
A 8.12
O 7.68
I 7.31
N 6.95
S 6.28
R 6.02
H 5.92
D 4.32
L 3.98
U 2.88
C 2.71
M 2.61
F 2.30
Y 2.11
W 2.09
G 2.03
P 1.82
B 1.49
V 1.11
K 0.69
X 0.17
Q 0.11
J 0.10
Z 0.07

16
war/WEB-INF/jspf/footer.jspf Executable file
View File

@ -0,0 +1,16 @@
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
// tracker methods like "setCustomDimension" should be called before "trackPageView"
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//mafoo.org.uk/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '3']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//mafoo.org.uk/piwik/piwik.php?idsite=3&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

0
war/WEB-INF/lib/commons-lang.jar Normal file → Executable file
View File

0
war/WEB-INF/lib/json-simple-1.1.1.jar Normal file → Executable file
View File

BIN
war/WEB-INF/lib/sqlite-3.20.0.jar Executable file

Binary file not shown.

BIN
war/WEB-INF/lib/wordsearch.jar Executable file

Binary file not shown.

0
war/api.jsp Normal file → Executable file
View File

0
war/base.css Normal file → Executable file
View File

View File

@ -15,8 +15,8 @@
int width = Integer.parseInt(request.getParameter("width"));
Modes mode = Modes.NORMAL;
if(request.getParameter("mode") != null) {
if(request.getParameter("mode") == "SIMPLE") mode = Modes.SIMPLE;
if(request.getParameter("mode") == "CROSSWORD") mode = Modes.CROSSWORD;
if(request.getParameter("mode").equals("SIMPLE")) mode = Modes.SIMPLE;
if(request.getParameter("mode").equals("CROSSWORD")) mode = Modes.CROSSWORD;
}
String name = StringEscapeUtils.escapeHtml(request.getParameter("name"));
@ -33,6 +33,7 @@
String csv = "";
%>
<body>
<h1><%= name %></h1>
<div class="noprint">

BIN
wordsearch.jar Executable file

Binary file not shown.

BIN
wordsearch.war Executable file

Binary file not shown.