-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1012 lines (728 loc) · 21.4 KB
/
Copy pathindex.html
File metadata and controls
1012 lines (728 loc) · 21.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<!--
File: ~/scrabble_v2.html
91.461 Assignment 9: Implementing a Bit of Scrabble with Drag-and-Drop
Jason Downing - student at UMass Lowell in 91.461 GUI Programming I
Contact: jdowning@cs.uml.edu or jason_downing@student.uml.edu
MIT Licensed - see http://opensource.org/licenses/MIT for details.
Anyone may freely use this code. Just don't sue me if it breaks stuff.
Created: Nov 24, 2015.
Last Updated: Dec 8, 9PM.
This page is for assignment #9, "Scrabble".
It will contain a full feature Scrabble game that will do tons of fun stuff
like connect to external APIs, make use of the jQuery UI library, and even
score / check for valid words / etc.
NOTE ABOUT BOOTSTRAP GRID SYSTEM AND SCREEN RESOLUTIONS:
I have modified Bootstrap by custom compiling my own version.
My version has the following properties:
14 column grid system (not 12)
col-md activates at 1250px width (not 922px)
col-lg activates at 1900px width (not 1200px)
Compiled at this website: http://getbootstrap.com/customize/?id=78029697512ef0d88bbc
-->
<!--
Google fonts. Included here at the top for performance gains and to avoid the use of @import
like Google recommends here:
http://googlewebfonts.blogspot.com/2010/09/optimizing-use-of-google-font-api.html
Fix for the validator comes from this page (| is encoded as %7C):
https://stackoverflow.com/questions/22466913/google-fonts-url-break-html5-validation-on-w3-org
-->
<link rel="stylesheet" type="text/css"
href="http://fonts.googleapis.com/css?family=Advent+Pro%7CBangers%7CSlackey%7CSigmar+One%7CRighteous%7CUbuntu">
<!-- Configuration -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Custom Title Bar -->
<title>Scrabble</title>
<!-- Custom Bootstrap! 14 grids instead of 12! -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Custom theme too! -->
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<!-- Sweet Alerts! AWESOME! -->
<link rel="stylesheet" type="text/css" href="css/sweetalert.css">
<!-- CSS file to override stuff, different file so I can modify stuff and rewrite the CSS. -->
<link rel="stylesheet" href="css/scrabble_v2.css">
<!-- Custom favicon - not mine, from this
URL: http://orig10.deviantart.net/7bc3/f/2013/338/8/8/flat_scrabble_icon_by_awesomestwinner-d6wpolw.png -->
<link rel="shortcut icon" href="img/scrabble.ico" type="image/x-icon">
</head>
<body>
<!-- First row - the Scrabble game board -->
<div class="row-fluid">
<div class="col-sm-14 col-md-5 col-lg-7">
<div class="center_text_images">
<h1 class="name">
<span class="highlight_fun">SCRABBLE v2</span>
</h1>
<br>
<div class="col-sm-7 col-md-7 col-lg-7">
<div class="highlight_centered_smaller">LET'S PLAY SOME SCRABBLE!</div>
<br>
</div>
<div class="col-sm-7 col-md-7 col-lg-7">
<div class="highlight_centered_smaller"><a href="rules.html">RULES FOUND HERE.</a></div>
</div>
<div class="col-sm-14 col-md-14 col-lg-14">
<div class="highlight_centered">
Word: <span id="word">____</span>
<div class="divider"></div>
Score: <span id="score">0</span>
</div>
</div>
<!--
Submit word: should verify that the entered word is real through some
dictionary or API.
Reset tiles: should wipe the board for a new game.
possibly think about adding more rows for Scrabble. (non-trivial)
-->
<div class="col-sm-8 col-md-14 col-lg-14">
<!-- Add some vertical spacing between the word/score and the two submit buttons
on medium / large devices. -->
<div class="space_top"></div>
<button onclick="submit_word()">Submit Word</button>
<!-- Add some horizontal spacing between the three buttons. -->
<div class="divider"></div>
<button onclick="reset_tiles();">Recall Tiles</button>
<!-- Add some horizontal spacing between the three buttons. -->
<div class="divider"></div>
<button class="button_spacing" onclick="confirm_reset();">Reset Board</button>
</div>
<!-- Error / Success messages appear in this div. -->
<div class="col-sm-6 col-md-14 col-lg-14">
<div id="messages"></div>
</div>
<!-- Letters Remaining Table -->
<div class="col-sm-7 col-md-14 col-lg-14">
<!--
Table to show the letters remaining in the "Bag" of tiles
Each row is 9 columns long.
The very last row has the blank, "_", as well as an empty cell.
This is currently hard coded but should be updatable via a JavaScript
function. Should be possible to get each row of this table and
iterate through the cells and change the inside HTML to say the new
letter amount.
This should also be resetable whenever the game is reset.
-->
<div class="divider"></div>
<table id="letters_remain">
<tr>
<td class="larger_td" colspan="9">LETTERS REMAINING</td>
</tr>
<tr>
<td class="larger_td">A: 9</td>
<td class="larger_td">B: 2</td>
<td class="larger_td">C: 2</td>
<td class="larger_td">D: 4</td>
<td class="larger_td">E: 12</td>
<td class="larger_td">F: 2</td>
<td class="larger_td">G: 3</td>
<td class="larger_td">H: 2</td>
<td class="larger_td">I: 9</td>
</tr>
<tr>
<td class="larger_td">J: 1</td>
<td class="larger_td">K: 1</td>
<td class="larger_td">L: 4</td>
<td class="larger_td">M: 2</td>
<td class="larger_td">N: 6</td>
<td class="larger_td">O: 8</td>
<td class="larger_td">P: 2</td>
<td class="larger_td">Q: 1</td>
<td class="larger_td">R: 6</td>
</tr>
<tr>
<td class="larger_td">S: 2</td>
<td class="larger_td">T: 6</td>
<td class="larger_td">U: 8</td>
<td class="larger_td">V: 2</td>
<td class="larger_td">W: 2</td>
<td class="larger_td">X: 1</td>
<td class="larger_td">Y: 2</td>
<td class="larger_td">Z: 1</td>
<td class="larger_td">_: 2</td>
</tr>
</table>
</div>
</div>
</div>
<!-- Scrabble board / Rack are in this column. -->
<div class="col-sm-14 col-md-9 col-lg-7">
<br><br>
<!--
Scrabble Game table.
Important classes:
double_word -> make the word double value
triple_word -> make the word tripple value
double_letter -> make the letter double value
triple_letter -> make the letter tripple value
If a tile does not have one of those four classes, then it is worth
normal value. Double / Tripple word tiles can still increase the
value of the word however if any one tile has landed on that space.
Game board based off of this image of Scrabble:
https://farm1.static.flickr.com/23/30997788_a595e9e158_o.jpg
-->
<div class="center_text_images">
<table id="scrabble_board">
<!-- First Row -->
<tr>
<td class="triple_word">
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td class="triple_word">
</td>
</tr>
<!-- Second Row -->
<tr>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
</tr>
<!-- Third Row -->
<tr>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
</tr>
<!-- 4th Row -->
<tr>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
</tr>
<!-- 5th Row -->
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<!-- 6th Row -->
<tr>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
</tr>
<!-- 7th Row -->
<tr>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
</tr>
<!-- 8th Row -->
<tr>
<td class="triple_word">
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="star">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
</tr>
<!-- 9th Row -->
<tr>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
</tr>
<!-- 10th Row -->
<tr>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
</tr>
<!-- 11th Row -->
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<!-- 12th Row -->
<tr>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
</tr>
<!-- 13th Row -->
<tr>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
</tr>
<!-- 14th Row -->
<tr>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_word">
</td>
<td>
</td>
</tr>
<!-- 15th Row -->
<tr>
<td class="triple_word">
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="triple_word">
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="double_letter">
</td>
<td>
</td>
<td>
</td>
<td class="triple_word">
</td>
</tr>
</table>
</div>
<br>
<!-- Spacing to force the swap tile over to the right -->
<div class="col-sm-1 col-md-2 col-lg-1"></div>
<div class="col-sm-5 col-md-4 col-lg-5">
<!-- Get new tile spot. Moved this right next to the rack for easy swapping of tiles. -->
<div id="get_new_tile">
<p>Swap a tile for a new one!</p>
<p>(drop the tile here)</p>
</div>
</div>
<!--
Scrabble rack from:
https://pixabay.com/static/uploads/photo/2014/07/31/20/48/scrabble-tile-holder-406774_640.png
NO LONGER USING THIS CLASS. SAVED FOR FUTURE REFERENCE.
class="resize_rack"
-->
<div class="col-sm-8 col-md-8 col-lg-8">
<img id="the_rack" src="img/scrabble/Scrabble_Rack_flat.resized.png" alt="scrabble rack">
<div id="rack"></div> <!-- THIS ID IS REQUIRED TO APPEND THE TILES TO. -->
</div>
</div>
</div> <!-- End of the row-fluid container -->
<!--
These are moved to the bottom of the <body> tag to decrease website load time.
This stackoverflow post is helpful for this issue:
https://stackoverflow.com/questions/6625773/where-should-i-put-the-css-and-javascript-code-in-an-html-webpage
See Yahoo's best practice rules as well:
https://developer.yahoo.com/performance/rules.html#css_top=
-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins). -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<!-- Custom Bootstrap with 14 grid! JavaScript file for it. -->
<script src="js/scrabble/bootstrap.min.js" type="text/javascript"></script>
<!-- jQuery UI -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" type="text/javascript"></script>
<!-- Found this great hack to get jQuery UI working on mobile devices, such as iOS and Android devices!
See this URL for the download location: http://touchpunch.furf.com/
Note that this JS file is open source and dual licensed under the MIT and GPL Version 2 licenses.
See the GitHub page here: https://github.com/furf/jquery-ui-touch-punch/
-->
<script src="js/scrabble/jquery.ui.touch-punch.min.js" type="text/javascript"></script>
<!-- Sweet Alerts! Awesome! -->
<script src="js/scrabble/sweetalert.min.js" type="text/javascript"></script>
<!-- JS Global Variables -->
<script src="js/scrabble/variables.js" type="text/javascript"></script>
<!-- Functions that the three buttons run are found here. "Submit", "Recall", "Reset" buttons. -->
<script src="js/scrabble/buttons.js" type="text/javascript"></script>
<!-- JS Utility functions for this Scrabble board game. Has the random function, find position functions,
and a few other misc. functions that are used throughout the reset of the JS files. -->
<script src="js/scrabble/util.js" type="text/javascript"></script>
<!-- Score functions that determine the score of the current word / total score if multiple
words are played. -->
<script src="js/scrabble/score.js" type="text/javascript"></script>
<!-- Function that runs the jQuery UI draggable code. -->
<script src="js/scrabble/draggable.js" type="text/javascript"></script>