diff --git a/1000.pdf b/1000.pdf new file mode 100644 index 0000000..23fcb11 Binary files /dev/null and b/1000.pdf differ diff --git a/813.html b/813.html new file mode 100644 index 0000000..8574776 --- /dev/null +++ b/813.html @@ -0,0 +1,12 @@ +Chapter 1: Developing Your First Game
+Chapter 2: Writing Your First Game, Again
+Chapter 3: Understanding Object-Oriented Programming from the Start
+Chapter 4: More OOPing Around
+Chapter 5: Understanding Polymorphism
+Chapter 6: Using Polymorphism via Interfaces
+Chapter 7: Creating Multiplayer Games
+Chapter 8: Using DirectX
+Chapter 9 Learning Other Object-Oriented Programming Topics
+Appendix A: The Basics of Visual Basic
+Appendix B: Using POV-RAY and Moray
+Appendix C: Using the BMPStitch Utility \ No newline at end of file diff --git a/9781590591147.jpg b/9781590591147.jpg new file mode 100644 index 0000000..ed5febe Binary files /dev/null and b/9781590591147.jpg differ diff --git a/998.pdf b/998.pdf new file mode 100644 index 0000000..e2b1d3c Binary files /dev/null and b/998.pdf differ diff --git a/Files/Art/Dice/256color/dice.pal b/Files/Art/Dice/256color/dice.pal new file mode 100644 index 0000000..f599b51 --- /dev/null +++ b/Files/Art/Dice/256color/dice.pal @@ -0,0 +1,259 @@ +JASC-PAL +0100 +256 +0 0 0 +41 0 0 +49 0 0 +49 8 8 +49 16 16 +57 0 0 +57 8 8 +57 16 16 +57 16 24 +57 24 24 +57 24 33 +57 33 33 +66 0 0 +66 8 8 +66 16 16 +66 16 24 +66 24 24 +66 24 33 +66 33 33 +66 33 41 +66 41 41 +66 41 49 +66 49 49 +66 49 57 +74 0 0 +74 8 8 +74 16 16 +74 16 24 +74 24 24 +74 24 33 +74 33 33 +74 33 41 +74 41 41 +74 41 49 +74 49 49 +74 49 57 +74 57 57 +74 57 66 +74 66 66 +74 66 74 +74 74 74 +82 0 0 +82 8 8 +82 8 16 +82 16 16 +82 16 24 +82 24 24 +82 24 33 +82 33 33 +82 33 41 +82 41 41 +82 41 49 +82 49 49 +82 49 57 +82 57 57 +82 57 66 +82 66 66 +82 66 74 +82 74 74 +82 74 82 +82 82 82 +90 0 0 +90 8 8 +90 8 16 +99 0 0 +107 0 0 +115 0 0 +123 0 0 +132 0 0 +140 0 0 +148 0 0 +99 8 8 +107 8 8 +132 8 8 +140 8 8 +99 8 16 +107 8 16 +90 16 16 +99 16 16 +132 16 16 +140 16 16 +148 16 16 +90 16 24 +99 16 24 +132 16 24 +140 16 24 +148 16 24 +90 24 24 +99 24 24 +107 24 24 +90 24 33 +99 24 33 +107 24 33 +90 33 33 +99 33 33 +132 33 33 +90 33 41 +90 41 41 +107 41 41 +90 41 49 +90 49 49 +99 49 49 +90 57 57 +94 53 61 +132 33 41 +127 49 49 +140 33 33 +140 33 41 +140 41 41 +148 35 38 +140 49 49 +140 49 57 +99 57 66 +90 66 66 +140 66 66 +90 66 74 +132 66 74 +140 66 74 +90 74 74 +90 74 82 +90 82 82 +90 82 90 +140 82 90 +90 90 90 +140 90 90 +140 107 107 +140 115 115 +140 123 123 +156 0 0 +165 0 0 +173 0 0 +181 0 0 +156 16 16 +165 16 16 +173 16 16 +156 16 24 +165 16 24 +173 16 24 +156 24 24 +165 24 24 +173 24 24 +181 24 24 +156 33 33 +165 33 33 +156 41 41 +165 41 41 +173 41 41 +165 41 49 +173 41 49 +148 49 49 +156 49 49 +165 49 49 +173 49 49 +181 49 49 +189 49 49 +148 49 57 +156 49 57 +173 49 57 +181 49 57 +189 49 57 +148 57 57 +156 57 57 +165 57 57 +173 57 57 +156 57 66 +165 57 66 +148 66 66 +156 66 66 +165 66 66 +148 66 74 +156 66 74 +148 74 74 +148 82 86 +148 90 90 +156 82 86 +162 84 87 +173 57 66 +173 66 66 +173 66 74 +173 74 74 +173 82 82 +173 82 90 +181 66 66 +181 66 74 +181 74 74 +181 74 82 +181 90 90 +189 66 74 +189 74 74 +189 74 82 +189 90 90 +198 74 74 +148 99 103 +148 107 107 +154 105 107 +165 103 107 +173 99 103 +173 107 107 +185 90 99 +183 101 103 +152 123 123 +169 119 119 +148 136 136 +163 138 139 +181 117 120 +173 123 132 +181 123 132 +181 142 145 +193 99 103 +198 99 107 +189 115 119 +189 123 123 +198 115 123 +198 123 123 +198 123 132 +206 123 127 +189 140 140 +198 140 140 +189 140 148 +198 140 148 +206 140 148 +189 148 148 +198 148 148 +206 148 148 +156 156 156 +165 156 165 +173 165 165 +181 165 165 +181 165 173 +181 173 173 +181 181 181 +189 165 165 +189 165 173 +202 156 160 +214 148 156 +206 165 169 +189 173 173 +189 181 189 +206 173 173 +214 173 177 +189 189 189 +198 189 189 +206 189 189 +214 189 189 +198 189 198 +214 189 198 +214 198 198 +222 198 198 +222 198 206 +206 206 206 +214 206 214 +214 214 214 +222 214 222 +222 222 222 +231 222 231 +231 231 231 diff --git a/Files/Art/Dice/256color/dicedone.bmp b/Files/Art/Dice/256color/dicedone.bmp new file mode 100644 index 0000000..8c8c49c Binary files /dev/null and b/Files/Art/Dice/256color/dicedone.bmp differ diff --git a/Files/Art/Dice/256color/dicexrot.bmp b/Files/Art/Dice/256color/dicexrot.bmp new file mode 100644 index 0000000..c7c45d8 Binary files /dev/null and b/Files/Art/Dice/256color/dicexrot.bmp differ diff --git a/Files/Art/Dice/256color/diceyrot.bmp b/Files/Art/Dice/256color/diceyrot.bmp new file mode 100644 index 0000000..bfe6784 Binary files /dev/null and b/Files/Art/Dice/256color/diceyrot.bmp differ diff --git a/Files/Art/Dice/256color/diehalo.bmp b/Files/Art/Dice/256color/diehalo.bmp new file mode 100644 index 0000000..acea02e Binary files /dev/null and b/Files/Art/Dice/256color/diehalo.bmp differ diff --git a/Files/Art/Dice/DIE1.WAV b/Files/Art/Dice/DIE1.WAV new file mode 100644 index 0000000..b8a6286 Binary files /dev/null and b/Files/Art/Dice/DIE1.WAV differ diff --git a/Files/Art/Dice/DIE2.WAV b/Files/Art/Dice/DIE2.WAV new file mode 100644 index 0000000..4d74968 Binary files /dev/null and b/Files/Art/Dice/DIE2.WAV differ diff --git a/Files/Art/Dice/Pov/DiceAnim.INI b/Files/Art/Dice/Pov/DiceAnim.INI new file mode 100644 index 0000000..1895939 --- /dev/null +++ b/Files/Art/Dice/Pov/DiceAnim.INI @@ -0,0 +1,88 @@ +All_Console=On +All_File= +Bounding=On +Bounding_Threshold=3 +Buffer_Output=Off +Buffer_Size=0 +Clock=0 +Create_Ini=rerun.ini +Cyclic_Animation=Off +Debug_Console=On +Debug_File= +Display_Gamma=2.2 +Draw_Vistas=Off +Fatal_Console=On +Fatal_Error_Command= +Fatal_Error_Return= I +Fatal_File= +Field_Render=Off +Output_Alpha=On +Output_File_Name= +Output_to_File=On +Output_File_Type=N +Histogram_Name= +Histogram_Grid_Size=0.0 +Histogram_Type=NONE + +Initial_Clock=0 +Final_Clock=35 + +Initial_Frame=0 +Final_Frame=35 + + +Library_Path= +Light_Buffer=On +Odd_Field=Off +Palette=3 +Post_Frame_Command= +Post_Frame_Return= I +Post_Scene_Command= +Post_Scene_Return= I +Preview_End_Size=1 +Preview_Start_Size=1 +Pre_Frame_Command= +Pre_Frame_Return= I +Pre_Scene_command= +Pre_Scene_Return= I +Quality=9 +Remove_Bounds=On +Render_Console=On +Render_File= +Sampling_Method=1 +Split_Unions=Off +Statistic_Console=On +Statistic_File= +Subset_End_Frame=-1 +Subset_Start_Frame=-1 +Test_Abort_Count=100 +User_Abort_Command= +User_Abort_Return= I +Version=3.5 +Video_Mode=0 +Vista_Buffer=On +Warning_Console=On +Warning_File= +Bits_Per_Color=8 + + +Radiosity=Off +Width = 160 +Height = 160 +Antialias = On +Antialias_Threshold = 0.3 +Jitter=Off +Jitter_Amount = 0.0 +Antialias_Depth = 3 +Sampling_Method = 1 +Pause_When_Done = Off +Display = On +Verbose = Off +Continue_Trace = Off +Test_Abort = On +Input_File_Name = dice.pov +Output_File_Type = S +Preview_Start_Size=1 +Preview_End_Size=1 + +'rotate <0,-clock*10,-clock*10> \ No newline at end of file diff --git a/Files/Art/Dice/Pov/DiceShort.INI b/Files/Art/Dice/Pov/DiceShort.INI new file mode 100644 index 0000000..6c4fe81 --- /dev/null +++ b/Files/Art/Dice/Pov/DiceShort.INI @@ -0,0 +1,87 @@ +All_Console=On +All_File= +Bounding=On +Bounding_Threshold=3 +Buffer_Output=Off +Buffer_Size=0 +Clock=0 +Create_Ini=rerun.ini +Cyclic_Animation=Off +Debug_Console=On +Debug_File= +Display_Gamma=2.2 +Draw_Vistas=Off +Fatal_Console=On +Fatal_Error_Command= +Fatal_Error_Return= I +Fatal_File= +Field_Render=Off +Output_Alpha=On +Output_File_Name= +Output_to_File=On +Output_File_Type=N +Histogram_Name= +Histogram_Grid_Size=0.0 +Histogram_Type=NONE + +Initial_Clock=0 +Final_Clock=5 + +Initial_Frame=0 +Final_Frame=5 + +Library_Path= +Light_Buffer=On +Odd_Field=Off +Palette=3 +Post_Frame_Command= +Post_Frame_Return= I +Post_Scene_Command= +Post_Scene_Return= I +Preview_End_Size=1 +Preview_Start_Size=1 +Pre_Frame_Command= +Pre_Frame_Return= I +Pre_Scene_command= +Pre_Scene_Return= I +Quality=9 +Remove_Bounds=On +Render_Console=On +Render_File= +Sampling_Method=1 +Split_Unions=Off +Statistic_Console=On +Statistic_File= +Subset_End_Frame=-1 +Subset_Start_Frame=-1 +Test_Abort_Count=100 +User_Abort_Command= +User_Abort_Return= I +Version=3.5 +Video_Mode=0 +Vista_Buffer=On +Warning_Console=On +Warning_File= +Bits_Per_Color=8 + + +Radiosity=Off +Width = 160 +Height = 160 +Antialias = On +Antialias_Threshold = 0.3 +Jitter=Off +Jitter_Amount = 0.0 +Antialias_Depth = 3 +Sampling_Method = 1 +Pause_When_Done = Off +Display = On +Verbose = Off +Continue_Trace = Off +Test_Abort = On +Input_File_Name = dice.pov +Output_File_Type = S +Preview_Start_Size=1 +Preview_End_Size=1 + +'rotate <0,-clock*10,-clock*10> \ No newline at end of file diff --git a/Files/Art/Dice/Pov/dice.inc b/Files/Art/Dice/Pov/dice.inc new file mode 100644 index 0000000..15cbd6e --- /dev/null +++ b/Files/Art/Dice/Pov/dice.inc @@ -0,0 +1,60 @@ +// Material Include file. +// +// This file was generated for POV-Ray V3.1 by +// NOTE: Do *NOT* remove the comment lines containing '$MRY$'. +// To make Moray not re-export the material, change +// the '$MRY$' to '$MRX$'. +// + + +// +// ******** MATERIALS ******* +// + + + + + + + +// Materials from previous exports [MRY] + +// Materials exported in this run [MRY] + + + +// $MRY$: 'Reddish' + + +#declare Reddish = + material // Reddish + { + texture + { + pigment + { + color rgbf <0.75, 0.0, 0.0, 0.3> + } + } + } + + +// $MRY$: 'Pips' + + +#declare Pips = + material // Pips + { + texture + { + pigment + { + color rgb <1.0, 1.0, 1.0> + } + finish + { + ambient 0.258967 + brilliance 2.406 + } + } + } diff --git a/Files/Art/Dice/Pov/dice.pov b/Files/Art/Dice/Pov/dice.pov new file mode 100644 index 0000000..d140b95 --- /dev/null +++ b/Files/Art/Dice/Pov/dice.pov @@ -0,0 +1,312 @@ +// Persistence of Vision Raytracer V3.1 +// World definition file. +// +// Contains 1 lights, 2 materials and 23 primitives. +// +// This file was generated for POV-Ray V3.1 by +// Moray V3.3a For Windows Copyright (c) 1993-2001 Lutz + Kretzschmar +// + +// Date : 07/12/2002 (12.07.2002) +// + +/* + The text between these two comments is in MorayPOV.INC and is + automatically included in all POV files that Moray exports. +*/ + +default { + texture { + pigment { rgb <1,0,0> } + } +} + +/* // Scene Comment + +This scene was created with Moray For Windows. + +*/ // End Scene Comment + +global_settings { + adc_bailout 0.003922 + ambient_light <1.0,1.0,1.0> + assumed_gamma 1.9 + hf_gray_16 off + irid_wavelength <0.247059,0.176471,0.137255> + max_intersections 64 + max_trace_level 10 + number_of_waves 10 +} + +background { color <0.000,0.000,0.000> } + +camera { // Camera StdCam + location < -3.000, 3.000, 4.000> + sky < 0.00000, 0.00000, 1.00000> // Use right handed-system + up < 0.0, 0.0, 1.0> // Where Z is up + right < 1.00000, 0.0, 0.0> // Right Vector is adjusted to compensate for spherical (Moray) vs. planar (POV-Ray) aspect ratio + angle 39.60000 // Vertical 39.600 + look_at < 0.000, 0.000, 0.000> +} + +// +// ******* L I G H T S ******* +// + +light_source { // Light001 + <0.0, 0.0, 0.0> + color rgb <1.000, 1.000, 1.000> + translate <-18.754392, -0.401769, 61.307308> +} + + +// +// ******** MATERIALS ******* +// + +#include "dice.inc" + + +// +// ******** REFERENCED OBJECTS ******* +// + + + +// +// ******** OBJECTS ******* +// + + +#declare Body = + box { <-1, -1, -1>, <1, 1, 1> + + + texture { + pigment { color rgbf <0.75, 0.0004, 0.0, 0.4> } + finish { + //phong 0.2 + //phong_size 10 + ambient 0.2 + diffuse 0.8 + } + } +} + +#declare PIPX=0.475; +#declare PIPZ=0.801; + +#declare Twos = union { + cone { // Cone020 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, -270.0, -180.0> + translate <0.0, -PIPX, PIPX> + } + cone { // Cone021 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, 90.0, -180.0> + translate <0.0, PIPX, -PIPX> + } + translate PIPZ*x +} +#declare Fives = union { + cone { // Cone018 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, 90.0, 0.0> + translate <0.0, -PIPX, PIPX> + } + cone { // Cone019 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, 90.0, 0.0> + translate <0.0, PIPX, -PIPX> + } + cone { // Cone017 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, 90.0, 0.0> + translate <0.0, -PIPX, -PIPX> + } + cone { // Cone016 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, 90.0, 0.0> + translate <0.0, PIPX, PIPX> + } + cone { // Cone008 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate <-180.0, 90.0, 0.0> + } + translate -PIPZ*x +} +#declare Sixes = union { + cone { // Cone007 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 180.0*x + translate PIPX*x + } + cone { // Cone006 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 180.0*x + translate + } + cone { // Cone005 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 180.0*x + translate + } + cone { // Cone004 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 180.0*x + translate -PIPX*x + } + cone { // Cone002 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 180.0*x + translate <-PIPX, PIPX, 0.0> + } + cone { // Cone003 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 180.0*x + translate <-PIPX, -PIPX, 0.0> + } + translate -PIPZ*z +} +#declare Threes = union { + cone { // Cone011 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate -90.0*x + translate + } + cone { // Cone010 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate -90.0*x + } + cone { // Cone009 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate -90.0*x + translate <-PIPX, 0.0, PIPX> + } + translate PIPZ*y +} +#declare Fours = union { + cone { // Cone015 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 90.0*x + translate <-PIPX, 0.0, -PIPX> + } + cone { // Cone014 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 90.0*x + translate <-PIPX, 0.0, PIPX> + } + cone { // Cone013 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 90.0*x + translate + } + cone { // Cone012 + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + rotate 90.0*x + translate + } + translate -PIPZ*y +} +union { // Die + object { Twos } + object { Fives } + object { Sixes } + object { Threes } + object { Fours } + cone { // PipOne + <0,0,0>, 0.0, <0,0,1>, 1.0 + material { + Pips + } + scale 0.2 + translate PIPZ*z + } + + object {Body} + rotate <0,-clock*10-90,-clock*10> + +} + + diff --git a/Files/Art/Dice/dicedone.bmp b/Files/Art/Dice/dicedone.bmp new file mode 100644 index 0000000..1c0ed98 Binary files /dev/null and b/Files/Art/Dice/dicedone.bmp differ diff --git a/Files/Art/Dice/dicexrot.bmp b/Files/Art/Dice/dicexrot.bmp new file mode 100644 index 0000000..b142f31 Binary files /dev/null and b/Files/Art/Dice/dicexrot.bmp differ diff --git a/Files/Art/Dice/diceyrot.bmp b/Files/Art/Dice/diceyrot.bmp new file mode 100644 index 0000000..f4b16a7 Binary files /dev/null and b/Files/Art/Dice/diceyrot.bmp differ diff --git a/Files/Art/Dice/landing/dice1-0.bmp b/Files/Art/Dice/landing/dice1-0.bmp new file mode 100644 index 0000000..7be7502 Binary files /dev/null and b/Files/Art/Dice/landing/dice1-0.bmp differ diff --git a/Files/Art/Dice/landing/dice1-1.bmp b/Files/Art/Dice/landing/dice1-1.bmp new file mode 100644 index 0000000..41b9b2c Binary files /dev/null and b/Files/Art/Dice/landing/dice1-1.bmp differ diff --git a/Files/Art/Dice/landing/dice1-2.bmp b/Files/Art/Dice/landing/dice1-2.bmp new file mode 100644 index 0000000..557f539 Binary files /dev/null and b/Files/Art/Dice/landing/dice1-2.bmp differ diff --git a/Files/Art/Dice/landing/dice1-3.bmp b/Files/Art/Dice/landing/dice1-3.bmp new file mode 100644 index 0000000..d5b1a11 Binary files /dev/null and b/Files/Art/Dice/landing/dice1-3.bmp differ diff --git a/Files/Art/Dice/landing/dice1-4.bmp b/Files/Art/Dice/landing/dice1-4.bmp new file mode 100644 index 0000000..09cfaba Binary files /dev/null and b/Files/Art/Dice/landing/dice1-4.bmp differ diff --git a/Files/Art/Dice/landing/dice1-5.bmp b/Files/Art/Dice/landing/dice1-5.bmp new file mode 100644 index 0000000..b236956 Binary files /dev/null and b/Files/Art/Dice/landing/dice1-5.bmp differ diff --git a/Files/Art/Dice/landing/dice2-0.bmp b/Files/Art/Dice/landing/dice2-0.bmp new file mode 100644 index 0000000..7321b98 Binary files /dev/null and b/Files/Art/Dice/landing/dice2-0.bmp differ diff --git a/Files/Art/Dice/landing/dice2-1.bmp b/Files/Art/Dice/landing/dice2-1.bmp new file mode 100644 index 0000000..afde379 Binary files /dev/null and b/Files/Art/Dice/landing/dice2-1.bmp differ diff --git a/Files/Art/Dice/landing/dice2-2.bmp b/Files/Art/Dice/landing/dice2-2.bmp new file mode 100644 index 0000000..7d294a8 Binary files /dev/null and b/Files/Art/Dice/landing/dice2-2.bmp differ diff --git a/Files/Art/Dice/landing/dice2-3.bmp b/Files/Art/Dice/landing/dice2-3.bmp new file mode 100644 index 0000000..fd64994 Binary files /dev/null and b/Files/Art/Dice/landing/dice2-3.bmp differ diff --git a/Files/Art/Dice/landing/dice2-4.bmp b/Files/Art/Dice/landing/dice2-4.bmp new file mode 100644 index 0000000..e748900 Binary files /dev/null and b/Files/Art/Dice/landing/dice2-4.bmp differ diff --git a/Files/Art/Dice/landing/dice2-5.bmp b/Files/Art/Dice/landing/dice2-5.bmp new file mode 100644 index 0000000..8e3db85 Binary files /dev/null and b/Files/Art/Dice/landing/dice2-5.bmp differ diff --git a/Files/Art/Dice/landing/dice3-0.bmp b/Files/Art/Dice/landing/dice3-0.bmp new file mode 100644 index 0000000..2497e60 Binary files /dev/null and b/Files/Art/Dice/landing/dice3-0.bmp differ diff --git a/Files/Art/Dice/landing/dice3-1.bmp b/Files/Art/Dice/landing/dice3-1.bmp new file mode 100644 index 0000000..83dc39b Binary files /dev/null and b/Files/Art/Dice/landing/dice3-1.bmp differ diff --git a/Files/Art/Dice/landing/dice3-2.bmp b/Files/Art/Dice/landing/dice3-2.bmp new file mode 100644 index 0000000..7a86949 Binary files /dev/null and b/Files/Art/Dice/landing/dice3-2.bmp differ diff --git a/Files/Art/Dice/landing/dice3-3.bmp b/Files/Art/Dice/landing/dice3-3.bmp new file mode 100644 index 0000000..00eb3e7 Binary files /dev/null and b/Files/Art/Dice/landing/dice3-3.bmp differ diff --git a/Files/Art/Dice/landing/dice3-4.bmp b/Files/Art/Dice/landing/dice3-4.bmp new file mode 100644 index 0000000..e427a88 Binary files /dev/null and b/Files/Art/Dice/landing/dice3-4.bmp differ diff --git a/Files/Art/Dice/landing/dice3-5.bmp b/Files/Art/Dice/landing/dice3-5.bmp new file mode 100644 index 0000000..f28752b Binary files /dev/null and b/Files/Art/Dice/landing/dice3-5.bmp differ diff --git a/Files/Art/Dice/landing/dice4-0.bmp b/Files/Art/Dice/landing/dice4-0.bmp new file mode 100644 index 0000000..70ed2b9 Binary files /dev/null and b/Files/Art/Dice/landing/dice4-0.bmp differ diff --git a/Files/Art/Dice/landing/dice4-1.bmp b/Files/Art/Dice/landing/dice4-1.bmp new file mode 100644 index 0000000..ab26f38 Binary files /dev/null and b/Files/Art/Dice/landing/dice4-1.bmp differ diff --git a/Files/Art/Dice/landing/dice4-2.bmp b/Files/Art/Dice/landing/dice4-2.bmp new file mode 100644 index 0000000..66f3f92 Binary files /dev/null and b/Files/Art/Dice/landing/dice4-2.bmp differ diff --git a/Files/Art/Dice/landing/dice4-3.bmp b/Files/Art/Dice/landing/dice4-3.bmp new file mode 100644 index 0000000..9ecabed Binary files /dev/null and b/Files/Art/Dice/landing/dice4-3.bmp differ diff --git a/Files/Art/Dice/landing/dice4-4.bmp b/Files/Art/Dice/landing/dice4-4.bmp new file mode 100644 index 0000000..adb0efb Binary files /dev/null and b/Files/Art/Dice/landing/dice4-4.bmp differ diff --git a/Files/Art/Dice/landing/dice4-5.bmp b/Files/Art/Dice/landing/dice4-5.bmp new file mode 100644 index 0000000..013b09d Binary files /dev/null and b/Files/Art/Dice/landing/dice4-5.bmp differ diff --git a/Files/Art/Dice/landing/dice5-0.bmp b/Files/Art/Dice/landing/dice5-0.bmp new file mode 100644 index 0000000..f50e1f8 Binary files /dev/null and b/Files/Art/Dice/landing/dice5-0.bmp differ diff --git a/Files/Art/Dice/landing/dice5-1.bmp b/Files/Art/Dice/landing/dice5-1.bmp new file mode 100644 index 0000000..94d97fb Binary files /dev/null and b/Files/Art/Dice/landing/dice5-1.bmp differ diff --git a/Files/Art/Dice/landing/dice5-2.bmp b/Files/Art/Dice/landing/dice5-2.bmp new file mode 100644 index 0000000..196bc6b Binary files /dev/null and b/Files/Art/Dice/landing/dice5-2.bmp differ diff --git a/Files/Art/Dice/landing/dice5-3.bmp b/Files/Art/Dice/landing/dice5-3.bmp new file mode 100644 index 0000000..0ef788a Binary files /dev/null and b/Files/Art/Dice/landing/dice5-3.bmp differ diff --git a/Files/Art/Dice/landing/dice5-4.bmp b/Files/Art/Dice/landing/dice5-4.bmp new file mode 100644 index 0000000..c62bc2a Binary files /dev/null and b/Files/Art/Dice/landing/dice5-4.bmp differ diff --git a/Files/Art/Dice/landing/dice5-5.bmp b/Files/Art/Dice/landing/dice5-5.bmp new file mode 100644 index 0000000..9eac266 Binary files /dev/null and b/Files/Art/Dice/landing/dice5-5.bmp differ diff --git a/Files/Art/Dice/landing/dice6-0.bmp b/Files/Art/Dice/landing/dice6-0.bmp new file mode 100644 index 0000000..b4aca83 Binary files /dev/null and b/Files/Art/Dice/landing/dice6-0.bmp differ diff --git a/Files/Art/Dice/landing/dice6-1.bmp b/Files/Art/Dice/landing/dice6-1.bmp new file mode 100644 index 0000000..852f893 Binary files /dev/null and b/Files/Art/Dice/landing/dice6-1.bmp differ diff --git a/Files/Art/Dice/landing/dice6-2.bmp b/Files/Art/Dice/landing/dice6-2.bmp new file mode 100644 index 0000000..164c7ec Binary files /dev/null and b/Files/Art/Dice/landing/dice6-2.bmp differ diff --git a/Files/Art/Dice/landing/dice6-3.bmp b/Files/Art/Dice/landing/dice6-3.bmp new file mode 100644 index 0000000..49ef02f Binary files /dev/null and b/Files/Art/Dice/landing/dice6-3.bmp differ diff --git a/Files/Art/Dice/landing/dice6-4.bmp b/Files/Art/Dice/landing/dice6-4.bmp new file mode 100644 index 0000000..ef45912 Binary files /dev/null and b/Files/Art/Dice/landing/dice6-4.bmp differ diff --git a/Files/Art/Dice/landing/dice6-5.bmp b/Files/Art/Dice/landing/dice6-5.bmp new file mode 100644 index 0000000..5501585 Binary files /dev/null and b/Files/Art/Dice/landing/dice6-5.bmp differ diff --git a/Files/Art/Dice/rotating/dice00.bmp b/Files/Art/Dice/rotating/dice00.bmp new file mode 100644 index 0000000..7be7502 Binary files /dev/null and b/Files/Art/Dice/rotating/dice00.bmp differ diff --git a/Files/Art/Dice/rotating/dice01.bmp b/Files/Art/Dice/rotating/dice01.bmp new file mode 100644 index 0000000..41b9b2c Binary files /dev/null and b/Files/Art/Dice/rotating/dice01.bmp differ diff --git a/Files/Art/Dice/rotating/dice02.bmp b/Files/Art/Dice/rotating/dice02.bmp new file mode 100644 index 0000000..557f539 Binary files /dev/null and b/Files/Art/Dice/rotating/dice02.bmp differ diff --git a/Files/Art/Dice/rotating/dice03.bmp b/Files/Art/Dice/rotating/dice03.bmp new file mode 100644 index 0000000..d5b1a11 Binary files /dev/null and b/Files/Art/Dice/rotating/dice03.bmp differ diff --git a/Files/Art/Dice/rotating/dice04.bmp b/Files/Art/Dice/rotating/dice04.bmp new file mode 100644 index 0000000..09cfaba Binary files /dev/null and b/Files/Art/Dice/rotating/dice04.bmp differ diff --git a/Files/Art/Dice/rotating/dice05.bmp b/Files/Art/Dice/rotating/dice05.bmp new file mode 100644 index 0000000..b236956 Binary files /dev/null and b/Files/Art/Dice/rotating/dice05.bmp differ diff --git a/Files/Art/Dice/rotating/dice06.bmp b/Files/Art/Dice/rotating/dice06.bmp new file mode 100644 index 0000000..b1d7d8e Binary files /dev/null and b/Files/Art/Dice/rotating/dice06.bmp differ diff --git a/Files/Art/Dice/rotating/dice07.bmp b/Files/Art/Dice/rotating/dice07.bmp new file mode 100644 index 0000000..607143f Binary files /dev/null and b/Files/Art/Dice/rotating/dice07.bmp differ diff --git a/Files/Art/Dice/rotating/dice08.bmp b/Files/Art/Dice/rotating/dice08.bmp new file mode 100644 index 0000000..962d46f Binary files /dev/null and b/Files/Art/Dice/rotating/dice08.bmp differ diff --git a/Files/Art/Dice/rotating/dice09.bmp b/Files/Art/Dice/rotating/dice09.bmp new file mode 100644 index 0000000..c800e26 Binary files /dev/null and b/Files/Art/Dice/rotating/dice09.bmp differ diff --git a/Files/Art/Dice/rotating/dice10.bmp b/Files/Art/Dice/rotating/dice10.bmp new file mode 100644 index 0000000..3b0b936 Binary files /dev/null and b/Files/Art/Dice/rotating/dice10.bmp differ diff --git a/Files/Art/Dice/rotating/dice11.bmp b/Files/Art/Dice/rotating/dice11.bmp new file mode 100644 index 0000000..bb1205f Binary files /dev/null and b/Files/Art/Dice/rotating/dice11.bmp differ diff --git a/Files/Art/Dice/rotating/dice12.bmp b/Files/Art/Dice/rotating/dice12.bmp new file mode 100644 index 0000000..1b55c3e Binary files /dev/null and b/Files/Art/Dice/rotating/dice12.bmp differ diff --git a/Files/Art/Dice/rotating/dice13.bmp b/Files/Art/Dice/rotating/dice13.bmp new file mode 100644 index 0000000..5d11956 Binary files /dev/null and b/Files/Art/Dice/rotating/dice13.bmp differ diff --git a/Files/Art/Dice/rotating/dice14.bmp b/Files/Art/Dice/rotating/dice14.bmp new file mode 100644 index 0000000..dd4b44d Binary files /dev/null and b/Files/Art/Dice/rotating/dice14.bmp differ diff --git a/Files/Art/Dice/rotating/dice15.bmp b/Files/Art/Dice/rotating/dice15.bmp new file mode 100644 index 0000000..a60b885 Binary files /dev/null and b/Files/Art/Dice/rotating/dice15.bmp differ diff --git a/Files/Art/Dice/rotating/dice16.bmp b/Files/Art/Dice/rotating/dice16.bmp new file mode 100644 index 0000000..9095d11 Binary files /dev/null and b/Files/Art/Dice/rotating/dice16.bmp differ diff --git a/Files/Art/Dice/rotating/dice17.bmp b/Files/Art/Dice/rotating/dice17.bmp new file mode 100644 index 0000000..8c98792 Binary files /dev/null and b/Files/Art/Dice/rotating/dice17.bmp differ diff --git a/Files/Art/Dice/rotating/dice18.bmp b/Files/Art/Dice/rotating/dice18.bmp new file mode 100644 index 0000000..b539639 Binary files /dev/null and b/Files/Art/Dice/rotating/dice18.bmp differ diff --git a/Files/Art/Dice/rotating/dice19.bmp b/Files/Art/Dice/rotating/dice19.bmp new file mode 100644 index 0000000..358cc11 Binary files /dev/null and b/Files/Art/Dice/rotating/dice19.bmp differ diff --git a/Files/Art/Dice/rotating/dice20.bmp b/Files/Art/Dice/rotating/dice20.bmp new file mode 100644 index 0000000..65fd7c7 Binary files /dev/null and b/Files/Art/Dice/rotating/dice20.bmp differ diff --git a/Files/Art/Dice/rotating/dice21.bmp b/Files/Art/Dice/rotating/dice21.bmp new file mode 100644 index 0000000..10890c4 Binary files /dev/null and b/Files/Art/Dice/rotating/dice21.bmp differ diff --git a/Files/Art/Dice/rotating/dice22.bmp b/Files/Art/Dice/rotating/dice22.bmp new file mode 100644 index 0000000..195cb31 Binary files /dev/null and b/Files/Art/Dice/rotating/dice22.bmp differ diff --git a/Files/Art/Dice/rotating/dice23.bmp b/Files/Art/Dice/rotating/dice23.bmp new file mode 100644 index 0000000..188c7da Binary files /dev/null and b/Files/Art/Dice/rotating/dice23.bmp differ diff --git a/Files/Art/Dice/rotating/dice24.bmp b/Files/Art/Dice/rotating/dice24.bmp new file mode 100644 index 0000000..cebca6f Binary files /dev/null and b/Files/Art/Dice/rotating/dice24.bmp differ diff --git a/Files/Art/Dice/rotating/dice25.bmp b/Files/Art/Dice/rotating/dice25.bmp new file mode 100644 index 0000000..d4502eb Binary files /dev/null and b/Files/Art/Dice/rotating/dice25.bmp differ diff --git a/Files/Art/Dice/rotating/dice26.bmp b/Files/Art/Dice/rotating/dice26.bmp new file mode 100644 index 0000000..cdb2ad0 Binary files /dev/null and b/Files/Art/Dice/rotating/dice26.bmp differ diff --git a/Files/Art/Dice/rotating/dice27.bmp b/Files/Art/Dice/rotating/dice27.bmp new file mode 100644 index 0000000..0d95988 Binary files /dev/null and b/Files/Art/Dice/rotating/dice27.bmp differ diff --git a/Files/Art/Dice/rotating/dice28.bmp b/Files/Art/Dice/rotating/dice28.bmp new file mode 100644 index 0000000..bc7c351 Binary files /dev/null and b/Files/Art/Dice/rotating/dice28.bmp differ diff --git a/Files/Art/Dice/rotating/dice29.bmp b/Files/Art/Dice/rotating/dice29.bmp new file mode 100644 index 0000000..fa69cbe Binary files /dev/null and b/Files/Art/Dice/rotating/dice29.bmp differ diff --git a/Files/Art/Dice/rotating/dice30.bmp b/Files/Art/Dice/rotating/dice30.bmp new file mode 100644 index 0000000..b5738d4 Binary files /dev/null and b/Files/Art/Dice/rotating/dice30.bmp differ diff --git a/Files/Art/Dice/rotating/dice31.bmp b/Files/Art/Dice/rotating/dice31.bmp new file mode 100644 index 0000000..5ee30b3 Binary files /dev/null and b/Files/Art/Dice/rotating/dice31.bmp differ diff --git a/Files/Art/Dice/rotating/dice32.bmp b/Files/Art/Dice/rotating/dice32.bmp new file mode 100644 index 0000000..02dfb99 Binary files /dev/null and b/Files/Art/Dice/rotating/dice32.bmp differ diff --git a/Files/Art/Dice/rotating/dice33.bmp b/Files/Art/Dice/rotating/dice33.bmp new file mode 100644 index 0000000..b9c66f4 Binary files /dev/null and b/Files/Art/Dice/rotating/dice33.bmp differ diff --git a/Files/Art/Dice/rotating/dice34.bmp b/Files/Art/Dice/rotating/dice34.bmp new file mode 100644 index 0000000..1bf154d Binary files /dev/null and b/Files/Art/Dice/rotating/dice34.bmp differ diff --git a/Files/Art/Dice/rotating/dice35.bmp b/Files/Art/Dice/rotating/dice35.bmp new file mode 100644 index 0000000..9b22184 Binary files /dev/null and b/Files/Art/Dice/rotating/dice35.bmp differ diff --git a/Files/Art/Dice/xrotate/dice00.bmp b/Files/Art/Dice/xrotate/dice00.bmp new file mode 100644 index 0000000..7be7502 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice00.bmp differ diff --git a/Files/Art/Dice/xrotate/dice01.bmp b/Files/Art/Dice/xrotate/dice01.bmp new file mode 100644 index 0000000..69289f2 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice01.bmp differ diff --git a/Files/Art/Dice/xrotate/dice02.bmp b/Files/Art/Dice/xrotate/dice02.bmp new file mode 100644 index 0000000..1fdef65 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice02.bmp differ diff --git a/Files/Art/Dice/xrotate/dice03.bmp b/Files/Art/Dice/xrotate/dice03.bmp new file mode 100644 index 0000000..d865d08 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice03.bmp differ diff --git a/Files/Art/Dice/xrotate/dice04.bmp b/Files/Art/Dice/xrotate/dice04.bmp new file mode 100644 index 0000000..b4dc75f Binary files /dev/null and b/Files/Art/Dice/xrotate/dice04.bmp differ diff --git a/Files/Art/Dice/xrotate/dice05.bmp b/Files/Art/Dice/xrotate/dice05.bmp new file mode 100644 index 0000000..e966e05 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice05.bmp differ diff --git a/Files/Art/Dice/xrotate/dice06.bmp b/Files/Art/Dice/xrotate/dice06.bmp new file mode 100644 index 0000000..6f3db0f Binary files /dev/null and b/Files/Art/Dice/xrotate/dice06.bmp differ diff --git a/Files/Art/Dice/xrotate/dice07.bmp b/Files/Art/Dice/xrotate/dice07.bmp new file mode 100644 index 0000000..e1d449e Binary files /dev/null and b/Files/Art/Dice/xrotate/dice07.bmp differ diff --git a/Files/Art/Dice/xrotate/dice08.bmp b/Files/Art/Dice/xrotate/dice08.bmp new file mode 100644 index 0000000..eef7888 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice08.bmp differ diff --git a/Files/Art/Dice/xrotate/dice09.bmp b/Files/Art/Dice/xrotate/dice09.bmp new file mode 100644 index 0000000..70ed2b9 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice09.bmp differ diff --git a/Files/Art/Dice/xrotate/dice10.bmp b/Files/Art/Dice/xrotate/dice10.bmp new file mode 100644 index 0000000..63eaab2 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice10.bmp differ diff --git a/Files/Art/Dice/xrotate/dice11.bmp b/Files/Art/Dice/xrotate/dice11.bmp new file mode 100644 index 0000000..a1ebf2c Binary files /dev/null and b/Files/Art/Dice/xrotate/dice11.bmp differ diff --git a/Files/Art/Dice/xrotate/dice12.bmp b/Files/Art/Dice/xrotate/dice12.bmp new file mode 100644 index 0000000..12c5bb1 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice12.bmp differ diff --git a/Files/Art/Dice/xrotate/dice13.bmp b/Files/Art/Dice/xrotate/dice13.bmp new file mode 100644 index 0000000..d0b3166 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice13.bmp differ diff --git a/Files/Art/Dice/xrotate/dice14.bmp b/Files/Art/Dice/xrotate/dice14.bmp new file mode 100644 index 0000000..c94d93e Binary files /dev/null and b/Files/Art/Dice/xrotate/dice14.bmp differ diff --git a/Files/Art/Dice/xrotate/dice15.bmp b/Files/Art/Dice/xrotate/dice15.bmp new file mode 100644 index 0000000..09fcd0b Binary files /dev/null and b/Files/Art/Dice/xrotate/dice15.bmp differ diff --git a/Files/Art/Dice/xrotate/dice16.bmp b/Files/Art/Dice/xrotate/dice16.bmp new file mode 100644 index 0000000..1388930 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice16.bmp differ diff --git a/Files/Art/Dice/xrotate/dice17.bmp b/Files/Art/Dice/xrotate/dice17.bmp new file mode 100644 index 0000000..7c849a2 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice17.bmp differ diff --git a/Files/Art/Dice/xrotate/dice18.bmp b/Files/Art/Dice/xrotate/dice18.bmp new file mode 100644 index 0000000..b539639 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice18.bmp differ diff --git a/Files/Art/Dice/xrotate/dice19.bmp b/Files/Art/Dice/xrotate/dice19.bmp new file mode 100644 index 0000000..4cee84b Binary files /dev/null and b/Files/Art/Dice/xrotate/dice19.bmp differ diff --git a/Files/Art/Dice/xrotate/dice20.bmp b/Files/Art/Dice/xrotate/dice20.bmp new file mode 100644 index 0000000..2e7b2e7 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice20.bmp differ diff --git a/Files/Art/Dice/xrotate/dice21.bmp b/Files/Art/Dice/xrotate/dice21.bmp new file mode 100644 index 0000000..cac9310 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice21.bmp differ diff --git a/Files/Art/Dice/xrotate/dice22.bmp b/Files/Art/Dice/xrotate/dice22.bmp new file mode 100644 index 0000000..69893a1 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice22.bmp differ diff --git a/Files/Art/Dice/xrotate/dice23.bmp b/Files/Art/Dice/xrotate/dice23.bmp new file mode 100644 index 0000000..1508802 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice23.bmp differ diff --git a/Files/Art/Dice/xrotate/dice24.bmp b/Files/Art/Dice/xrotate/dice24.bmp new file mode 100644 index 0000000..d30ba19 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice24.bmp differ diff --git a/Files/Art/Dice/xrotate/dice25.bmp b/Files/Art/Dice/xrotate/dice25.bmp new file mode 100644 index 0000000..147d843 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice25.bmp differ diff --git a/Files/Art/Dice/xrotate/dice26.bmp b/Files/Art/Dice/xrotate/dice26.bmp new file mode 100644 index 0000000..36d9833 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice26.bmp differ diff --git a/Files/Art/Dice/xrotate/dice27.bmp b/Files/Art/Dice/xrotate/dice27.bmp new file mode 100644 index 0000000..2497e60 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice27.bmp differ diff --git a/Files/Art/Dice/xrotate/dice28.bmp b/Files/Art/Dice/xrotate/dice28.bmp new file mode 100644 index 0000000..c276d5d Binary files /dev/null and b/Files/Art/Dice/xrotate/dice28.bmp differ diff --git a/Files/Art/Dice/xrotate/dice29.bmp b/Files/Art/Dice/xrotate/dice29.bmp new file mode 100644 index 0000000..0bfd19e Binary files /dev/null and b/Files/Art/Dice/xrotate/dice29.bmp differ diff --git a/Files/Art/Dice/xrotate/dice30.bmp b/Files/Art/Dice/xrotate/dice30.bmp new file mode 100644 index 0000000..d4f37a7 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice30.bmp differ diff --git a/Files/Art/Dice/xrotate/dice31.bmp b/Files/Art/Dice/xrotate/dice31.bmp new file mode 100644 index 0000000..ea4cf0e Binary files /dev/null and b/Files/Art/Dice/xrotate/dice31.bmp differ diff --git a/Files/Art/Dice/xrotate/dice32.bmp b/Files/Art/Dice/xrotate/dice32.bmp new file mode 100644 index 0000000..6c59647 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice32.bmp differ diff --git a/Files/Art/Dice/xrotate/dice33.bmp b/Files/Art/Dice/xrotate/dice33.bmp new file mode 100644 index 0000000..14b32d5 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice33.bmp differ diff --git a/Files/Art/Dice/xrotate/dice34.bmp b/Files/Art/Dice/xrotate/dice34.bmp new file mode 100644 index 0000000..8007584 Binary files /dev/null and b/Files/Art/Dice/xrotate/dice34.bmp differ diff --git a/Files/Art/Dice/xrotate/dice35.bmp b/Files/Art/Dice/xrotate/dice35.bmp new file mode 100644 index 0000000..20b0fba Binary files /dev/null and b/Files/Art/Dice/xrotate/dice35.bmp differ diff --git a/Files/Art/Dice/yrotate/dice00.bmp b/Files/Art/Dice/yrotate/dice00.bmp new file mode 100644 index 0000000..7be7502 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice00.bmp differ diff --git a/Files/Art/Dice/yrotate/dice01.bmp b/Files/Art/Dice/yrotate/dice01.bmp new file mode 100644 index 0000000..ccfef61 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice01.bmp differ diff --git a/Files/Art/Dice/yrotate/dice02.bmp b/Files/Art/Dice/yrotate/dice02.bmp new file mode 100644 index 0000000..68343dc Binary files /dev/null and b/Files/Art/Dice/yrotate/dice02.bmp differ diff --git a/Files/Art/Dice/yrotate/dice03.bmp b/Files/Art/Dice/yrotate/dice03.bmp new file mode 100644 index 0000000..bcf0825 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice03.bmp differ diff --git a/Files/Art/Dice/yrotate/dice04.bmp b/Files/Art/Dice/yrotate/dice04.bmp new file mode 100644 index 0000000..c5e2e6b Binary files /dev/null and b/Files/Art/Dice/yrotate/dice04.bmp differ diff --git a/Files/Art/Dice/yrotate/dice05.bmp b/Files/Art/Dice/yrotate/dice05.bmp new file mode 100644 index 0000000..53b19d2 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice05.bmp differ diff --git a/Files/Art/Dice/yrotate/dice06.bmp b/Files/Art/Dice/yrotate/dice06.bmp new file mode 100644 index 0000000..6a752c6 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice06.bmp differ diff --git a/Files/Art/Dice/yrotate/dice07.bmp b/Files/Art/Dice/yrotate/dice07.bmp new file mode 100644 index 0000000..2bba376 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice07.bmp differ diff --git a/Files/Art/Dice/yrotate/dice08.bmp b/Files/Art/Dice/yrotate/dice08.bmp new file mode 100644 index 0000000..6fbfd03 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice08.bmp differ diff --git a/Files/Art/Dice/yrotate/dice09.bmp b/Files/Art/Dice/yrotate/dice09.bmp new file mode 100644 index 0000000..7321b98 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice09.bmp differ diff --git a/Files/Art/Dice/yrotate/dice10.bmp b/Files/Art/Dice/yrotate/dice10.bmp new file mode 100644 index 0000000..8ec8ea0 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice10.bmp differ diff --git a/Files/Art/Dice/yrotate/dice11.bmp b/Files/Art/Dice/yrotate/dice11.bmp new file mode 100644 index 0000000..779e76f Binary files /dev/null and b/Files/Art/Dice/yrotate/dice11.bmp differ diff --git a/Files/Art/Dice/yrotate/dice12.bmp b/Files/Art/Dice/yrotate/dice12.bmp new file mode 100644 index 0000000..a0191a1 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice12.bmp differ diff --git a/Files/Art/Dice/yrotate/dice13.bmp b/Files/Art/Dice/yrotate/dice13.bmp new file mode 100644 index 0000000..3d564f5 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice13.bmp differ diff --git a/Files/Art/Dice/yrotate/dice14.bmp b/Files/Art/Dice/yrotate/dice14.bmp new file mode 100644 index 0000000..126fb77 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice14.bmp differ diff --git a/Files/Art/Dice/yrotate/dice15.bmp b/Files/Art/Dice/yrotate/dice15.bmp new file mode 100644 index 0000000..d962a53 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice15.bmp differ diff --git a/Files/Art/Dice/yrotate/dice16.bmp b/Files/Art/Dice/yrotate/dice16.bmp new file mode 100644 index 0000000..4da8fb1 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice16.bmp differ diff --git a/Files/Art/Dice/yrotate/dice17.bmp b/Files/Art/Dice/yrotate/dice17.bmp new file mode 100644 index 0000000..08d96eb Binary files /dev/null and b/Files/Art/Dice/yrotate/dice17.bmp differ diff --git a/Files/Art/Dice/yrotate/dice18.bmp b/Files/Art/Dice/yrotate/dice18.bmp new file mode 100644 index 0000000..b4aca83 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice18.bmp differ diff --git a/Files/Art/Dice/yrotate/dice19.bmp b/Files/Art/Dice/yrotate/dice19.bmp new file mode 100644 index 0000000..29abff2 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice19.bmp differ diff --git a/Files/Art/Dice/yrotate/dice20.bmp b/Files/Art/Dice/yrotate/dice20.bmp new file mode 100644 index 0000000..81992e5 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice20.bmp differ diff --git a/Files/Art/Dice/yrotate/dice21.bmp b/Files/Art/Dice/yrotate/dice21.bmp new file mode 100644 index 0000000..10b2476 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice21.bmp differ diff --git a/Files/Art/Dice/yrotate/dice22.bmp b/Files/Art/Dice/yrotate/dice22.bmp new file mode 100644 index 0000000..1de8d69 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice22.bmp differ diff --git a/Files/Art/Dice/yrotate/dice23.bmp b/Files/Art/Dice/yrotate/dice23.bmp new file mode 100644 index 0000000..ec5a60f Binary files /dev/null and b/Files/Art/Dice/yrotate/dice23.bmp differ diff --git a/Files/Art/Dice/yrotate/dice24.bmp b/Files/Art/Dice/yrotate/dice24.bmp new file mode 100644 index 0000000..fd8f3c4 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice24.bmp differ diff --git a/Files/Art/Dice/yrotate/dice25.bmp b/Files/Art/Dice/yrotate/dice25.bmp new file mode 100644 index 0000000..9b3725e Binary files /dev/null and b/Files/Art/Dice/yrotate/dice25.bmp differ diff --git a/Files/Art/Dice/yrotate/dice26.bmp b/Files/Art/Dice/yrotate/dice26.bmp new file mode 100644 index 0000000..85aef0f Binary files /dev/null and b/Files/Art/Dice/yrotate/dice26.bmp differ diff --git a/Files/Art/Dice/yrotate/dice27.bmp b/Files/Art/Dice/yrotate/dice27.bmp new file mode 100644 index 0000000..f50e1f8 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice27.bmp differ diff --git a/Files/Art/Dice/yrotate/dice28.bmp b/Files/Art/Dice/yrotate/dice28.bmp new file mode 100644 index 0000000..4d5262e Binary files /dev/null and b/Files/Art/Dice/yrotate/dice28.bmp differ diff --git a/Files/Art/Dice/yrotate/dice29.bmp b/Files/Art/Dice/yrotate/dice29.bmp new file mode 100644 index 0000000..7bc7b62 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice29.bmp differ diff --git a/Files/Art/Dice/yrotate/dice30.bmp b/Files/Art/Dice/yrotate/dice30.bmp new file mode 100644 index 0000000..85cb831 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice30.bmp differ diff --git a/Files/Art/Dice/yrotate/dice31.bmp b/Files/Art/Dice/yrotate/dice31.bmp new file mode 100644 index 0000000..0916a55 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice31.bmp differ diff --git a/Files/Art/Dice/yrotate/dice32.bmp b/Files/Art/Dice/yrotate/dice32.bmp new file mode 100644 index 0000000..f4b34c9 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice32.bmp differ diff --git a/Files/Art/Dice/yrotate/dice33.bmp b/Files/Art/Dice/yrotate/dice33.bmp new file mode 100644 index 0000000..f45ac7d Binary files /dev/null and b/Files/Art/Dice/yrotate/dice33.bmp differ diff --git a/Files/Art/Dice/yrotate/dice34.bmp b/Files/Art/Dice/yrotate/dice34.bmp new file mode 100644 index 0000000..1e630b1 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice34.bmp differ diff --git a/Files/Art/Dice/yrotate/dice35.bmp b/Files/Art/Dice/yrotate/dice35.bmp new file mode 100644 index 0000000..ee75566 Binary files /dev/null and b/Files/Art/Dice/yrotate/dice35.bmp differ diff --git a/Files/Art/SpaceRocks/Boom/Boom.bmp b/Files/Art/SpaceRocks/Boom/Boom.bmp new file mode 100644 index 0000000..4a86021 Binary files /dev/null and b/Files/Art/SpaceRocks/Boom/Boom.bmp differ diff --git a/Files/Art/SpaceRocks/Boom/Boom.psd b/Files/Art/SpaceRocks/Boom/Boom.psd new file mode 100644 index 0000000..3c91d23 Binary files /dev/null and b/Files/Art/SpaceRocks/Boom/Boom.psd differ diff --git a/Files/Art/SpaceRocks/Bullet/Bullet.bmp b/Files/Art/SpaceRocks/Bullet/Bullet.bmp new file mode 100644 index 0000000..70524ef Binary files /dev/null and b/Files/Art/SpaceRocks/Bullet/Bullet.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig00.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig00.bmp new file mode 100644 index 0000000..72a8921 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig00.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig01.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig01.bmp new file mode 100644 index 0000000..f95e2d2 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig01.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig02.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig02.bmp new file mode 100644 index 0000000..e86875e Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig02.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig03.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig03.bmp new file mode 100644 index 0000000..19d9349 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig03.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig04.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig04.bmp new file mode 100644 index 0000000..1b7d65a Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig04.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig05.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig05.bmp new file mode 100644 index 0000000..43f6c34 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig05.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig06.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig06.bmp new file mode 100644 index 0000000..22b865d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig06.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig07.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig07.bmp new file mode 100644 index 0000000..331d5b2 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig07.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig08.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig08.bmp new file mode 100644 index 0000000..d52584b Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig08.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig09.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig09.bmp new file mode 100644 index 0000000..df3da63 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig09.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig10.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig10.bmp new file mode 100644 index 0000000..df86303 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig10.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig11.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig11.bmp new file mode 100644 index 0000000..a062a13 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig11.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig12.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig12.bmp new file mode 100644 index 0000000..e56021f Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig12.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig13.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig13.bmp new file mode 100644 index 0000000..47e40be Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig13.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig14.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig14.bmp new file mode 100644 index 0000000..f015c37 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig14.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig15.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig15.bmp new file mode 100644 index 0000000..0cb3a63 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig15.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig16.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig16.bmp new file mode 100644 index 0000000..6aa7c1d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig16.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig17.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig17.bmp new file mode 100644 index 0000000..b3b8f84 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig17.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig18.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig18.bmp new file mode 100644 index 0000000..266fe62 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig18.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig19.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig19.bmp new file mode 100644 index 0000000..200159a Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig19.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig20.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig20.bmp new file mode 100644 index 0000000..dfd4782 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig20.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig21.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig21.bmp new file mode 100644 index 0000000..8a58daa Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig21.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig22.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig22.bmp new file mode 100644 index 0000000..d920b0b Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig22.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig23.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig23.bmp new file mode 100644 index 0000000..7bbabab Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig23.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig24.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig24.bmp new file mode 100644 index 0000000..5b06bd9 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig24.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig25.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig25.bmp new file mode 100644 index 0000000..19d16a3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig25.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig26.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig26.bmp new file mode 100644 index 0000000..16f24c6 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig26.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig27.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig27.bmp new file mode 100644 index 0000000..4af2d9e Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig27.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig28.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig28.bmp new file mode 100644 index 0000000..91fcbad Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig28.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig29.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig29.bmp new file mode 100644 index 0000000..0c21a0e Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig29.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig30.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig30.bmp new file mode 100644 index 0000000..bd34e40 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig30.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig31.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig31.bmp new file mode 100644 index 0000000..ef369b1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig31.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig32.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig32.bmp new file mode 100644 index 0000000..bded290 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig32.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig33.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig33.bmp new file mode 100644 index 0000000..a5e82ed Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig33.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig34.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig34.bmp new file mode 100644 index 0000000..606734d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig34.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Big/RockABig35.bmp b/Files/Art/SpaceRocks/RockA/Big/RockABig35.bmp new file mode 100644 index 0000000..39d7678 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Big/RockABig35.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed00.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed00.bmp new file mode 100644 index 0000000..ddb89d9 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed00.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed01.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed01.bmp new file mode 100644 index 0000000..9a5d874 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed01.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed02.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed02.bmp new file mode 100644 index 0000000..d6a84c0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed02.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed03.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed03.bmp new file mode 100644 index 0000000..96e000f Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed03.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed04.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed04.bmp new file mode 100644 index 0000000..a2568ff Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed04.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed05.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed05.bmp new file mode 100644 index 0000000..bab8a07 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed05.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed06.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed06.bmp new file mode 100644 index 0000000..1e072f6 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed06.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed07.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed07.bmp new file mode 100644 index 0000000..2d5489d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed07.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed08.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed08.bmp new file mode 100644 index 0000000..af6e93d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed08.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed09.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed09.bmp new file mode 100644 index 0000000..2503773 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed09.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed10.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed10.bmp new file mode 100644 index 0000000..2fb7b01 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed10.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed11.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed11.bmp new file mode 100644 index 0000000..4981065 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed11.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed12.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed12.bmp new file mode 100644 index 0000000..b86f45d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed12.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed13.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed13.bmp new file mode 100644 index 0000000..60351a8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed13.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed14.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed14.bmp new file mode 100644 index 0000000..1ba0a72 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed14.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed15.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed15.bmp new file mode 100644 index 0000000..7caa259 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed15.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed16.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed16.bmp new file mode 100644 index 0000000..326815d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed16.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed17.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed17.bmp new file mode 100644 index 0000000..ba26f4c Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed17.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed18.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed18.bmp new file mode 100644 index 0000000..42c9ac3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed18.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed19.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed19.bmp new file mode 100644 index 0000000..947d734 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed19.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed20.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed20.bmp new file mode 100644 index 0000000..fb31cc4 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed20.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed21.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed21.bmp new file mode 100644 index 0000000..41c816b Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed21.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed22.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed22.bmp new file mode 100644 index 0000000..f2b576e Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed22.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed23.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed23.bmp new file mode 100644 index 0000000..c7eb4b1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed23.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed24.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed24.bmp new file mode 100644 index 0000000..4bd6402 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed24.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed25.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed25.bmp new file mode 100644 index 0000000..1f2438d Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed25.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed26.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed26.bmp new file mode 100644 index 0000000..a0fa617 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed26.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed27.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed27.bmp new file mode 100644 index 0000000..59342fa Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed27.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed28.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed28.bmp new file mode 100644 index 0000000..2e4627f Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed28.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed29.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed29.bmp new file mode 100644 index 0000000..cefa357 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed29.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed30.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed30.bmp new file mode 100644 index 0000000..a416a51 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed30.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed31.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed31.bmp new file mode 100644 index 0000000..9c14472 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed31.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed32.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed32.bmp new file mode 100644 index 0000000..ec98f05 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed32.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed33.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed33.bmp new file mode 100644 index 0000000..56dc90a Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed33.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed34.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed34.bmp new file mode 100644 index 0000000..89e536a Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed34.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Medium/RockAMed35.bmp b/Files/Art/SpaceRocks/RockA/Medium/RockAMed35.bmp new file mode 100644 index 0000000..d4cd511 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Medium/RockAMed35.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/RockABig.bmp b/Files/Art/SpaceRocks/RockA/RockABig.bmp new file mode 100644 index 0000000..4acb57f Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/RockABig.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/RockAMed.bmp b/Files/Art/SpaceRocks/RockA/RockAMed.bmp new file mode 100644 index 0000000..cbe8bb3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/RockAMed.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/RockASmall.bmp b/Files/Art/SpaceRocks/RockA/RockASmall.bmp new file mode 100644 index 0000000..6ae3137 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/RockASmall.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall00.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall00.bmp new file mode 100644 index 0000000..7145db9 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall00.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall01.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall01.bmp new file mode 100644 index 0000000..80fc2af Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall01.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall02.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall02.bmp new file mode 100644 index 0000000..ca6ca51 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall02.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall03.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall03.bmp new file mode 100644 index 0000000..d44f232 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall03.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall04.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall04.bmp new file mode 100644 index 0000000..5a074da Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall04.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall05.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall05.bmp new file mode 100644 index 0000000..6356a1f Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall05.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall06.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall06.bmp new file mode 100644 index 0000000..79e10b0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall06.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall07.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall07.bmp new file mode 100644 index 0000000..e332404 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall07.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall08.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall08.bmp new file mode 100644 index 0000000..21f9754 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall08.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall09.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall09.bmp new file mode 100644 index 0000000..7617af1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall09.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall10.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall10.bmp new file mode 100644 index 0000000..d17e760 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall10.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall11.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall11.bmp new file mode 100644 index 0000000..dd6f319 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall11.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall12.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall12.bmp new file mode 100644 index 0000000..7388288 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall12.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall13.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall13.bmp new file mode 100644 index 0000000..32f06e8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall13.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall14.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall14.bmp new file mode 100644 index 0000000..e930e30 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall14.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall15.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall15.bmp new file mode 100644 index 0000000..274e9cf Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall15.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall16.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall16.bmp new file mode 100644 index 0000000..ff49861 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall16.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall17.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall17.bmp new file mode 100644 index 0000000..419366c Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall17.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall18.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall18.bmp new file mode 100644 index 0000000..092a346 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall18.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall19.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall19.bmp new file mode 100644 index 0000000..0f368bb Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall19.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall20.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall20.bmp new file mode 100644 index 0000000..fdd062e Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall20.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall21.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall21.bmp new file mode 100644 index 0000000..d791bcd Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall21.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall22.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall22.bmp new file mode 100644 index 0000000..34ce231 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall22.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall23.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall23.bmp new file mode 100644 index 0000000..b09b1bb Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall23.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall24.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall24.bmp new file mode 100644 index 0000000..5bf760e Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall24.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall25.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall25.bmp new file mode 100644 index 0000000..4932542 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall25.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall26.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall26.bmp new file mode 100644 index 0000000..e1df6e3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall26.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall27.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall27.bmp new file mode 100644 index 0000000..7413fab Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall27.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall28.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall28.bmp new file mode 100644 index 0000000..5ed94bd Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall28.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall29.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall29.bmp new file mode 100644 index 0000000..23c812b Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall29.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall30.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall30.bmp new file mode 100644 index 0000000..9b0ede5 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall30.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall31.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall31.bmp new file mode 100644 index 0000000..2c44397 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall31.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall32.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall32.bmp new file mode 100644 index 0000000..a30d207 Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall32.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall33.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall33.bmp new file mode 100644 index 0000000..a7cf6fb Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall33.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall34.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall34.bmp new file mode 100644 index 0000000..943406f Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall34.bmp differ diff --git a/Files/Art/SpaceRocks/RockA/Small/RockASmall35.bmp b/Files/Art/SpaceRocks/RockA/Small/RockASmall35.bmp new file mode 100644 index 0000000..e7ba61b Binary files /dev/null and b/Files/Art/SpaceRocks/RockA/Small/RockASmall35.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig00.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig00.bmp new file mode 100644 index 0000000..fe2ca54 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig00.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig01.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig01.bmp new file mode 100644 index 0000000..1b447c3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig01.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig02.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig02.bmp new file mode 100644 index 0000000..f8cea66 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig02.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig03.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig03.bmp new file mode 100644 index 0000000..539a69d Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig03.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig04.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig04.bmp new file mode 100644 index 0000000..0b66ab2 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig04.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig05.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig05.bmp new file mode 100644 index 0000000..400e9b1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig05.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig06.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig06.bmp new file mode 100644 index 0000000..220c9ea Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig06.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig07.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig07.bmp new file mode 100644 index 0000000..d0c280f Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig07.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig08.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig08.bmp new file mode 100644 index 0000000..c3c6d89 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig08.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig09.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig09.bmp new file mode 100644 index 0000000..221cefb Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig09.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig10.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig10.bmp new file mode 100644 index 0000000..b211982 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig10.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig11.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig11.bmp new file mode 100644 index 0000000..ebc8acf Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig11.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig12.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig12.bmp new file mode 100644 index 0000000..9f34da4 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig12.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig13.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig13.bmp new file mode 100644 index 0000000..045d3e3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig13.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig14.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig14.bmp new file mode 100644 index 0000000..299fbae Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig14.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig15.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig15.bmp new file mode 100644 index 0000000..27cb16f Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig15.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig16.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig16.bmp new file mode 100644 index 0000000..bbe5ffe Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig16.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig17.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig17.bmp new file mode 100644 index 0000000..8149145 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig17.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig18.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig18.bmp new file mode 100644 index 0000000..20c13d3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig18.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig19.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig19.bmp new file mode 100644 index 0000000..4c377c0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig19.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig20.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig20.bmp new file mode 100644 index 0000000..89de471 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig20.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig21.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig21.bmp new file mode 100644 index 0000000..4ee71a0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig21.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig22.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig22.bmp new file mode 100644 index 0000000..33f9837 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig22.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig23.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig23.bmp new file mode 100644 index 0000000..98a9a15 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig23.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig24.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig24.bmp new file mode 100644 index 0000000..ee1e1f5 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig24.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig25.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig25.bmp new file mode 100644 index 0000000..351d1f8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig25.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig26.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig26.bmp new file mode 100644 index 0000000..41d7228 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig26.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig27.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig27.bmp new file mode 100644 index 0000000..c8b6974 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig27.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig28.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig28.bmp new file mode 100644 index 0000000..edab2b7 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig28.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig29.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig29.bmp new file mode 100644 index 0000000..6c83d46 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig29.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig30.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig30.bmp new file mode 100644 index 0000000..47becee Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig30.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig31.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig31.bmp new file mode 100644 index 0000000..37dea4f Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig31.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig32.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig32.bmp new file mode 100644 index 0000000..49970e7 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig32.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig33.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig33.bmp new file mode 100644 index 0000000..46344f6 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig33.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig34.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig34.bmp new file mode 100644 index 0000000..3d8eb03 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig34.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Big/RockBBig35.bmp b/Files/Art/SpaceRocks/RockB/Big/RockBBig35.bmp new file mode 100644 index 0000000..364eb25 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Big/RockBBig35.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed00.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed00.bmp new file mode 100644 index 0000000..654242a Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed00.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed01.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed01.bmp new file mode 100644 index 0000000..48fcc7b Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed01.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed02.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed02.bmp new file mode 100644 index 0000000..423dca2 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed02.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed03.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed03.bmp new file mode 100644 index 0000000..301f296 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed03.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed04.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed04.bmp new file mode 100644 index 0000000..2826c07 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed04.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed05.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed05.bmp new file mode 100644 index 0000000..c359a81 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed05.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed06.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed06.bmp new file mode 100644 index 0000000..38d2585 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed06.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed07.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed07.bmp new file mode 100644 index 0000000..df80d9e Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed07.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed08.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed08.bmp new file mode 100644 index 0000000..ee493a6 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed08.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed09.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed09.bmp new file mode 100644 index 0000000..e1b06a1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed09.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed10.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed10.bmp new file mode 100644 index 0000000..a6131cf Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed10.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed11.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed11.bmp new file mode 100644 index 0000000..ee02318 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed11.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed12.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed12.bmp new file mode 100644 index 0000000..07b48d9 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed12.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed13.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed13.bmp new file mode 100644 index 0000000..145f430 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed13.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed14.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed14.bmp new file mode 100644 index 0000000..167a4ec Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed14.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed15.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed15.bmp new file mode 100644 index 0000000..729c48a Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed15.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed16.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed16.bmp new file mode 100644 index 0000000..5668c62 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed16.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed17.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed17.bmp new file mode 100644 index 0000000..cfe01c5 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed17.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed18.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed18.bmp new file mode 100644 index 0000000..bc72362 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed18.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed19.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed19.bmp new file mode 100644 index 0000000..21ac3db Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed19.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed20.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed20.bmp new file mode 100644 index 0000000..a109a4f Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed20.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed21.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed21.bmp new file mode 100644 index 0000000..3683c9d Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed21.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed22.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed22.bmp new file mode 100644 index 0000000..e9bdf40 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed22.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed23.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed23.bmp new file mode 100644 index 0000000..1d0bf79 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed23.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed24.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed24.bmp new file mode 100644 index 0000000..e89372f Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed24.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed25.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed25.bmp new file mode 100644 index 0000000..71a02c8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed25.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed26.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed26.bmp new file mode 100644 index 0000000..91032d0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed26.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed27.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed27.bmp new file mode 100644 index 0000000..67b6027 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed27.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed28.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed28.bmp new file mode 100644 index 0000000..6c52030 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed28.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed29.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed29.bmp new file mode 100644 index 0000000..d71b030 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed29.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed30.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed30.bmp new file mode 100644 index 0000000..417ae72 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed30.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed31.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed31.bmp new file mode 100644 index 0000000..81bede7 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed31.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed32.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed32.bmp new file mode 100644 index 0000000..4820be1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed32.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed33.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed33.bmp new file mode 100644 index 0000000..08603c1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed33.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed34.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed34.bmp new file mode 100644 index 0000000..d34eaa6 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed34.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Medium/RockBMed35.bmp b/Files/Art/SpaceRocks/RockB/Medium/RockBMed35.bmp new file mode 100644 index 0000000..37228f6 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Medium/RockBMed35.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/RockBBig.bmp b/Files/Art/SpaceRocks/RockB/RockBBig.bmp new file mode 100644 index 0000000..dc6b449 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/RockBBig.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/RockBMed.bmp b/Files/Art/SpaceRocks/RockB/RockBMed.bmp new file mode 100644 index 0000000..44d5473 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/RockBMed.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/RockBSmall.bmp b/Files/Art/SpaceRocks/RockB/RockBSmall.bmp new file mode 100644 index 0000000..83973e5 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/RockBSmall.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall00.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall00.bmp new file mode 100644 index 0000000..93547ef Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall00.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall01.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall01.bmp new file mode 100644 index 0000000..61ebdc1 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall01.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall02.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall02.bmp new file mode 100644 index 0000000..479af82 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall02.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall03.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall03.bmp new file mode 100644 index 0000000..cdd724d Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall03.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall04.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall04.bmp new file mode 100644 index 0000000..6da5453 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall04.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall05.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall05.bmp new file mode 100644 index 0000000..4231da2 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall05.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall06.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall06.bmp new file mode 100644 index 0000000..a065209 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall06.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall07.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall07.bmp new file mode 100644 index 0000000..ef85253 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall07.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall08.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall08.bmp new file mode 100644 index 0000000..bdf8588 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall08.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall09.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall09.bmp new file mode 100644 index 0000000..965ad0c Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall09.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall10.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall10.bmp new file mode 100644 index 0000000..54b035c Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall10.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall11.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall11.bmp new file mode 100644 index 0000000..caac8c2 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall11.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall12.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall12.bmp new file mode 100644 index 0000000..fd4124c Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall12.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall13.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall13.bmp new file mode 100644 index 0000000..451ff8e Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall13.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall14.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall14.bmp new file mode 100644 index 0000000..be607e8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall14.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall15.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall15.bmp new file mode 100644 index 0000000..9c1abd7 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall15.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall16.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall16.bmp new file mode 100644 index 0000000..63ce268 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall16.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall17.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall17.bmp new file mode 100644 index 0000000..0595990 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall17.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall18.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall18.bmp new file mode 100644 index 0000000..b281c15 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall18.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall19.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall19.bmp new file mode 100644 index 0000000..a6eaf3c Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall19.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall20.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall20.bmp new file mode 100644 index 0000000..f669e12 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall20.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall21.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall21.bmp new file mode 100644 index 0000000..d2ea5c8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall21.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall22.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall22.bmp new file mode 100644 index 0000000..39d3a5f Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall22.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall23.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall23.bmp new file mode 100644 index 0000000..7a4c949 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall23.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall24.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall24.bmp new file mode 100644 index 0000000..12e90df Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall24.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall25.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall25.bmp new file mode 100644 index 0000000..a536cef Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall25.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall26.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall26.bmp new file mode 100644 index 0000000..4adabc0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall26.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall27.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall27.bmp new file mode 100644 index 0000000..1c2513b Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall27.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall28.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall28.bmp new file mode 100644 index 0000000..70e17f0 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall28.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall29.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall29.bmp new file mode 100644 index 0000000..d9166d8 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall29.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall30.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall30.bmp new file mode 100644 index 0000000..8eb5075 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall30.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall31.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall31.bmp new file mode 100644 index 0000000..4a969d3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall31.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall32.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall32.bmp new file mode 100644 index 0000000..fd9a922 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall32.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall33.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall33.bmp new file mode 100644 index 0000000..c0ecca3 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall33.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall34.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall34.bmp new file mode 100644 index 0000000..742d0ad Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall34.bmp differ diff --git a/Files/Art/SpaceRocks/RockB/Small/RockBSmall35.bmp b/Files/Art/SpaceRocks/RockB/Small/RockBSmall35.bmp new file mode 100644 index 0000000..f4e4ee9 Binary files /dev/null and b/Files/Art/SpaceRocks/RockB/Small/RockBSmall35.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire000.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire000.bmp new file mode 100644 index 0000000..2dacaec Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire000.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire015.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire015.bmp new file mode 100644 index 0000000..07cdc10 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire015.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire030.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire030.bmp new file mode 100644 index 0000000..d5f9757 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire030.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire045.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire045.bmp new file mode 100644 index 0000000..78f19f2 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire045.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire060.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire060.bmp new file mode 100644 index 0000000..f7f77c1 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire060.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire075.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire075.bmp new file mode 100644 index 0000000..976f1b4 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire075.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire090.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire090.bmp new file mode 100644 index 0000000..68c48be Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire090.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire105.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire105.bmp new file mode 100644 index 0000000..e50d71d Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire105.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire120.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire120.bmp new file mode 100644 index 0000000..51104fb Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire120.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire135.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire135.bmp new file mode 100644 index 0000000..c8c12fb Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire135.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire150.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire150.bmp new file mode 100644 index 0000000..3fa549d Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire150.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire165.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire165.bmp new file mode 100644 index 0000000..265c424 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire165.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire180.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire180.bmp new file mode 100644 index 0000000..55652aa Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire180.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire195.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire195.bmp new file mode 100644 index 0000000..a284f48 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire195.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire210.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire210.bmp new file mode 100644 index 0000000..54f572a Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire210.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire225.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire225.bmp new file mode 100644 index 0000000..5a50be8 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire225.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire240.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire240.bmp new file mode 100644 index 0000000..1cbcc40 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire240.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire255.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire255.bmp new file mode 100644 index 0000000..ddfd5d0 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire255.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire270.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire270.bmp new file mode 100644 index 0000000..010698c Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire270.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire285.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire285.bmp new file mode 100644 index 0000000..f136e71 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire285.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire300.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire300.bmp new file mode 100644 index 0000000..3a8f773 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire300.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire315.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire315.bmp new file mode 100644 index 0000000..0c40e67 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire315.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire330.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire330.bmp new file mode 100644 index 0000000..af03c63 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire330.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire345.bmp b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire345.bmp new file mode 100644 index 0000000..e8a7d4c Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/Frames/ShipFire345.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/ShipFire.bmp b/Files/Art/SpaceRocks/ShipFire/ShipFire.bmp new file mode 100644 index 0000000..92d4da2 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/ShipFire.bmp differ diff --git a/Files/Art/SpaceRocks/ShipFire/ShipFire.psd b/Files/Art/SpaceRocks/ShipFire/ShipFire.psd new file mode 100644 index 0000000..1f3c99f Binary files /dev/null and b/Files/Art/SpaceRocks/ShipFire/ShipFire.psd differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire000.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire000.bmp new file mode 100644 index 0000000..912eb2c Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire000.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire015.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire015.bmp new file mode 100644 index 0000000..793f26b Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire015.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire030.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire030.bmp new file mode 100644 index 0000000..acc304b Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire030.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire045.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire045.bmp new file mode 100644 index 0000000..bf08256 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire045.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire060.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire060.bmp new file mode 100644 index 0000000..c174a22 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire060.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire075.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire075.bmp new file mode 100644 index 0000000..a13186e Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire075.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire090.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire090.bmp new file mode 100644 index 0000000..334dd4a Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire090.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire105.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire105.bmp new file mode 100644 index 0000000..e069061 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire105.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire120.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire120.bmp new file mode 100644 index 0000000..4e9fc25 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire120.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire135.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire135.bmp new file mode 100644 index 0000000..2a544e5 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire135.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire150.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire150.bmp new file mode 100644 index 0000000..8b6528e Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire150.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire165.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire165.bmp new file mode 100644 index 0000000..792df17 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire165.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire180.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire180.bmp new file mode 100644 index 0000000..f1e60ec Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire180.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire195.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire195.bmp new file mode 100644 index 0000000..a4822ed Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire195.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire210.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire210.bmp new file mode 100644 index 0000000..e78ded7 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire210.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire225.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire225.bmp new file mode 100644 index 0000000..f313e29 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire225.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire240.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire240.bmp new file mode 100644 index 0000000..92b9ed7 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire240.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire255.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire255.bmp new file mode 100644 index 0000000..63895bb Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire255.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire270.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire270.bmp new file mode 100644 index 0000000..7b05da3 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire270.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire288.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire288.bmp new file mode 100644 index 0000000..8a4fde3 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire288.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire300.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire300.bmp new file mode 100644 index 0000000..458556e Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire300.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire315.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire315.bmp new file mode 100644 index 0000000..1ea96c7 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire315.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire330.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire330.bmp new file mode 100644 index 0000000..3653d45 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire330.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire345.bmp b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire345.bmp new file mode 100644 index 0000000..88568a1 Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/Frames/ShipNoFire345.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/ShipNoFire.bmp b/Files/Art/SpaceRocks/ShipNoFire/ShipNoFire.bmp new file mode 100644 index 0000000..1e5843b Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/ShipNoFire.bmp differ diff --git a/Files/Art/SpaceRocks/ShipNoFire/ShipNoFire.psd b/Files/Art/SpaceRocks/ShipNoFire/ShipNoFire.psd new file mode 100644 index 0000000..ef8e1ac Binary files /dev/null and b/Files/Art/SpaceRocks/ShipNoFire/ShipNoFire.psd differ diff --git a/Files/Art/SpaceRocks/Work/FireStream.bmp b/Files/Art/SpaceRocks/Work/FireStream.bmp new file mode 100644 index 0000000..33e1480 Binary files /dev/null and b/Files/Art/SpaceRocks/Work/FireStream.bmp differ diff --git a/Files/Art/SpaceRocks/Work/Ship1.bmp b/Files/Art/SpaceRocks/Work/Ship1.bmp new file mode 100644 index 0000000..daa1137 Binary files /dev/null and b/Files/Art/SpaceRocks/Work/Ship1.bmp differ diff --git a/Files/Art/Wav/8GOAT.wav b/Files/Art/Wav/8GOAT.wav new file mode 100644 index 0000000..0795140 Binary files /dev/null and b/Files/Art/Wav/8GOAT.wav differ diff --git a/Files/Art/Wav/8ping.wav b/Files/Art/Wav/8ping.wav new file mode 100644 index 0000000..ab3dad6 Binary files /dev/null and b/Files/Art/Wav/8ping.wav differ diff --git a/Files/Art/Wav/applause.wav b/Files/Art/Wav/applause.wav new file mode 100644 index 0000000..94e5cef Binary files /dev/null and b/Files/Art/Wav/applause.wav differ diff --git a/Files/Art/Wav/biglaff.wav b/Files/Art/Wav/biglaff.wav new file mode 100644 index 0000000..7745514 Binary files /dev/null and b/Files/Art/Wav/biglaff.wav differ diff --git a/Files/Art/Wav/break.wav b/Files/Art/Wav/break.wav new file mode 100644 index 0000000..d1a2a24 Binary files /dev/null and b/Files/Art/Wav/break.wav differ diff --git a/Files/Art/Wav/carhorn.wav b/Files/Art/Wav/carhorn.wav new file mode 100644 index 0000000..8a4faca Binary files /dev/null and b/Files/Art/Wav/carhorn.wav differ diff --git a/Files/Art/Wav/die1.wav b/Files/Art/Wav/die1.wav new file mode 100644 index 0000000..b8a6286 Binary files /dev/null and b/Files/Art/Wav/die1.wav differ diff --git a/Files/Art/Wav/die2.wav b/Files/Art/Wav/die2.wav new file mode 100644 index 0000000..4d74968 Binary files /dev/null and b/Files/Art/Wav/die2.wav differ diff --git a/Files/Art/Wav/dischord.wav b/Files/Art/Wav/dischord.wav new file mode 100644 index 0000000..a490de7 Binary files /dev/null and b/Files/Art/Wav/dischord.wav differ diff --git a/Files/Art/Wav/elaugh.wav b/Files/Art/Wav/elaugh.wav new file mode 100644 index 0000000..30044cc Binary files /dev/null and b/Files/Art/Wav/elaugh.wav differ diff --git a/Files/Art/Wav/falling.wav b/Files/Art/Wav/falling.wav new file mode 100644 index 0000000..2c8673d Binary files /dev/null and b/Files/Art/Wav/falling.wav differ diff --git a/Files/Art/Wav/fanfare.wav b/Files/Art/Wav/fanfare.wav new file mode 100644 index 0000000..fe9a4cb Binary files /dev/null and b/Files/Art/Wav/fanfare.wav differ diff --git a/Files/Art/Wav/grshot.wav b/Files/Art/Wav/grshot.wav new file mode 100644 index 0000000..0c397ab Binary files /dev/null and b/Files/Art/Wav/grshot.wav differ diff --git a/Files/Art/Wav/guit1.wav b/Files/Art/Wav/guit1.wav new file mode 100644 index 0000000..d7e3e32 Binary files /dev/null and b/Files/Art/Wav/guit1.wav differ diff --git a/Files/Art/Wav/jharp.wav b/Files/Art/Wav/jharp.wav new file mode 100644 index 0000000..a5fad3e Binary files /dev/null and b/Files/Art/Wav/jharp.wav differ diff --git a/Files/Art/Wav/laughs.wav b/Files/Art/Wav/laughs.wav new file mode 100644 index 0000000..5293060 Binary files /dev/null and b/Files/Art/Wav/laughs.wav differ diff --git a/Files/Art/Wav/littletune.wav b/Files/Art/Wav/littletune.wav new file mode 100644 index 0000000..bd38082 Binary files /dev/null and b/Files/Art/Wav/littletune.wav differ diff --git a/Files/Art/Wav/not.wav b/Files/Art/Wav/not.wav new file mode 100644 index 0000000..dddba10 Binary files /dev/null and b/Files/Art/Wav/not.wav differ diff --git a/Files/Art/Wav/ouch.wav b/Files/Art/Wav/ouch.wav new file mode 100644 index 0000000..c6f1563 Binary files /dev/null and b/Files/Art/Wav/ouch.wav differ diff --git a/Files/Art/Wav/ovation.wav b/Files/Art/Wav/ovation.wav new file mode 100644 index 0000000..d1c2807 Binary files /dev/null and b/Files/Art/Wav/ovation.wav differ diff --git a/Files/Art/Wav/snd01.wav b/Files/Art/Wav/snd01.wav new file mode 100644 index 0000000..12f9953 Binary files /dev/null and b/Files/Art/Wav/snd01.wav differ diff --git a/Files/Art/Wav/snd02.wav b/Files/Art/Wav/snd02.wav new file mode 100644 index 0000000..3cc8d9c Binary files /dev/null and b/Files/Art/Wav/snd02.wav differ diff --git a/Files/Art/Wav/snd02b.wav b/Files/Art/Wav/snd02b.wav new file mode 100644 index 0000000..f9a017d Binary files /dev/null and b/Files/Art/Wav/snd02b.wav differ diff --git a/Files/Art/Wav/snd04.wav b/Files/Art/Wav/snd04.wav new file mode 100644 index 0000000..87929d1 Binary files /dev/null and b/Files/Art/Wav/snd04.wav differ diff --git a/Files/Art/Wav/snd05.wav b/Files/Art/Wav/snd05.wav new file mode 100644 index 0000000..bdb53ea Binary files /dev/null and b/Files/Art/Wav/snd05.wav differ diff --git a/Files/Art/Wav/snd06.wav b/Files/Art/Wav/snd06.wav new file mode 100644 index 0000000..1ad8280 Binary files /dev/null and b/Files/Art/Wav/snd06.wav differ diff --git a/Files/Art/Wav/snd07.wav b/Files/Art/Wav/snd07.wav new file mode 100644 index 0000000..10f4680 Binary files /dev/null and b/Files/Art/Wav/snd07.wav differ diff --git a/Files/Art/Wav/snd09.wav b/Files/Art/Wav/snd09.wav new file mode 100644 index 0000000..276b338 Binary files /dev/null and b/Files/Art/Wav/snd09.wav differ diff --git a/Files/Art/Wav/snd10.wav b/Files/Art/Wav/snd10.wav new file mode 100644 index 0000000..25e884a Binary files /dev/null and b/Files/Art/Wav/snd10.wav differ diff --git a/Files/Art/Wav/snd11.wav b/Files/Art/Wav/snd11.wav new file mode 100644 index 0000000..d0a386d Binary files /dev/null and b/Files/Art/Wav/snd11.wav differ diff --git a/Files/Art/Wav/squeak.wav b/Files/Art/Wav/squeak.wav new file mode 100644 index 0000000..0ee5f8c Binary files /dev/null and b/Files/Art/Wav/squeak.wav differ diff --git a/Files/Art/Wav/squeak1.wav b/Files/Art/Wav/squeak1.wav new file mode 100644 index 0000000..50ff4bd Binary files /dev/null and b/Files/Art/Wav/squeak1.wav differ diff --git a/Files/Art/Wav/squeak2.wav b/Files/Art/Wav/squeak2.wav new file mode 100644 index 0000000..524c3c0 Binary files /dev/null and b/Files/Art/Wav/squeak2.wav differ diff --git a/Files/Art/Wav/syn4.wav b/Files/Art/Wav/syn4.wav new file mode 100644 index 0000000..1b1bacc Binary files /dev/null and b/Files/Art/Wav/syn4.wav differ diff --git a/Files/Art/Wav/thud.wav b/Files/Art/Wav/thud.wav new file mode 100644 index 0000000..c9c578d Binary files /dev/null and b/Files/Art/Wav/thud.wav differ diff --git a/Files/Art/numbertiles/256Color/numbertiles.bmp b/Files/Art/numbertiles/256Color/numbertiles.bmp new file mode 100644 index 0000000..66179ae Binary files /dev/null and b/Files/Art/numbertiles/256Color/numbertiles.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-0.bmp b/Files/Art/numbertiles/frames/nd1-0.bmp new file mode 100644 index 0000000..99e7226 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-1.bmp b/Files/Art/numbertiles/frames/nd1-1.bmp new file mode 100644 index 0000000..55725fd Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-2.bmp b/Files/Art/numbertiles/frames/nd1-2.bmp new file mode 100644 index 0000000..1bf29d0 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-3.bmp b/Files/Art/numbertiles/frames/nd1-3.bmp new file mode 100644 index 0000000..fb9d176 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-4.bmp b/Files/Art/numbertiles/frames/nd1-4.bmp new file mode 100644 index 0000000..04e250f Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-5.bmp b/Files/Art/numbertiles/frames/nd1-5.bmp new file mode 100644 index 0000000..4b913d4 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-6.bmp b/Files/Art/numbertiles/frames/nd1-6.bmp new file mode 100644 index 0000000..d6f0f13 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-7.bmp b/Files/Art/numbertiles/frames/nd1-7.bmp new file mode 100644 index 0000000..62a77fb Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-8.bmp b/Files/Art/numbertiles/frames/nd1-8.bmp new file mode 100644 index 0000000..604a8f8 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd1-9.bmp b/Files/Art/numbertiles/frames/nd1-9.bmp new file mode 100644 index 0000000..e574cc3 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd1-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-0.bmp b/Files/Art/numbertiles/frames/nd2-0.bmp new file mode 100644 index 0000000..f8e2680 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-1.bmp b/Files/Art/numbertiles/frames/nd2-1.bmp new file mode 100644 index 0000000..05b03f3 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-2.bmp b/Files/Art/numbertiles/frames/nd2-2.bmp new file mode 100644 index 0000000..23f19ea Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-3.bmp b/Files/Art/numbertiles/frames/nd2-3.bmp new file mode 100644 index 0000000..a13fb11 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-4.bmp b/Files/Art/numbertiles/frames/nd2-4.bmp new file mode 100644 index 0000000..b59a5b1 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-5.bmp b/Files/Art/numbertiles/frames/nd2-5.bmp new file mode 100644 index 0000000..d157b3d Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-6.bmp b/Files/Art/numbertiles/frames/nd2-6.bmp new file mode 100644 index 0000000..cd45b32 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-7.bmp b/Files/Art/numbertiles/frames/nd2-7.bmp new file mode 100644 index 0000000..f6adbc5 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-8.bmp b/Files/Art/numbertiles/frames/nd2-8.bmp new file mode 100644 index 0000000..765911f Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd2-9.bmp b/Files/Art/numbertiles/frames/nd2-9.bmp new file mode 100644 index 0000000..bc880fa Binary files /dev/null and b/Files/Art/numbertiles/frames/nd2-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-0.bmp b/Files/Art/numbertiles/frames/nd3-0.bmp new file mode 100644 index 0000000..1bc818b Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-1.bmp b/Files/Art/numbertiles/frames/nd3-1.bmp new file mode 100644 index 0000000..1c12f00 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-2.bmp b/Files/Art/numbertiles/frames/nd3-2.bmp new file mode 100644 index 0000000..a8492f3 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-3.bmp b/Files/Art/numbertiles/frames/nd3-3.bmp new file mode 100644 index 0000000..14f8ae5 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-4.bmp b/Files/Art/numbertiles/frames/nd3-4.bmp new file mode 100644 index 0000000..6f11cda Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-5.bmp b/Files/Art/numbertiles/frames/nd3-5.bmp new file mode 100644 index 0000000..5b82f85 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-6.bmp b/Files/Art/numbertiles/frames/nd3-6.bmp new file mode 100644 index 0000000..2d420a6 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-7.bmp b/Files/Art/numbertiles/frames/nd3-7.bmp new file mode 100644 index 0000000..bf957d1 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-8.bmp b/Files/Art/numbertiles/frames/nd3-8.bmp new file mode 100644 index 0000000..fe0c405 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd3-9.bmp b/Files/Art/numbertiles/frames/nd3-9.bmp new file mode 100644 index 0000000..f3de6b4 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd3-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-0.bmp b/Files/Art/numbertiles/frames/nd4-0.bmp new file mode 100644 index 0000000..6796a1c Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-1.bmp b/Files/Art/numbertiles/frames/nd4-1.bmp new file mode 100644 index 0000000..b7258dc Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-2.bmp b/Files/Art/numbertiles/frames/nd4-2.bmp new file mode 100644 index 0000000..d40e1ff Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-3.bmp b/Files/Art/numbertiles/frames/nd4-3.bmp new file mode 100644 index 0000000..d579ca1 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-4.bmp b/Files/Art/numbertiles/frames/nd4-4.bmp new file mode 100644 index 0000000..7fb2708 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-5.bmp b/Files/Art/numbertiles/frames/nd4-5.bmp new file mode 100644 index 0000000..4c7ff30 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-6.bmp b/Files/Art/numbertiles/frames/nd4-6.bmp new file mode 100644 index 0000000..bf9e8e2 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-7.bmp b/Files/Art/numbertiles/frames/nd4-7.bmp new file mode 100644 index 0000000..5d8efc7 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-8.bmp b/Files/Art/numbertiles/frames/nd4-8.bmp new file mode 100644 index 0000000..cda4702 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd4-9.bmp b/Files/Art/numbertiles/frames/nd4-9.bmp new file mode 100644 index 0000000..249940d Binary files /dev/null and b/Files/Art/numbertiles/frames/nd4-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-0.bmp b/Files/Art/numbertiles/frames/nd5-0.bmp new file mode 100644 index 0000000..e02b03c Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-1.bmp b/Files/Art/numbertiles/frames/nd5-1.bmp new file mode 100644 index 0000000..e882b91 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-2.bmp b/Files/Art/numbertiles/frames/nd5-2.bmp new file mode 100644 index 0000000..264fe86 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-3.bmp b/Files/Art/numbertiles/frames/nd5-3.bmp new file mode 100644 index 0000000..fcdc35a Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-4.bmp b/Files/Art/numbertiles/frames/nd5-4.bmp new file mode 100644 index 0000000..55ce491 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-5.bmp b/Files/Art/numbertiles/frames/nd5-5.bmp new file mode 100644 index 0000000..9c6df6f Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-6.bmp b/Files/Art/numbertiles/frames/nd5-6.bmp new file mode 100644 index 0000000..4d3791e Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-7.bmp b/Files/Art/numbertiles/frames/nd5-7.bmp new file mode 100644 index 0000000..5a6d2cf Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-8.bmp b/Files/Art/numbertiles/frames/nd5-8.bmp new file mode 100644 index 0000000..02a7c45 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd5-9.bmp b/Files/Art/numbertiles/frames/nd5-9.bmp new file mode 100644 index 0000000..8e3cea4 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd5-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-0.bmp b/Files/Art/numbertiles/frames/nd6-0.bmp new file mode 100644 index 0000000..66d8ec5 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-1.bmp b/Files/Art/numbertiles/frames/nd6-1.bmp new file mode 100644 index 0000000..b6c4d8f Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-2.bmp b/Files/Art/numbertiles/frames/nd6-2.bmp new file mode 100644 index 0000000..220de82 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-3.bmp b/Files/Art/numbertiles/frames/nd6-3.bmp new file mode 100644 index 0000000..ba9d2ab Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-4.bmp b/Files/Art/numbertiles/frames/nd6-4.bmp new file mode 100644 index 0000000..10c69d2 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-5.bmp b/Files/Art/numbertiles/frames/nd6-5.bmp new file mode 100644 index 0000000..6ae982c Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-6.bmp b/Files/Art/numbertiles/frames/nd6-6.bmp new file mode 100644 index 0000000..9b9f079 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-7.bmp b/Files/Art/numbertiles/frames/nd6-7.bmp new file mode 100644 index 0000000..d1279f0 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-8.bmp b/Files/Art/numbertiles/frames/nd6-8.bmp new file mode 100644 index 0000000..2421a79 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd6-9.bmp b/Files/Art/numbertiles/frames/nd6-9.bmp new file mode 100644 index 0000000..3dd37b5 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd6-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-0.bmp b/Files/Art/numbertiles/frames/nd7-0.bmp new file mode 100644 index 0000000..8a920eb Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-1.bmp b/Files/Art/numbertiles/frames/nd7-1.bmp new file mode 100644 index 0000000..5139bd9 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-2.bmp b/Files/Art/numbertiles/frames/nd7-2.bmp new file mode 100644 index 0000000..f1ddccd Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-3.bmp b/Files/Art/numbertiles/frames/nd7-3.bmp new file mode 100644 index 0000000..df7b630 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-4.bmp b/Files/Art/numbertiles/frames/nd7-4.bmp new file mode 100644 index 0000000..7adb9a7 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-5.bmp b/Files/Art/numbertiles/frames/nd7-5.bmp new file mode 100644 index 0000000..e826b48 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-6.bmp b/Files/Art/numbertiles/frames/nd7-6.bmp new file mode 100644 index 0000000..9be78bc Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-7.bmp b/Files/Art/numbertiles/frames/nd7-7.bmp new file mode 100644 index 0000000..1cbe283 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-8.bmp b/Files/Art/numbertiles/frames/nd7-8.bmp new file mode 100644 index 0000000..ba07f65 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd7-9.bmp b/Files/Art/numbertiles/frames/nd7-9.bmp new file mode 100644 index 0000000..aa0440e Binary files /dev/null and b/Files/Art/numbertiles/frames/nd7-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-0.bmp b/Files/Art/numbertiles/frames/nd8-0.bmp new file mode 100644 index 0000000..e8b7e1e Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-1.bmp b/Files/Art/numbertiles/frames/nd8-1.bmp new file mode 100644 index 0000000..14be88f Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-2.bmp b/Files/Art/numbertiles/frames/nd8-2.bmp new file mode 100644 index 0000000..7b80902 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-3.bmp b/Files/Art/numbertiles/frames/nd8-3.bmp new file mode 100644 index 0000000..98558b7 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-4.bmp b/Files/Art/numbertiles/frames/nd8-4.bmp new file mode 100644 index 0000000..5210f9e Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-5.bmp b/Files/Art/numbertiles/frames/nd8-5.bmp new file mode 100644 index 0000000..ec80449 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-6.bmp b/Files/Art/numbertiles/frames/nd8-6.bmp new file mode 100644 index 0000000..b9beb16 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-7.bmp b/Files/Art/numbertiles/frames/nd8-7.bmp new file mode 100644 index 0000000..a02d0d1 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-8.bmp b/Files/Art/numbertiles/frames/nd8-8.bmp new file mode 100644 index 0000000..1b30a0d Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd8-9.bmp b/Files/Art/numbertiles/frames/nd8-9.bmp new file mode 100644 index 0000000..f028150 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd8-9.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-0.bmp b/Files/Art/numbertiles/frames/nd9-0.bmp new file mode 100644 index 0000000..463925b Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-0.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-1.bmp b/Files/Art/numbertiles/frames/nd9-1.bmp new file mode 100644 index 0000000..a99dbeb Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-1.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-2.bmp b/Files/Art/numbertiles/frames/nd9-2.bmp new file mode 100644 index 0000000..564db2a Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-2.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-3.bmp b/Files/Art/numbertiles/frames/nd9-3.bmp new file mode 100644 index 0000000..2988b08 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-3.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-4.bmp b/Files/Art/numbertiles/frames/nd9-4.bmp new file mode 100644 index 0000000..9edcd5f Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-4.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-5.bmp b/Files/Art/numbertiles/frames/nd9-5.bmp new file mode 100644 index 0000000..fb02054 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-5.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-6.bmp b/Files/Art/numbertiles/frames/nd9-6.bmp new file mode 100644 index 0000000..c625858 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-6.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-7.bmp b/Files/Art/numbertiles/frames/nd9-7.bmp new file mode 100644 index 0000000..f434ad2 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-7.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-8.bmp b/Files/Art/numbertiles/frames/nd9-8.bmp new file mode 100644 index 0000000..5134b9b Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-8.bmp differ diff --git a/Files/Art/numbertiles/frames/nd9-9.bmp b/Files/Art/numbertiles/frames/nd9-9.bmp new file mode 100644 index 0000000..46b9224 Binary files /dev/null and b/Files/Art/numbertiles/frames/nd9-9.bmp differ diff --git a/Files/Art/numbertiles/numbertiles.bmp b/Files/Art/numbertiles/numbertiles.bmp new file mode 100644 index 0000000..2f3890b Binary files /dev/null and b/Files/Art/numbertiles/numbertiles.bmp differ diff --git a/Files/Art/yhatzee/Gradient.bmp b/Files/Art/yhatzee/Gradient.bmp new file mode 100644 index 0000000..ff10ed7 Binary files /dev/null and b/Files/Art/yhatzee/Gradient.bmp differ diff --git a/Files/BmpStitch/AssemblyInfo.vb b/Files/BmpStitch/AssemblyInfo.vb new file mode 100644 index 0000000..02a72e2 --- /dev/null +++ b/Files/BmpStitch/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/BmpStitch/BmpStitch.sln b/Files/BmpStitch/BmpStitch.sln new file mode 100644 index 0000000..71f9f87 --- /dev/null +++ b/Files/BmpStitch/BmpStitch.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BmpStitch", "BmpStitch.vbproj", "{499D0BEC-001C-40CC-B55A-899B6F4AE6C3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Debug.ActiveCfg = Debug|.NET + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Debug.Build.0 = Debug|.NET + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Release.ActiveCfg = Release|.NET + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/BmpStitch/BmpStitch.sln.old b/Files/BmpStitch/BmpStitch.sln.old new file mode 100644 index 0000000..8077811 --- /dev/null +++ b/Files/BmpStitch/BmpStitch.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BmpStitch", "BmpStitch.vbproj", "{499D0BEC-001C-40CC-B55A-899B6F4AE6C3}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Debug.ActiveCfg = Debug|.NET + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Debug.Build.0 = Debug|.NET + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Release.ActiveCfg = Release|.NET + {499D0BEC-001C-40CC-B55A-899B6F4AE6C3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/BmpStitch/BmpStitch.suo b/Files/BmpStitch/BmpStitch.suo new file mode 100644 index 0000000..bdc3366 Binary files /dev/null and b/Files/BmpStitch/BmpStitch.suo differ diff --git a/Files/BmpStitch/BmpStitch.vbproj b/Files/BmpStitch/BmpStitch.vbproj new file mode 100644 index 0000000..91e09a4 --- /dev/null +++ b/Files/BmpStitch/BmpStitch.vbproj @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/BmpStitch/BmpStitch.vbproj.user b/Files/BmpStitch/BmpStitch.vbproj.user new file mode 100644 index 0000000..c0fd212 --- /dev/null +++ b/Files/BmpStitch/BmpStitch.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/BmpStitch/ClipPictureBox.resx b/Files/BmpStitch/ClipPictureBox.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Files/BmpStitch/ClipPictureBox.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/BmpStitch/ClipPictureBox.vb b/Files/BmpStitch/ClipPictureBox.vb new file mode 100644 index 0000000..1919a47 --- /dev/null +++ b/Files/BmpStitch/ClipPictureBox.vb @@ -0,0 +1,219 @@ +Imports System.Math + +Public Class ClipPictureBox + Inherits PictureBox + + Private Const TSIZE As Integer = 4 + + Private FClipDisabled As Boolean + + Private FClipInitialized As Boolean = False + Private FClipTop As Integer + Private FClipBottom As Integer + Private FClipLeft As Integer + Private FClipRight As Integer + + Private FDraggingTop As Boolean = False + Private FDraggingBottom As Boolean = False + Private FDraggingLeft As Boolean = False + Private FDraggingRight As Boolean = False + + Private FClipColor As Color = Color.Yellow + Property ClipColor() As Color + Get + Return FClipColor + End Get + Set(ByVal Value As Color) + FClipColor = Value + Me.Invalidate() + End Set + End Property + + Property ClipDisabled() As Boolean + Get + Return FClipDisabled + End Get + Set(ByVal Value As Boolean) + FClipDisabled = Value + If FClipDisabled Then + FClipTop = 0 + FClipBottom = Me.Height + FClipLeft = 0 + FClipRight = Me.Width + Me.Invalidate() + RaiseEvent ClippingRectChanged(Me.ClippingRect) + End If + End Set + End Property + + Public Event ClippingRectChanged(ByVal r As Rectangle) + + ReadOnly Property ClippingRect() As Rectangle + Get + Return New Rectangle(FClipLeft, FClipTop, FClipRight - FClipLeft, FClipBottom - FClipTop) + End Get + End Property + + Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs) + + MyBase.OnPaint(pe) + + Call DrawYMarker(pe.Graphics, FClipTop) + Call DrawYMarker(pe.Graphics, FClipBottom) + + Call DrawXMarker(pe.Graphics, FClipLeft) + Call DrawXMarker(pe.Graphics, FClipRight) + End Sub + + Private Sub DrawYMarker(ByVal g As Graphics, ByVal y As Integer) + + Dim pt(2) As Point + Dim b As New SolidBrush(ClipColor) + + pt(0) = New Point + With pt(0) + .X = 0 + .Y = y - TSIZE + End With + + pt(1) = New Point + With pt(1) + .X = TSIZE + .Y = y + End With + + pt(2) = New Point + With pt(2) + .X = 0 + .Y = y + TSIZE + End With + + Call g.FillPolygon(b, pt) + + Dim p As New Pen(ClipColor) + p.DashStyle = Drawing.Drawing2D.DashStyle.Dot + g.DrawLine(p, 0, y, Width, y) + + End Sub + Private Sub DrawXMarker(ByVal g As Graphics, ByVal x As Integer) + + Dim pt(2) As Point + Dim b As New SolidBrush(ClipColor) + + pt(0) = New Point + With pt(0) + .X = x - TSIZE + .Y = 0 + End With + + pt(1) = New Point + With pt(1) + .X = x + .Y = TSIZE + End With + + pt(2) = New Point + With pt(2) + .X = x + TSIZE + .Y = 0 + End With + + Call g.FillPolygon(b, pt) + Dim p As New Pen(ClipColor) + p.DashStyle = Drawing.Drawing2D.DashStyle.Dot + g.DrawLine(p, x, 0, x, Height) + + End Sub + + Shadows Property Image() As Image + Get + Return MyBase.Image + End Get + Set(ByVal Value As Image) + MyBase.Image = Value + + If Not FClipInitialized Then + FClipTop = Height \ 4 + FClipBottom = (Height \ 4) * 3 + + FClipLeft = Width \ 4 + FClipRight = (Width \ 4) * 3 + FClipInitialized = True + End If + End Set + End Property + + + Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + If e.Button = MouseButtons.Left Then + If e.Y <= TSIZE Then + If Abs(e.X - FClipLeft) <= TSIZE Then + FDraggingLeft = True + Exit Sub + End If + If Abs(e.X - FClipRight) <= TSIZE Then + FDraggingRight = True + Exit Sub + End If + End If + + If e.X <= TSIZE Then + If Abs(e.Y - FClipTop) <= TSIZE Then + FDraggingTop = True + Exit Sub + End If + If Abs(e.Y - FClipBottom) <= TSIZE Then + FDraggingBottom = True + Exit Sub + End If + End If + End If + MyBase.OnMouseDown(e) + End Sub + Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs) + + If FDraggingTop Then + If e.Y >= 0 And e.Y <= Me.Height \ 2 Then + FClipTop = e.Y + Me.Invalidate() + RaiseEvent ClippingRectChanged(Me.ClippingRect) + End If + End If + + If FDraggingBottom Then + If e.Y > Me.Height \ 2 And e.Y < Me.Height Then + FClipBottom = e.Y + Me.Invalidate() + RaiseEvent ClippingRectChanged(Me.ClippingRect) + End If + End If + + If FDraggingLeft Then + If e.X >= 0 And e.X <= Me.Width \ 2 Then + FClipLeft = e.X + Me.Invalidate() + RaiseEvent ClippingRectChanged(Me.ClippingRect) + End If + End If + + If FDraggingRight Then + If e.X > Me.Width \ 2 And e.X < Me.Width Then + FClipRight = e.X + Me.Invalidate() + RaiseEvent ClippingRectChanged(Me.ClippingRect) + End If + End If + + MyBase.OnMouseMove(e) + + End Sub + Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs) + FDraggingTop = False + FDraggingBottom = False + FDraggingLeft = False + FDraggingRight = False + + MyBase.OnMouseUp(e) + End Sub +End Class diff --git a/Files/BmpStitch/Form1.resx b/Files/BmpStitch/Form1.resx new file mode 100644 index 0000000..3a1cc08 --- /dev/null +++ b/Files/BmpStitch/Form1.resx @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + 17, 17 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + fBMPStitch + + + Assembly + + \ No newline at end of file diff --git a/Files/BmpStitch/Form1.vb b/Files/BmpStitch/Form1.vb new file mode 100644 index 0000000..bce3921 --- /dev/null +++ b/Files/BmpStitch/Form1.vb @@ -0,0 +1,299 @@ +Imports System.IO +Imports System.Threading + +Public Class fBMPStitch + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents cbFile As System.Windows.Forms.Button + Friend WithEvents oDialog As System.Windows.Forms.OpenFileDialog + Friend WithEvents cbAnim As System.Windows.Forms.Button + Friend WithEvents nudAcross As System.Windows.Forms.NumericUpDown + Friend WithEvents lbAcross As System.Windows.Forms.Label + Friend WithEvents lbDown As System.Windows.Forms.Label + Friend WithEvents lbFrames As System.Windows.Forms.Label + Friend WithEvents cbBuild As System.Windows.Forms.Button + Friend WithEvents nudDown As System.Windows.Forms.NumericUpDown + Friend WithEvents lbClip As System.Windows.Forms.Label + Friend WithEvents cbClipOff As System.Windows.Forms.CheckBox + Private Sub InitializeComponent() + Me.cbFile = New System.Windows.Forms.Button + Me.oDialog = New System.Windows.Forms.OpenFileDialog + Me.cbAnim = New System.Windows.Forms.Button + Me.nudAcross = New System.Windows.Forms.NumericUpDown + Me.lbAcross = New System.Windows.Forms.Label + Me.nudDown = New System.Windows.Forms.NumericUpDown + Me.lbDown = New System.Windows.Forms.Label + Me.lbFrames = New System.Windows.Forms.Label + Me.cbBuild = New System.Windows.Forms.Button + Me.lbClip = New System.Windows.Forms.Label + Me.cbClipOff = New System.Windows.Forms.CheckBox + CType(Me.nudAcross, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudDown, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'cbFile + ' + Me.cbFile.Location = New System.Drawing.Point(16, 192) + Me.cbFile.Name = "cbFile" + Me.cbFile.TabIndex = 0 + Me.cbFile.Text = "Open..." + ' + 'oDialog + ' + Me.oDialog.Filter = "*.bmp|*.bmp" + Me.oDialog.InitialDirectory = "c:\vbNetGames\Art" + Me.oDialog.Title = "open" + ' + 'cbAnim + ' + Me.cbAnim.Location = New System.Drawing.Point(104, 192) + Me.cbAnim.Name = "cbAnim" + Me.cbAnim.TabIndex = 2 + Me.cbAnim.Text = "Anim" + ' + 'nudAcross + ' + Me.nudAcross.Location = New System.Drawing.Point(160, 232) + Me.nudAcross.Name = "nudAcross" + Me.nudAcross.Size = New System.Drawing.Size(48, 21) + Me.nudAcross.TabIndex = 4 + Me.nudAcross.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.nudAcross.Value = New Decimal(New Integer() {5, 0, 0, 0}) + ' + 'lbAcross + ' + Me.lbAcross.Location = New System.Drawing.Point(104, 232) + Me.lbAcross.Name = "lbAcross" + Me.lbAcross.Size = New System.Drawing.Size(48, 23) + Me.lbAcross.TabIndex = 5 + Me.lbAcross.Text = "Across" + Me.lbAcross.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'nudDown + ' + Me.nudDown.Location = New System.Drawing.Point(160, 256) + Me.nudDown.Name = "nudDown" + Me.nudDown.Size = New System.Drawing.Size(48, 21) + Me.nudDown.TabIndex = 6 + Me.nudDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.nudDown.Value = New Decimal(New Integer() {5, 0, 0, 0}) + ' + 'lbDown + ' + Me.lbDown.Location = New System.Drawing.Point(104, 256) + Me.lbDown.Name = "lbDown" + Me.lbDown.Size = New System.Drawing.Size(48, 23) + Me.lbDown.TabIndex = 7 + Me.lbDown.Text = "Down" + Me.lbDown.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'lbFrames + ' + Me.lbFrames.Location = New System.Drawing.Point(16, 232) + Me.lbFrames.Name = "lbFrames" + Me.lbFrames.Size = New System.Drawing.Size(56, 23) + Me.lbFrames.TabIndex = 8 + Me.lbFrames.Text = "0 frames" + ' + 'cbBuild + ' + Me.cbBuild.Location = New System.Drawing.Point(128, 336) + Me.cbBuild.Name = "cbBuild" + Me.cbBuild.TabIndex = 9 + Me.cbBuild.Text = "Build" + ' + 'lbClip + ' + Me.lbClip.Location = New System.Drawing.Point(8, 288) + Me.lbClip.Name = "lbClip" + Me.lbClip.Size = New System.Drawing.Size(192, 40) + Me.lbClip.TabIndex = 10 + ' + 'cbClipOff + ' + Me.cbClipOff.Location = New System.Drawing.Point(8, 248) + Me.cbClipOff.Name = "cbClipOff" + Me.cbClipOff.TabIndex = 11 + Me.cbClipOff.Text = "NoClip" + ' + 'fBMPStitch + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(208, 365) + Me.Controls.Add(Me.lbClip) + Me.Controls.Add(Me.cbBuild) + Me.Controls.Add(Me.lbFrames) + Me.Controls.Add(Me.lbDown) + Me.Controls.Add(Me.nudDown) + Me.Controls.Add(Me.lbAcross) + Me.Controls.Add(Me.nudAcross) + Me.Controls.Add(Me.cbAnim) + Me.Controls.Add(Me.cbFile) + Me.Controls.Add(Me.cbClipOff) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "fBMPStitch" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "BMPStitch" + CType(Me.nudAcross, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudDown, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private FBaseFile As String + Dim FFrames As Integer + Dim pb As ClipPictureBox + + Private Sub cbFile_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbFile.Click + + If oDialog.ShowDialog Then + FBaseFile = oDialog.FileName + + If pb Is Nothing Then + pb = New ClipPictureBox + pb.SizeMode = PictureBoxSizeMode.AutoSize + pb.Location = New Point(10, 10) + pb.Visible = True + AddHandler pb.ClippingRectChanged, AddressOf pb_ClippingRectChanged + Me.Controls.Add(pb) + End If + + pb.Image = Image.FromFile(FBaseFile) + + Call CountFiles() + End If + + End Sub + + Private Sub pb_ClippingRectChanged(ByVal r As Rectangle) + lbClip.Text = r.ToString + End Sub + + Private Sub CountFiles() + + Dim f As New FileInfo(FBaseFile) + Dim d As New DirectoryInfo(f.DirectoryName) + + Dim cExt As String = f.Extension + FFrames = 0 + For Each f In d.GetFiles("*" & cExt) + FFrames += 1 + Next + lbFrames.Text = FFrames & " frames" + + nudAcross.Value = Math.Sqrt(FFrames) + nudDown.Value = nudAcross.Value + End Sub + + Private Sub cbAnim_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbAnim.Click + + Dim f As New FileInfo(FBaseFile) + Dim d As New DirectoryInfo(f.DirectoryName) + + Dim cExt As String = f.Extension + For Each f In d.GetFiles("*" & cExt) + pb.Image = Image.FromFile(f.FullName) + pb.Refresh() + Thread.CurrentThread.Sleep(100) + Next + + End Sub + + Private Sub cbBuild_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbBuild.Click + + Dim b As Bitmap + Dim f As New FileInfo(FBaseFile) + Dim d As New DirectoryInfo(f.DirectoryName) + + Dim x, y As Integer + Dim h, w As Integer + Dim iA, iD As Integer + Dim cExt As String + + iA = nudAcross.Value 'updowns store as decimal, putting in integer truncs value + iD = nudDown.Value + + If iA * iD <> FFrames Then + MsgBox("across * down must = frames", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly, "Error") + Else + w = pb.ClippingRect.Width + h = pb.ClippingRect.Height + + b = New Bitmap(w * iA, h * iD, Graphics.FromImage(pb.Image)) + + Dim g As Graphics + + g = Graphics.FromImage(b) + + Try + x = 0 + y = 0 + + cExt = f.Extension + For Each f In d.GetFiles("*" & cExt) + pb.Image = Image.FromFile(f.FullName) + pb.Refresh() + Thread.CurrentThread.Sleep(100) + + g.DrawImageUnscaled(pb.Image, x, y) + + x += w + + If x >= w * iA Then + x = 0 + y += h + End If + + Next + + Finally + g.Dispose() + End Try + + b.Save("c:\BMPStitch.bmp", System.Drawing.Imaging.ImageFormat.Bmp) + lbClip.Text = "c:\BMPStitch.bmp saved" + + End If + + End Sub + + Private Sub cbClipOff_CheckedChanged(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbClipOff.CheckedChanged + + pb.ClipDisabled = cbClipOff.Checked + End Sub + +End Class diff --git a/Files/BmpStitch/bin/BmpStitch.exe b/Files/BmpStitch/bin/BmpStitch.exe new file mode 100644 index 0000000..0417a47 Binary files /dev/null and b/Files/BmpStitch/bin/BmpStitch.exe differ diff --git a/Files/BmpStitch/bin/BmpStitch.pdb b/Files/BmpStitch/bin/BmpStitch.pdb new file mode 100644 index 0000000..99e5493 Binary files /dev/null and b/Files/BmpStitch/bin/BmpStitch.pdb differ diff --git a/Files/BmpStitch/obj/Debug/BmpStitch.ClipPictureBox.resources b/Files/BmpStitch/obj/Debug/BmpStitch.ClipPictureBox.resources new file mode 100644 index 0000000..4e892e6 Binary files /dev/null and b/Files/BmpStitch/obj/Debug/BmpStitch.ClipPictureBox.resources differ diff --git a/Files/BmpStitch/obj/Debug/BmpStitch.Form1.resources b/Files/BmpStitch/obj/Debug/BmpStitch.Form1.resources new file mode 100644 index 0000000..497b146 Binary files /dev/null and b/Files/BmpStitch/obj/Debug/BmpStitch.Form1.resources differ diff --git a/Files/BmpStitch/obj/Debug/BmpStitch.exe b/Files/BmpStitch/obj/Debug/BmpStitch.exe new file mode 100644 index 0000000..0417a47 Binary files /dev/null and b/Files/BmpStitch/obj/Debug/BmpStitch.exe differ diff --git a/Files/BmpStitch/obj/Debug/BmpStitch.pdb b/Files/BmpStitch/obj/Debug/BmpStitch.pdb new file mode 100644 index 0000000..99e5493 Binary files /dev/null and b/Files/BmpStitch/obj/Debug/BmpStitch.pdb differ diff --git a/Files/CellularAutomata/AssemblyInfo.vb b/Files/CellularAutomata/AssemblyInfo.vb new file mode 100644 index 0000000..a114868 --- /dev/null +++ b/Files/CellularAutomata/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/CellularAutomata/CellularAutomata.sln b/Files/CellularAutomata/CellularAutomata.sln new file mode 100644 index 0000000..31fd5cc --- /dev/null +++ b/Files/CellularAutomata/CellularAutomata.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CellularAutomata", "CellularAutomata.vbproj", "{0E000491-42F9-434A-8FFF-2E88DD39F159}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Debug.ActiveCfg = Debug|.NET + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Debug.Build.0 = Debug|.NET + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Release.ActiveCfg = Release|.NET + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/CellularAutomata/CellularAutomata.suo b/Files/CellularAutomata/CellularAutomata.suo new file mode 100644 index 0000000..8e9114e Binary files /dev/null and b/Files/CellularAutomata/CellularAutomata.suo differ diff --git a/Files/CellularAutomata/CellularAutomata.vb b/Files/CellularAutomata/CellularAutomata.vb new file mode 100644 index 0000000..5370d00 --- /dev/null +++ b/Files/CellularAutomata/CellularAutomata.vb @@ -0,0 +1,211 @@ +Imports System.Drawing.Drawing2D + +Namespace CellularAutomata + + Public MustInherit Class CellularAutomataGame + + Private oHRT As HighResTimer + Private FGenerationCount As Integer + + Protected FCtl As Control + Protected FCells As ArrayList + Protected oRand As Random + Protected FRows As Integer = 16 + Protected FCols As Integer = 16 + + Public Sub New(ByVal oCtl As Control) + MyBase.New() + FCtl = oCtl + + AddHandler FCtl.Paint, AddressOf ControlPaint + AddHandler FCtl.Resize, AddressOf ControlResize + AddHandler FCtl.MouseDown, AddressOf ControlMouseDown + + oRand = New Random + oHRT = New HighResTimer + + CreateData() + FCtl.Invalidate() + End Sub + + Private FCellRadius As Integer = 8 + Property CellRadius() As Integer + Get + Return FCellRadius + End Get + Set(ByVal Value As Integer) + FCellRadius = Value + CreateData() + End Set + End Property + + ReadOnly Property GenerationCount() As Integer + Get + Return FGenerationCount + End Get + End Property + + Protected Function HalfTheTime() As Boolean + Return oRand.Next(0, Int16.MaxValue) Mod 2 = 0 + End Function + + Private Sub CreateData() + + Dim oC As CellularAutomataCell + Dim iRow As Integer = 0 + Dim iCol As Integer + Dim oPt As Point + + FCells = New ArrayList + Do + iCol = 0 + Do + oPt = New Point(iCol * CellRadius, iRow * CellRadius) + oC = Me.CreateOneCell(oPt) + FCells.Add(oC) + + iCol += 1 + Loop Until iCol * CellRadius > FCtl.Width + iRow += 1 + + Loop Until (iRow * CellRadius) > FCtl.Height + + FRows = iRow + FCols = iCol + FGenerationCount = 0 + + Debug.Assert(FRows * FCols = FCells.Count) + End Sub + + Protected MustOverride Function CreateOneCell(ByVal FPos As Point) As CellularAutomataCell + + Private Sub ControlPaint(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) + + Dim oC As CellularAutomataCell + For Each oC In FCells + oC.Draw(e.Graphics) + Next + End Sub + + Private Sub ControlMouseDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.MouseEventArgs) + + Dim oC As CellularAutomataCell + + For Each oC In FCells + If oC.ClientRectangle.Contains(e.X, e.Y) Then + If e.Button = MouseButtons.Left Then + oC.OnMouseDown(e) + FCtl.Invalidate() + Exit Sub + End If + End If + Next + + + End Sub + + Private Sub ControlResize(ByVal sender As Object, _ + ByVal eventargs As System.EventArgs) + + CreateData() + FCtl.Invalidate() + End Sub + + Dim FTimerTicksElapsed As Long + ReadOnly Property TimerTicksElapsed() As Long + Get + Return FTimerTicksElapsed + End Get + End Property + + Public Sub Tick() + + Try + oHRT.StartTimer() + RunAGeneration() + FGenerationCount += 1 + Finally + FTimerTicksElapsed = oHRT.EndTimer() + FCtl.Invalidate() 'don't want paint time included in timings, just processing time + End Try + + End Sub + + Protected MustOverride Sub RunAGeneration() + + Protected Sub IndexToRowCol(ByVal i As Integer, ByRef iRow As Integer, ByRef iCol As Integer) + iRow = i \ FCols + iCol = i Mod FCols + End Sub + + Protected Function RowColToCell(ByVal iRow As Integer, ByVal iCol As Integer, _ + Optional ByVal bWrap As Boolean = False) As CellularAutomataCell + + If Not bWrap Then + If iRow < 0 Then Return Nothing + If iRow >= FRows Then Return Nothing + If iCol < 0 Then Return Nothing + If iCol >= FCols Then Return Nothing + Else + If iRow < 0 Then iRow = FRows + If iRow >= FRows Then iRow = 0 + If iCol < 0 Then iCol = FCols + If iCol >= FCols Then iCol = 0 + End If + + Return FCells((iRow * FCols) + iCol) + End Function + + End Class + + Public MustInherit Class CellularAutomataCell + + Private FRadius As Integer + Private FDrawRad As Integer + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New() + FPos = oPos + FRadius = r + + FDrawRad = FRadius - 2 + End Sub + + Private FPos As Point + ReadOnly Property Position() As Point + Get + Return FPos + End Get + End Property + + ReadOnly Property Radius() As Integer + Get + Return FRadius + End Get + End Property + + Public Sub Draw(ByVal g As Graphics) + + Dim r As Rectangle + Dim b As Brush + + r = New Rectangle(FPos.X, FPos.Y, FDrawRad, FDrawRad) + b = New SolidBrush(Me.GetColor) + g.FillRectangle(b, r) + + End Sub + + ReadOnly Property ClientRectangle() As Rectangle + Get + Return New Rectangle(FPos.X, FPos.Y, FRadius, FRadius) + End Get + End Property + + Public MustOverride Function GetColor() As Color + Public MustOverride Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/CellularAutomata/CellularAutomata.vbproj b/Files/CellularAutomata/CellularAutomata.vbproj new file mode 100644 index 0000000..2b789a6 --- /dev/null +++ b/Files/CellularAutomata/CellularAutomata.vbproj @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/CellularAutomata/CellularAutomata.vbproj.user b/Files/CellularAutomata/CellularAutomata.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Files/CellularAutomata/CellularAutomata.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/CellularAutomata/ConwaysLife.vb b/Files/CellularAutomata/ConwaysLife.vb new file mode 100644 index 0000000..c0455b0 --- /dev/null +++ b/Files/CellularAutomata/ConwaysLife.vb @@ -0,0 +1,161 @@ + +Namespace CellularAutomata + + Public Class ConwaysLife + Inherits CellularAutomataGame + + Private fSetupNeighbors As Boolean + + Public Sub New(ByVal oCtl As Control) + MyBase.New(oCtl) + End Sub + + Protected Overrides Function CreateOneCell(ByVal oPos As Point) As CellularAutomataCell + + Dim oC As ConwaysLifeCell + + fSetupNeighbors = False 'if we're creating new cells, then neighbors not setup + + oC = New ConwaysLifeCell(oPos, Me.CellRadius) + oC.Alive = oRand.Next(0, Int32.MaxValue) Mod 5 = 0 + Return oC + + End Function + + Protected Overrides Sub RunAGeneration() + + Dim oC As ConwaysLifeCell + + If Not fSetupNeighbors Then + SetupNeighbors() + End If + + 'must be done in 3 separate passes, as one action could affect the other + 'clear neighbor count + For Each oC In FCells + oC.PreCountReset() + Next + + 'if I'm alive, updated neighbor count on all 8 neighbors + For Each oC In FCells + oC.UpdateNeighborsBasedOnMe() + Next + + For Each oC In FCells + oC.UpdateAliveBasedonNeighbors() + Next + End Sub + + 'each cell has an arraylist that points to neighboring cells. Set this up now. + Private Sub SetupNeighbors() + + Dim i As Integer + Dim iRow, iCol As Integer 'loop variables + Dim iLRow, iLCol As Integer 'loop variables + Dim oCn As ConwaysLifeCell + + Dim oC As ConwaysLifeCell + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + oC.ClearNeighbors() + IndexToRowCol(i, iRow, iCol) + + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing, same cell + Else + oCn = RowColToCell(iRow + iLRow, iCol + iLCol) + If Not (oCn Is Nothing) Then + oC.AddNeighbor(oCn) + End If + End If + Next + Next + Next + + fSetupNeighbors = True + + End Sub + + + End Class + + Public Class ConwaysLifeCell + Inherits CellularAutomataCell + + 'pointers to eight neighbors + Protected FNeighbors As ArrayList 'up to 8 neighbors, doesn't matter where they are + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New(oPos, r) + End Sub + + Overrides Function GetColor() As Color + Return IIf(Not Alive, Color.Black, Color.Yellow) + End Function + + Private FAlive As Boolean = False + Property Alive() As Boolean + Get + Return FAlive + End Get + Set(ByVal Value As Boolean) + FAlive = Value + End Set + End Property + + Private FNeighborCount As Integer + Property NeighborCount() As Integer + Get + Return FNeighborCount + End Get + Set(ByVal Value As Integer) + FNeighborCount = Value + End Set + End Property + + Public Sub ClearNeighbors() + FNeighbors = New ArrayList + End Sub + + Public Sub AddNeighbor(ByVal oC As ConwaysLifeCell) + If FNeighbors Is Nothing Then + FNeighbors = New ArrayList + End If + + FNeighbors.Add(oC) 'pointer + End Sub + + Public Overridable Sub PreCountReset() + NeighborCount = 0 + End Sub + + Public Overridable Sub UpdateAliveBasedonNeighbors() + If Not Alive Then + 'not alive now, comes to life if 3 neighbors + Alive = (NeighborCount = 3) + Else + 'alive now, stays alive w/ 2 or 3 neighbors + Alive = (NeighborCount = 2 Or NeighborCount = 3) + End If + End Sub + + Public Overridable Sub UpdateNeighborsBasedOnMe() + + Dim oC As ConwaysLifeCell + + If Me.Alive Then + For Each oC In FNeighbors + oC.NeighborCount += 1 + Next + End If + End Sub + + Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + Me.Alive = Not Me.Alive + End Sub + + End Class + +End Namespace diff --git a/Files/CellularAutomata/HighResTimer.vb b/Files/CellularAutomata/HighResTimer.vb new file mode 100644 index 0000000..a4e69ce --- /dev/null +++ b/Files/CellularAutomata/HighResTimer.vb @@ -0,0 +1,29 @@ +Public Class HighResTimer + + Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef X As Long) As Short + Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef X As Long) As Short + + Private i1 As Long + Private i2 As Long + Private iFreq As Long + + Public Sub New() + + If QueryPerformanceCounter(i1) Then ' Begin timing. + QueryPerformanceFrequency(iFreq) + Else + Throw New ApplicationException("High Res timing not supported") + End If + + End Sub + + Public Sub StartTimer() + QueryPerformanceCounter(i1) 'begin timing + End Sub + + Public Function EndTimer() As Long + QueryPerformanceCounter(i2) + Return i2 - i1 + End Function + +End Class diff --git a/Files/CellularAutomata/RainbowLife.vb b/Files/CellularAutomata/RainbowLife.vb new file mode 100644 index 0000000..fa74449 --- /dev/null +++ b/Files/CellularAutomata/RainbowLife.vb @@ -0,0 +1,117 @@ +Namespace CellularAutomata + + Public Class RainbowLife + Inherits ConwaysLife + + Public Sub New(ByVal oCtl As Control) + MyBase.New(oCtl) + End Sub + + Protected Overrides Function CreateOneCell(ByVal oPos As Point) As CellularAutomataCell + + Dim oC As RainbowLifeCell + + oC = New RainbowLifeCell(oPos, Me.CellRadius) + If oRand.Next(0, Int32.MaxValue) Mod 5 = 0 Then + oC.Alive = True + oC.SetRandomColor() + End If + + Return oC + + End Function + + End Class + + Public Class RainbowLifeCell + Inherits ConwaysLifeCell + + Private Shared oRand As New Random + + Private FNeighborRTot As Integer + Private FNeighborGTot As Integer + Private FNeighborBTot As Integer + Private FColor As Color + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New(oPos, r) + End Sub + + Overrides Function GetColor() As Color + Return IIf(Not Alive, Color.Black, FColor) + End Function + + Private Sub SetColor(ByVal c As Color) + FColor = c + End Sub + + Public Overrides Sub PreCountReset() + MyBase.PreCountReset() + FNeighborRTot = 0 + FNeighborGTot = 0 + FNeighborBTot = 0 + End Sub + + Public Overrides Sub UpdateNeighborsBasedOnMe() + + Dim oC As RainbowLifeCell + + If Me.Alive Then + For Each oC In FNeighbors + oC.NeighborCount += 1 + + oC.FNeighborRTot += Me.GetColor.R + oC.FNeighborGTot += Me.GetColor.G + oC.FNeighborBTot += Me.GetColor.B + Next + End If + End Sub + + + Public Overrides Sub UpdateAliveBasedonNeighbors() + + Dim oC As ConwaysLifeCell + + If Not Alive Then + If NeighborCount = 3 Then + Alive = True + Me.SetColor(Color.FromArgb(FNeighborRTot \ 3, FNeighborGTot \ 3, FNeighborBTot \ 3)) + End If + Else + 'alive now, stays alive w/ 2 or 3 neighbors + Alive = (NeighborCount = 2 Or NeighborCount = 3) + End If + End Sub + + Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + If Me.Alive Then + Me.Alive = False + Else + Me.Alive = True + SetRandomColor() + End If + End Sub + + 'totally random rgbs gives muddy colors + Public Sub SetRandomColor() + + Dim c As Color + + Select Case oRand.Next(0, Int32.MaxValue) Mod 10 + Case 0 : c = Color.Yellow + Case 1 : c = Color.Green + Case 2 : c = Color.Blue + Case 3 : c = Color.Red + Case 4, 5 : c = Color.White + Case 6 : c = Color.Orange + Case 7 : c = Color.Violet + Case 8 : c = Color.DarkBlue + Case 9 : c = Color.Magenta + End Select + Me.SetColor(c) + + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/CellularAutomata/Voting.vb b/Files/CellularAutomata/Voting.vb new file mode 100644 index 0000000..01861d5 --- /dev/null +++ b/Files/CellularAutomata/Voting.vb @@ -0,0 +1,121 @@ +Namespace CellularAutomata + + Public Class TheVotingGame + Inherits CellularAutomataGame + + Private fSetupNeighbors As Boolean + + Public Sub New(ByVal oCtl As Control) + MyBase.New(oCtl) + End Sub + + Protected Overrides Function CreateOneCell(ByVal oPos As Point) As CellularAutomataCell + + Dim oC As VotingCell + + fSetupNeighbors = False 'if we're creating new cells, then neighbors not setup + + oC = New VotingCell(oPos, Me.CellRadius) + oC.IsDemocrat = HalfTheTime() + Return oC + + End Function + + Protected Overrides Sub RunAGeneration() + + Dim oC As VotingCell + + If Not fSetupNeighbors Then + SetupNeighbors() + End If + + 'choose a random neighbor + oC = fCells.Item(oRand.Next(0, fcells.Count)) + oC.ChangePartyAffiliation() + + End Sub + + 'each cell has an arraylist that points to neighboring cells. Set this up now. + Private Sub SetupNeighbors() + + Dim i As Integer + Dim iRow, iCol As Integer 'loop variables + Dim iLRow, iLCol As Integer 'loop variables + Dim oCn As VotingCell + Dim oC As VotingCell + + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + IndexToRowCol(i, iRow, iCol) + + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing, same cell + Else + 'wrap around to other side + oCn = RowColToCell(iRow + iLRow, iCol + iLCol, bWrap:=True) + If Not (oCn Is Nothing) Then + oC.AddNeighbor(oCn) + End If + End If + Next + Next + Next + + fSetupNeighbors = True + + End Sub + + End Class + + Public Class VotingCell + Inherits CellularAutomataCell + + Private Shared oRand As New Random + + 'pointers to eight neighbors + Protected FNeighbors As ArrayList 'up to 8 neighbors, doesn't matter where they are + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New(oPos, r) + End Sub + + Overrides Function GetColor() As Color + Return IIf(Not FDemocrat, Color.Blue, Color.Red) + End Function + + Private FDemocrat As Boolean = False + Property IsDemocrat() As Boolean + Get + Return FDemocrat + End Get + Set(ByVal Value As Boolean) + FDemocrat = Value + End Set + End Property + + Public Sub AddNeighbor(ByVal oC As VotingCell) + If FNeighbors Is Nothing Then + FNeighbors = New ArrayList + End If + + FNeighbors.Add(oC) 'pointer + End Sub + + Public Sub ChangePartyAffiliation() + + Dim oC As VotingCell + + oC = FNeighbors.Item(oRand.Next(0, FNeighbors.Count)) + Me.IsDemocrat = oC.IsDemocrat + + End Sub + + Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + Me.IsDemocrat = Not Me.IsDemocrat + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/CellularAutomata/bin/Automata.exe b/Files/CellularAutomata/bin/Automata.exe new file mode 100644 index 0000000..65eb115 Binary files /dev/null and b/Files/CellularAutomata/bin/Automata.exe differ diff --git a/Files/CellularAutomata/bin/Automata.pdb b/Files/CellularAutomata/bin/Automata.pdb new file mode 100644 index 0000000..2a4572d Binary files /dev/null and b/Files/CellularAutomata/bin/Automata.pdb differ diff --git a/Files/CellularAutomata/fLife.resx b/Files/CellularAutomata/fLife.resx new file mode 100644 index 0000000..7d19115 --- /dev/null +++ b/Files/CellularAutomata/fLife.resx @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + True + + + Assembly + + + 8, 8 + + + True + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + fLife + + + True + + + 25 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/CellularAutomata/fLife.vb b/Files/CellularAutomata/fLife.vb new file mode 100644 index 0000000..b9cbc2a --- /dev/null +++ b/Files/CellularAutomata/fLife.vb @@ -0,0 +1,239 @@ +Public Class fLife + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents aTimer As System.Windows.Forms.Timer + Friend WithEvents pnBottom As System.Windows.Forms.Panel + Friend WithEvents cbGo As System.Windows.Forms.Button + Friend WithEvents lbTime As System.Windows.Forms.Label + Friend WithEvents cbSingle As System.Windows.Forms.Button + Friend WithEvents lbGen As System.Windows.Forms.Label + Friend WithEvents lbT As System.Windows.Forms.Label + Friend WithEvents lbG As System.Windows.Forms.Label + Friend WithEvents rbGame0 As System.Windows.Forms.RadioButton + Friend WithEvents rbGame1 As System.Windows.Forms.RadioButton + Friend WithEvents rbGame2 As System.Windows.Forms.RadioButton + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.aTimer = New System.Windows.Forms.Timer(Me.components) + Me.pnBottom = New System.Windows.Forms.Panel + Me.rbGame2 = New System.Windows.Forms.RadioButton + Me.rbGame1 = New System.Windows.Forms.RadioButton + Me.rbGame0 = New System.Windows.Forms.RadioButton + Me.lbG = New System.Windows.Forms.Label + Me.lbT = New System.Windows.Forms.Label + Me.lbGen = New System.Windows.Forms.Label + Me.cbGo = New System.Windows.Forms.Button + Me.lbTime = New System.Windows.Forms.Label + Me.cbSingle = New System.Windows.Forms.Button + Me.pnBottom.SuspendLayout() + Me.SuspendLayout() + ' + 'aTimer + ' + Me.aTimer.Interval = 10 + ' + 'pnBottom + ' + Me.pnBottom.Controls.Add(Me.rbGame2) + Me.pnBottom.Controls.Add(Me.rbGame1) + Me.pnBottom.Controls.Add(Me.rbGame0) + Me.pnBottom.Controls.Add(Me.lbG) + Me.pnBottom.Controls.Add(Me.lbT) + Me.pnBottom.Controls.Add(Me.lbGen) + Me.pnBottom.Controls.Add(Me.cbGo) + Me.pnBottom.Controls.Add(Me.lbTime) + Me.pnBottom.Controls.Add(Me.cbSingle) + Me.pnBottom.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pnBottom.Location = New System.Drawing.Point(0, 253) + Me.pnBottom.Name = "pnBottom" + Me.pnBottom.Size = New System.Drawing.Size(536, 72) + Me.pnBottom.TabIndex = 5 + ' + 'rbGame2 + ' + Me.rbGame2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rbGame2.Location = New System.Drawing.Point(408, 48) + Me.rbGame2.Name = "rbGame2" + Me.rbGame2.Size = New System.Drawing.Size(120, 16) + Me.rbGame2.TabIndex = 13 + Me.rbGame2.Text = "The Voting Game" + ' + 'rbGame1 + ' + Me.rbGame1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rbGame1.Location = New System.Drawing.Point(408, 32) + Me.rbGame1.Name = "rbGame1" + Me.rbGame1.Size = New System.Drawing.Size(120, 16) + Me.rbGame1.TabIndex = 12 + Me.rbGame1.Text = "Color Life" + ' + 'rbGame0 + ' + Me.rbGame0.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rbGame0.Checked = True + Me.rbGame0.Location = New System.Drawing.Point(408, 16) + Me.rbGame0.Name = "rbGame0" + Me.rbGame0.Size = New System.Drawing.Size(120, 16) + Me.rbGame0.TabIndex = 11 + Me.rbGame0.TabStop = True + Me.rbGame0.Text = "Conway's Life" + ' + 'lbG + ' + Me.lbG.Location = New System.Drawing.Point(96, 32) + Me.lbG.Name = "lbG" + Me.lbG.Size = New System.Drawing.Size(72, 16) + Me.lbG.TabIndex = 9 + Me.lbG.Text = "Generations:" + Me.lbG.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lbT + ' + Me.lbT.Location = New System.Drawing.Point(128, 16) + Me.lbT.Name = "lbT" + Me.lbT.Size = New System.Drawing.Size(40, 16) + Me.lbT.TabIndex = 8 + Me.lbT.Text = "Ticks:" + Me.lbT.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lbGen + ' + Me.lbGen.Location = New System.Drawing.Point(168, 32) + Me.lbGen.Name = "lbGen" + Me.lbGen.Size = New System.Drawing.Size(136, 16) + Me.lbGen.TabIndex = 7 + ' + 'cbGo + ' + Me.cbGo.Location = New System.Drawing.Point(8, 8) + Me.cbGo.Name = "cbGo" + Me.cbGo.TabIndex = 0 + Me.cbGo.Text = "Go" + ' + 'lbTime + ' + Me.lbTime.Location = New System.Drawing.Point(168, 16) + Me.lbTime.Name = "lbTime" + Me.lbTime.Size = New System.Drawing.Size(136, 16) + Me.lbTime.TabIndex = 6 + ' + 'cbSingle + ' + Me.cbSingle.Location = New System.Drawing.Point(8, 40) + Me.cbSingle.Name = "cbSingle" + Me.cbSingle.TabIndex = 1 + Me.cbSingle.Text = "Single Step" + ' + 'fLife + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(536, 325) + Me.Controls.Add(Me.pnBottom) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "fLife" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Cellular Automata" + Me.pnBottom.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private oP As FlickerFreePanel + Private oCell As CellularAutomata.CellularAutomataGame + + Private Sub Form1_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + oP = New FlickerFreePanel + + oP.Dock = DockStyle.Fill + Me.Controls.Add(oP) + + CreateGame() + + End Sub + + Private Sub RunOne(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles aTimer.Tick, cbSingle.Click + + oCell.Tick() + lbTime.Text = oCell.TimerTicksElapsed + lbGen.Text = oCell.GenerationCount + + End Sub + + Private Sub cbGo_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGo.Click + + If aTimer.Enabled Then + aTimer.Enabled = False + cbGo.Text = "Go" + rbGame0.Enabled = True + rbGame1.Enabled = True + rbGame2.Enabled = True + Else + aTimer.Enabled = True + cbGo.Text = "Stop" + rbGame0.Enabled = False + rbGame1.Enabled = False + rbGame2.Enabled = False + End If + + End Sub + + Private Sub CreateGame() + + If rbGame0.Checked Then + oCell = New CellularAutomata.ConwaysLife(oP) + oCell.CellRadius = 8 + ElseIf rbGame1.Checked Then + oCell = New CellularAutomata.RainbowLife(oP) + oCell.CellRadius = 8 + Else + oCell = New CellularAutomata.TheVotingGame(oP) + oCell.CellRadius = 32 + End If + + End Sub + + Private Sub rbGame_CheckedChanged(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles rbGame0.CheckedChanged, _ + rbGame1.CheckedChanged, rbGame2.CheckedChanged + + If oP Is Nothing Then Exit Sub + + CreateGame() + End Sub + +End Class + diff --git a/Files/CellularAutomata/obj/Debug/Automata.FlickerFreePanel.resources b/Files/CellularAutomata/obj/Debug/Automata.FlickerFreePanel.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Automata.FlickerFreePanel.resources differ diff --git a/Files/CellularAutomata/obj/Debug/Automata.exe b/Files/CellularAutomata/obj/Debug/Automata.exe new file mode 100644 index 0000000..65eb115 Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Automata.exe differ diff --git a/Files/CellularAutomata/obj/Debug/Automata.fLife.resources b/Files/CellularAutomata/obj/Debug/Automata.fLife.resources new file mode 100644 index 0000000..3fce162 Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Automata.fLife.resources differ diff --git a/Files/CellularAutomata/obj/Debug/Automata.pdb b/Files/CellularAutomata/obj/Debug/Automata.pdb new file mode 100644 index 0000000..2a4572d Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Automata.pdb differ diff --git a/Files/CellularAutomata/obj/Debug/Life.LifePanel.resources b/Files/CellularAutomata/obj/Debug/Life.LifePanel.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Life.LifePanel.resources differ diff --git a/Files/CellularAutomata/obj/Debug/Life.exe b/Files/CellularAutomata/obj/Debug/Life.exe new file mode 100644 index 0000000..20c46c3 Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Life.exe differ diff --git a/Files/CellularAutomata/obj/Debug/Life.pdb b/Files/CellularAutomata/obj/Debug/Life.pdb new file mode 100644 index 0000000..1c1bc1d Binary files /dev/null and b/Files/CellularAutomata/obj/Debug/Life.pdb differ diff --git a/Files/CellularAutomata/old/LifeClasses.resx b/Files/CellularAutomata/old/LifeClasses.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/Files/CellularAutomata/old/LifeClasses.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/CellularAutomata/old/LifeClasses.vb b/Files/CellularAutomata/old/LifeClasses.vb new file mode 100644 index 0000000..f704b7e --- /dev/null +++ b/Files/CellularAutomata/old/LifeClasses.vb @@ -0,0 +1,312 @@ +Imports System.Drawing.Drawing2D + +Public MustInherit Class CellularAutomataPanel + Inherits System.Windows.Forms.Panel + + Protected FCells As ArrayList + Private FRows As Integer + Private FCols As Integer + + Private oRand As Random + + Property Rows() + Get + Return FRows + End Get + Set(ByVal Value) + FRows = Value + End Set + End Property + + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + oRand = New Random + CreateData() + End Sub + + Function HalfTheTime() As Boolean + Return oRand.Next(0, Int16.MaxValue) Mod 2 = 0 + End Function + + Private FCellRadius As Integer = 8 + Property CellRadius() As Integer + Get + Return FCellRadius + End Get + Set(ByVal Value As Integer) + FCellRadius = Value + CreateData() + Me.Invalidate() + End Set + End Property + + Private Sub CreateData() + + Dim oC As LifeCell + Dim iRow As Integer = 0 + Dim iCol As Integer + + FCells = New ArrayList + Do + iCol = 0 + Do + oC = New LifeCell(Me) + With oC + .Position = New Point(iCol * CellRadius, iRow * CellRadius) + .Alive = oRand.Next(0, 1000) Mod 5 = 0 + End With + FCells.Add(oC) + + iCol += 1 + Loop Until iCol * CellRadius > Me.Width + iRow += 1 + + Loop Until (iRow * CellRadius) > Me.Height + + FRows = iRow + FCols = iCol + + Debug.Assert(FRows * FCols = FCells.Count) + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + Draw(e.Graphics) + End Sub + + Protected Overrides Sub OnResize(ByVal eventargs As System.EventArgs) + MyBase.OnResize(eventargs) + Call CreateData() + Me.Invalidate() + End Sub + + Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + MyBase.OnMouseDown(e) + + Dim oC As LifeCell + + For Each oC In FCells + If oC.ClientRectangle.Contains(e.X, e.Y) Then + If e.Button = MouseButtons.Left Then + oC.Alive = Not oC.Alive + Me.Invalidate() + Exit Sub + End If + If e.Button = MouseButtons.Right Then + MsgBox("neighbors:" & oC.Neighbors) + End If + End If + Next + + End Sub + + + Private Sub Draw(ByVal g As Graphics) + + Dim oC As LifeCell + For Each oC In FCells + oC.Draw(g) + Next + + End Sub + + Private Sub IndextoRowCol(ByVal i As Integer, ByRef iRow As Integer, ByRef iCol As Integer) + iRow = i \ FCols + iCol = i Mod FCols + End Sub + + Private Function CellAt(ByVal iRow As Integer, ByVal iCol As Integer) As LifeCell + + If iRow < 0 Then Return Nothing + If iRow >= FRows Then Return Nothing + If iCol < 0 Then Return Nothing + If iCol >= FCols Then Return Nothing + + Return FCells((iRow * FCols) + iCol) + End Function + + Public Sub NextGeneration() + + Dim i As Integer + Dim iRow, iCol As Integer + Dim iLRow, iLCol As Integer 'loop variables + Dim oC, oCn As LifeCell + Dim oHRT As HighResTimer + + oHRT = New HighResTimer + oHRT.StartTimer() + + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + oC.Neighbors = 0 + IndextoRowCol(i, iRow, iCol) + + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing + Else + oCn = CellAt(iRow + iLRow, iCol + iLCol) + If Not (oCn Is Nothing) Then + If oCn.Alive Then + oC.Neighbors += 1 + End If + End If + End If + Next + Next + Next + + 'have to do this in two passes, or changing a cell mid-pass would affect neighbors + For Each oC In FCells + oC.LiveToSeeAnotherDay() + Next + + FTicksElapsed = oHRT.EndTimer() + Me.Invalidate() + End Sub + + Public Sub NextGeneration2() + + Dim i As Integer + Dim iRow, iCol As Integer + Dim iLRow, iLCol As Integer 'loop variables + Dim oC, oCn As LifeCell + Dim oHRT As HighResTimer + + oHRT = New HighResTimer + oHRT.StartTimer() + + 'clear + For Each oC In FCells + oC.Neighbors = 0 + Next + + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + IndextoRowCol(i, iRow, iCol) + + If oC.Alive Then + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing + Else + oCn = CellAt(iRow + iLRow, iCol + iLCol) + If Not (oCn Is Nothing) Then + oCn.Neighbors += 1 + End If + End If + Next + Next + + End If + Next + + 'have to do this in two passes, or changing a cell mid-pass would affect neighbors + For Each oC In FCells + oC.LiveToSeeAnotherDay() + Next + + FTicksElapsed = oHRT.EndTimer() + Me.Invalidate() + End Sub + + Dim FTicksElapsed As Long + ReadOnly Property TicksElapsed() As Long + Get + Return FTicksElapsed + End Get + End Property + + Private Class LifeCell + + Private FPan As LifePanel + + Public Sub New(ByVal lp As LifePanel) + MyBase.new() + FPan = lp + End Sub + + Private FAlive As Boolean = False + Property Alive() As Boolean + Get + Return FAlive + End Get + Set(ByVal Value As Boolean) + FAlive = Value + End Set + End Property + + Private FNeighbors As Integer + Property Neighbors() As Integer + Get + Return FNeighbors + End Get + Set(ByVal Value As Integer) + FNeighbors = Value + End Set + End Property + + Private fPos As Point + Property Position() As Point + Get + Return fPos + End Get + Set(ByVal Value As Point) + fPos = Value + End Set + End Property + + Public Overridable Sub Draw(ByVal g As Graphics) + + Dim ogc As GraphicsContainer + Dim iRad As Integer + Dim r As Rectangle + Dim b As Brush + + iRad = FPan.CellRadius - 2 + r = New Rectangle(1, 1, iRad, iRad) + If Me.Alive Then + b = Brushes.Yellow + Else + b = Brushes.Black + End If + + ogc = g.BeginContainer + Try + g.TranslateTransform(fPos.X, fPos.Y) + g.FillRectangle(b, r) + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Public Sub LiveToSeeAnotherDay() + If Not Alive Then + 'not alive now, comes to life if 3 neighbors + Alive = (Neighbors = 3) + Else + 'alive now, stays alive w/ 2 or 3 neighbors + Alive = (Neighbors = 2 Or Neighbors = 3) + End If + End Sub + + ReadOnly Property ClientRectangle() As Rectangle + Get + Return New Rectangle(fPos.X, fPos.Y, FPan.CellRadius, FPan.CellRadius) + End Get + End Property + + End Class + +End Class + diff --git a/Files/CellularAutomataWithSave/AssemblyInfo.vb b/Files/CellularAutomataWithSave/AssemblyInfo.vb new file mode 100644 index 0000000..a114868 --- /dev/null +++ b/Files/CellularAutomataWithSave/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/CellularAutomataWithSave/CellularAutomata.sln b/Files/CellularAutomataWithSave/CellularAutomata.sln new file mode 100644 index 0000000..31fd5cc --- /dev/null +++ b/Files/CellularAutomataWithSave/CellularAutomata.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CellularAutomata", "CellularAutomata.vbproj", "{0E000491-42F9-434A-8FFF-2E88DD39F159}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Debug.ActiveCfg = Debug|.NET + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Debug.Build.0 = Debug|.NET + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Release.ActiveCfg = Release|.NET + {0E000491-42F9-434A-8FFF-2E88DD39F159}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/CellularAutomataWithSave/CellularAutomata.suo b/Files/CellularAutomataWithSave/CellularAutomata.suo new file mode 100644 index 0000000..d1cb29d Binary files /dev/null and b/Files/CellularAutomataWithSave/CellularAutomata.suo differ diff --git a/Files/CellularAutomataWithSave/CellularAutomata.vb b/Files/CellularAutomataWithSave/CellularAutomata.vb new file mode 100644 index 0000000..80c1664 --- /dev/null +++ b/Files/CellularAutomataWithSave/CellularAutomata.vb @@ -0,0 +1,251 @@ +Imports System.Drawing.Drawing2D +Imports System.IO +Imports System.Runtime.Serialization.Formatters.Binary +Imports System.Runtime.Serialization.Formatters.Soap + +Namespace CellularAutomata + + Public MustInherit Class CellularAutomataGame + + Private oHRT As HighResTimer + Private FGenerationCount As Integer + + Protected FCtl As Control + Protected FCells As ArrayList + Protected oRand As Random + Protected FRows As Integer = 16 + Protected FCols As Integer = 16 + + Public Sub New(ByVal oCtl As Control) + MyBase.New() + FCtl = oCtl + + AddHandler FCtl.Paint, AddressOf ControlPaint + AddHandler FCtl.Resize, AddressOf ControlResize + AddHandler FCtl.MouseDown, AddressOf ControlMouseDown + + oRand = New Random + oHRT = New HighResTimer + + CreateData() + FCtl.Invalidate() + End Sub + + Private FCellRadius As Integer = 8 + Property CellRadius() As Integer + Get + Return FCellRadius + End Get + Set(ByVal Value As Integer) + FCellRadius = Value + CreateData() + End Set + End Property + + ReadOnly Property GenerationCount() As Integer + Get + Return FGenerationCount + End Get + End Property + + Protected Function HalfTheTime() As Boolean + Return oRand.Next(0, Int16.MaxValue) Mod 2 = 0 + End Function + + Private Sub CreateData() + + Dim oC As CellularAutomataCell + Dim iRow As Integer = 0 + Dim iCol As Integer + Dim oPt As Point + + FCells = New ArrayList + Do + iCol = 0 + Do + oPt = New Point(iCol * CellRadius, iRow * CellRadius) + oC = Me.CreateOneCell(oPt) + FCells.Add(oC) + + iCol += 1 + Loop Until iCol * CellRadius > FCtl.Width + iRow += 1 + + Loop Until (iRow * CellRadius) > FCtl.Height + + FRows = iRow + FCols = iCol + FGenerationCount = 0 + + Debug.Assert(FRows * FCols = FCells.Count) + End Sub + + Protected MustOverride Function CreateOneCell(ByVal FPos As Point) As CellularAutomataCell + + Private Sub ControlPaint(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) + + Dim oC As CellularAutomataCell + For Each oC In FCells + oC.Draw(e.Graphics) + Next + End Sub + + Private Sub ControlMouseDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.MouseEventArgs) + + Dim oC As CellularAutomataCell + + For Each oC In FCells + If oC.ClientRectangle.Contains(e.X, e.Y) Then + If e.Button = MouseButtons.Left Then + oC.OnMouseDown(e) + FCtl.Invalidate() + Exit Sub + End If + End If + Next + + + End Sub + + Private Sub ControlResize(ByVal sender As Object, _ + ByVal eventargs As System.EventArgs) + + CreateData() + FCtl.Invalidate() + End Sub + + Dim FTimerTicksElapsed As Long + ReadOnly Property TimerTicksElapsed() As Long + Get + Return FTimerTicksElapsed + End Get + End Property + + Public Sub Tick() + + Try + oHRT.StartTimer() + RunAGeneration() + FGenerationCount += 1 + Finally + FTimerTicksElapsed = oHRT.EndTimer() + FCtl.Invalidate() 'don't want paint time included in timings, just processing time + End Try + + End Sub + + Protected MustOverride Sub RunAGeneration() + + Protected Sub IndexToRowCol(ByVal i As Integer, ByRef iRow As Integer, ByRef iCol As Integer) + iRow = i \ FCols + iCol = i Mod FCols + End Sub + + Protected Function RowColToCell(ByVal iRow As Integer, ByVal iCol As Integer, _ + Optional ByVal bWrap As Boolean = False) As CellularAutomataCell + + If Not bWrap Then + If iRow < 0 Then Return Nothing + If iRow >= FRows Then Return Nothing + If iCol < 0 Then Return Nothing + If iCol >= FCols Then Return Nothing + Else + If iRow < 0 Then iRow = FRows + If iRow >= FRows Then iRow = 0 + If iCol < 0 Then iCol = FCols + If iCol >= FCols Then iCol = 0 + End If + + Return FCells((iRow * FCols) + iCol) + End Function + + Public Sub SaveToFile(ByVal cFilename As String) + + Dim oFS As New FileStream(cFilename, FileMode.Create) + Dim oBF As New SoapFormatter + + System.Windows.Forms.Cursor.Current = Cursors.WaitCursor + + Try + oBF.Serialize(oFS, FCells) + Catch oEX As Exception + MsgBox(oEX.Message) + Finally + oFS.Close() + System.Windows.Forms.Cursor.Current = Cursors.Default + End Try + + End Sub + + Public Sub LoadFromFile(ByVal cFilename As String) + + Dim oFS As New FileStream(cFilename, FileMode.Open) + Dim oBF As New SoapFormatter + + System.Windows.Forms.Cursor.Current = Cursors.WaitCursor + + Try + FCells = CType(oBF.Deserialize(oFS), ArrayList) + Catch oEX As Exception + MsgBox(oEX.Message) + Finally + oFS.Close() + System.Windows.Forms.Cursor.Current = Cursors.Default + End Try + + End Sub + + End Class + + _ + Public MustInherit Class CellularAutomataCell + + Private FRadius As Integer + Private FDrawRad As Integer + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New() + FPos = oPos + FRadius = r + + FDrawRad = FRadius - 2 + End Sub + + Private FPos As Point + ReadOnly Property Position() As Point + Get + Return FPos + End Get + End Property + + ReadOnly Property Radius() As Integer + Get + Return FRadius + End Get + End Property + + Public Sub Draw(ByVal g As Graphics) + + Dim r As Rectangle + Dim b As Brush + + r = New Rectangle(FPos.X, FPos.Y, FDrawRad, FDrawRad) + b = New SolidBrush(Me.GetColor) + g.FillRectangle(b, r) + + End Sub + + ReadOnly Property ClientRectangle() As Rectangle + Get + Return New Rectangle(FPos.X, FPos.Y, FRadius, FRadius) + End Get + End Property + + Public MustOverride Function GetColor() As Color + Public MustOverride Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/CellularAutomataWithSave/CellularAutomata.vbproj b/Files/CellularAutomataWithSave/CellularAutomata.vbproj new file mode 100644 index 0000000..85e90a0 --- /dev/null +++ b/Files/CellularAutomataWithSave/CellularAutomata.vbproj @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/CellularAutomataWithSave/CellularAutomata.vbproj.user b/Files/CellularAutomataWithSave/CellularAutomata.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Files/CellularAutomataWithSave/CellularAutomata.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/CellularAutomataWithSave/ConwaysLife.vb b/Files/CellularAutomataWithSave/ConwaysLife.vb new file mode 100644 index 0000000..e788c60 --- /dev/null +++ b/Files/CellularAutomataWithSave/ConwaysLife.vb @@ -0,0 +1,162 @@ + +Namespace CellularAutomata + + Public Class ConwaysLife + Inherits CellularAutomataGame + + Private fSetupNeighbors As Boolean + + Public Sub New(ByVal oCtl As Control) + MyBase.New(oCtl) + End Sub + + Protected Overrides Function CreateOneCell(ByVal oPos As Point) As CellularAutomataCell + + Dim oC As ConwaysLifeCell + + fSetupNeighbors = False 'if we're creating new cells, then neighbors not setup + + oC = New ConwaysLifeCell(oPos, Me.CellRadius) + oC.Alive = oRand.Next(0, Int32.MaxValue) Mod 5 = 0 + Return oC + + End Function + + Protected Overrides Sub RunAGeneration() + + Dim oC As ConwaysLifeCell + + If Not fSetupNeighbors Then + SetupNeighbors() + End If + + 'must be done in 3 separate passes, as one action could affect the other + 'clear neighbor count + For Each oC In FCells + oC.PreCountReset() + Next + + 'if I'm alive, updated neighbor count on all 8 neighbors + For Each oC In FCells + oC.UpdateNeighborsBasedOnMe() + Next + + For Each oC In FCells + oC.UpdateAliveBasedonNeighbors() + Next + End Sub + + 'each cell has an arraylist that points to neighboring cells. Set this up now. + Private Sub SetupNeighbors() + + Dim i As Integer + Dim iRow, iCol As Integer 'loop variables + Dim iLRow, iLCol As Integer 'loop variables + Dim oCn As ConwaysLifeCell + + Dim oC As ConwaysLifeCell + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + oC.ClearNeighbors() + IndexToRowCol(i, iRow, iCol) + + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing, same cell + Else + oCn = RowColToCell(iRow + iLRow, iCol + iLCol) + If Not (oCn Is Nothing) Then + oC.AddNeighbor(oCn) + End If + End If + Next + Next + Next + + fSetupNeighbors = True + + End Sub + + + End Class + + _ + Public Class ConwaysLifeCell + Inherits CellularAutomataCell + + 'pointers to eight neighbors + Protected FNeighbors As ArrayList 'up to 8 neighbors, doesn't matter where they are + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New(oPos, r) + End Sub + + Overrides Function GetColor() As Color + Return IIf(Not Alive, Color.Black, Color.Yellow) + End Function + + Private FAlive As Boolean = False + Property Alive() As Boolean + Get + Return FAlive + End Get + Set(ByVal Value As Boolean) + FAlive = Value + End Set + End Property + + Private FNeighborCount As Integer + Property NeighborCount() As Integer + Get + Return FNeighborCount + End Get + Set(ByVal Value As Integer) + FNeighborCount = Value + End Set + End Property + + Public Sub ClearNeighbors() + FNeighbors = New ArrayList + End Sub + + Public Sub AddNeighbor(ByVal oC As ConwaysLifeCell) + If FNeighbors Is Nothing Then + FNeighbors = New ArrayList + End If + + FNeighbors.Add(oC) 'pointer + End Sub + + Public Overridable Sub PreCountReset() + NeighborCount = 0 + End Sub + + Public Overridable Sub UpdateAliveBasedonNeighbors() + If Not Alive Then + 'not alive now, comes to life if 3 neighbors + Alive = (NeighborCount = 3) + Else + 'alive now, stays alive w/ 2 or 3 neighbors + Alive = (NeighborCount = 2 Or NeighborCount = 3) + End If + End Sub + + Public Overridable Sub UpdateNeighborsBasedOnMe() + + Dim oC As ConwaysLifeCell + + If Me.Alive Then + For Each oC In FNeighbors + oC.NeighborCount += 1 + Next + End If + End Sub + + Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + Me.Alive = Not Me.Alive + End Sub + + End Class + +End Namespace diff --git a/Files/CellularAutomataWithSave/HighResTimer.vb b/Files/CellularAutomataWithSave/HighResTimer.vb new file mode 100644 index 0000000..a4e69ce --- /dev/null +++ b/Files/CellularAutomataWithSave/HighResTimer.vb @@ -0,0 +1,29 @@ +Public Class HighResTimer + + Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef X As Long) As Short + Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef X As Long) As Short + + Private i1 As Long + Private i2 As Long + Private iFreq As Long + + Public Sub New() + + If QueryPerformanceCounter(i1) Then ' Begin timing. + QueryPerformanceFrequency(iFreq) + Else + Throw New ApplicationException("High Res timing not supported") + End If + + End Sub + + Public Sub StartTimer() + QueryPerformanceCounter(i1) 'begin timing + End Sub + + Public Function EndTimer() As Long + QueryPerformanceCounter(i2) + Return i2 - i1 + End Function + +End Class diff --git a/Files/CellularAutomataWithSave/RainbowLife.vb b/Files/CellularAutomataWithSave/RainbowLife.vb new file mode 100644 index 0000000..db8aca4 --- /dev/null +++ b/Files/CellularAutomataWithSave/RainbowLife.vb @@ -0,0 +1,118 @@ +Namespace CellularAutomata + + Public Class RainbowLife + Inherits ConwaysLife + + Public Sub New(ByVal oCtl As Control) + MyBase.New(oCtl) + End Sub + + Protected Overrides Function CreateOneCell(ByVal oPos As Point) As CellularAutomataCell + + Dim oC As RainbowLifeCell + + oC = New RainbowLifeCell(oPos, Me.CellRadius) + If oRand.Next(0, Int32.MaxValue) Mod 5 = 0 Then + oC.Alive = True + oC.SetRandomColor() + End If + + Return oC + + End Function + + End Class + + _ + Public Class RainbowLifeCell + Inherits ConwaysLifeCell + + Private Shared oRand As New Random + + Private FNeighborRTot As Integer + Private FNeighborGTot As Integer + Private FNeighborBTot As Integer + Private FColor As Color + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New(oPos, r) + End Sub + + Overrides Function GetColor() As Color + Return IIf(Not Alive, Color.Black, FColor) + End Function + + Private Sub SetColor(ByVal c As Color) + FColor = c + End Sub + + Public Overrides Sub PreCountReset() + MyBase.PreCountReset() + FNeighborRTot = 0 + FNeighborGTot = 0 + FNeighborBTot = 0 + End Sub + + Public Overrides Sub UpdateNeighborsBasedOnMe() + + Dim oC As RainbowLifeCell + + If Me.Alive Then + For Each oC In FNeighbors + oC.NeighborCount += 1 + + oC.FNeighborRTot += Me.GetColor.R + oC.FNeighborGTot += Me.GetColor.G + oC.FNeighborBTot += Me.GetColor.B + Next + End If + End Sub + + + Public Overrides Sub UpdateAliveBasedonNeighbors() + + Dim oC As ConwaysLifeCell + + If Not Alive Then + If NeighborCount = 3 Then + Alive = True + Me.SetColor(Color.FromArgb(FNeighborRTot \ 3, FNeighborGTot \ 3, FNeighborBTot \ 3)) + End If + Else + 'alive now, stays alive w/ 2 or 3 neighbors + Alive = (NeighborCount = 2 Or NeighborCount = 3) + End If + End Sub + + Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + If Me.Alive Then + Me.Alive = False + Else + Me.Alive = True + SetRandomColor() + End If + End Sub + + 'totally random rgbs gives muddy colors + Public Sub SetRandomColor() + + Dim c As Color + + Select Case oRand.Next(0, Int32.MaxValue) Mod 10 + Case 0 : c = Color.Yellow + Case 1 : c = Color.Green + Case 2 : c = Color.Blue + Case 3 : c = Color.Red + Case 4, 5 : c = Color.White + Case 6 : c = Color.Orange + Case 7 : c = Color.Violet + Case 8 : c = Color.DarkBlue + Case 9 : c = Color.Magenta + End Select + Me.SetColor(c) + + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/CellularAutomataWithSave/Voting.vb b/Files/CellularAutomataWithSave/Voting.vb new file mode 100644 index 0000000..fadc5e0 --- /dev/null +++ b/Files/CellularAutomataWithSave/Voting.vb @@ -0,0 +1,122 @@ +Namespace CellularAutomata + + Public Class TheVotingGame + Inherits CellularAutomataGame + + Private fSetupNeighbors As Boolean + + Public Sub New(ByVal oCtl As Control) + MyBase.New(oCtl) + End Sub + + Protected Overrides Function CreateOneCell(ByVal oPos As Point) As CellularAutomataCell + + Dim oC As VotingCell + + fSetupNeighbors = False 'if we're creating new cells, then neighbors not setup + + oC = New VotingCell(oPos, Me.CellRadius) + oC.IsDemocrat = HalfTheTime() + Return oC + + End Function + + Protected Overrides Sub RunAGeneration() + + Dim oC As VotingCell + + If Not fSetupNeighbors Then + SetupNeighbors() + End If + + 'choose a random neighbor + oC = fCells.Item(oRand.Next(0, fcells.Count)) + oC.ChangePartyAffiliation() + + End Sub + + 'each cell has an arraylist that points to neighboring cells. Set this up now. + Private Sub SetupNeighbors() + + Dim i As Integer + Dim iRow, iCol As Integer 'loop variables + Dim iLRow, iLCol As Integer 'loop variables + Dim oCn As VotingCell + Dim oC As VotingCell + + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + IndexToRowCol(i, iRow, iCol) + + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing, same cell + Else + 'wrap around to other side + oCn = RowColToCell(iRow + iLRow, iCol + iLCol, bWrap:=True) + If Not (oCn Is Nothing) Then + oC.AddNeighbor(oCn) + End If + End If + Next + Next + Next + + fSetupNeighbors = True + + End Sub + + End Class + + _ + Public Class VotingCell + Inherits CellularAutomataCell + + Private Shared oRand As New Random + + 'pointers to eight neighbors + Protected FNeighbors As ArrayList 'up to 8 neighbors, doesn't matter where they are + + Public Sub New(ByVal oPos As Point, ByVal r As Integer) + MyBase.New(oPos, r) + End Sub + + Overrides Function GetColor() As Color + Return IIf(Not FDemocrat, Color.Blue, Color.Red) + End Function + + Private FDemocrat As Boolean = False + Property IsDemocrat() As Boolean + Get + Return FDemocrat + End Get + Set(ByVal Value As Boolean) + FDemocrat = Value + End Set + End Property + + Public Sub AddNeighbor(ByVal oC As VotingCell) + If FNeighbors Is Nothing Then + FNeighbors = New ArrayList + End If + + FNeighbors.Add(oC) 'pointer + End Sub + + Public Sub ChangePartyAffiliation() + + Dim oC As VotingCell + + oC = FNeighbors.Item(oRand.Next(0, FNeighbors.Count)) + Me.IsDemocrat = oC.IsDemocrat + + End Sub + + Public Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + Me.IsDemocrat = Not Me.IsDemocrat + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/CellularAutomataWithSave/bin/Automata.exe b/Files/CellularAutomataWithSave/bin/Automata.exe new file mode 100644 index 0000000..773b4b3 Binary files /dev/null and b/Files/CellularAutomataWithSave/bin/Automata.exe differ diff --git a/Files/CellularAutomataWithSave/bin/Automata.pdb b/Files/CellularAutomataWithSave/bin/Automata.pdb new file mode 100644 index 0000000..b906182 Binary files /dev/null and b/Files/CellularAutomataWithSave/bin/Automata.pdb differ diff --git a/Files/CellularAutomataWithSave/fLife.resx b/Files/CellularAutomataWithSave/fLife.resx new file mode 100644 index 0000000..0ddb376 --- /dev/null +++ b/Files/CellularAutomataWithSave/fLife.resx @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + False + + + True + + + Assembly + + + 8, 8 + + + True + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 25 + + + True + + + Assembly + + + fLife + + \ No newline at end of file diff --git a/Files/CellularAutomataWithSave/fLife.vb b/Files/CellularAutomataWithSave/fLife.vb new file mode 100644 index 0000000..fbd3926 --- /dev/null +++ b/Files/CellularAutomataWithSave/fLife.vb @@ -0,0 +1,272 @@ +Public Class fLife + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents aTimer As System.Windows.Forms.Timer + Friend WithEvents pnBottom As System.Windows.Forms.Panel + Friend WithEvents cbGo As System.Windows.Forms.Button + Friend WithEvents lbTime As System.Windows.Forms.Label + Friend WithEvents cbSingle As System.Windows.Forms.Button + Friend WithEvents lbGen As System.Windows.Forms.Label + Friend WithEvents lbT As System.Windows.Forms.Label + Friend WithEvents lbG As System.Windows.Forms.Label + Friend WithEvents rbGame0 As System.Windows.Forms.RadioButton + Friend WithEvents rbGame1 As System.Windows.Forms.RadioButton + Friend WithEvents rbGame2 As System.Windows.Forms.RadioButton + Friend WithEvents cbSave As System.Windows.Forms.Button + Friend WithEvents cbLoad As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container + Me.aTimer = New System.Windows.Forms.Timer(Me.components) + Me.pnBottom = New System.Windows.Forms.Panel + Me.rbGame2 = New System.Windows.Forms.RadioButton + Me.rbGame1 = New System.Windows.Forms.RadioButton + Me.rbGame0 = New System.Windows.Forms.RadioButton + Me.lbG = New System.Windows.Forms.Label + Me.lbT = New System.Windows.Forms.Label + Me.lbGen = New System.Windows.Forms.Label + Me.cbGo = New System.Windows.Forms.Button + Me.lbTime = New System.Windows.Forms.Label + Me.cbSingle = New System.Windows.Forms.Button + Me.cbSave = New System.Windows.Forms.Button + Me.cbLoad = New System.Windows.Forms.Button + Me.pnBottom.SuspendLayout() + Me.SuspendLayout() + ' + 'aTimer + ' + Me.aTimer.Interval = 10 + ' + 'pnBottom + ' + Me.pnBottom.Controls.Add(Me.cbLoad) + Me.pnBottom.Controls.Add(Me.cbSave) + Me.pnBottom.Controls.Add(Me.rbGame2) + Me.pnBottom.Controls.Add(Me.rbGame1) + Me.pnBottom.Controls.Add(Me.rbGame0) + Me.pnBottom.Controls.Add(Me.lbG) + Me.pnBottom.Controls.Add(Me.lbT) + Me.pnBottom.Controls.Add(Me.lbGen) + Me.pnBottom.Controls.Add(Me.cbGo) + Me.pnBottom.Controls.Add(Me.lbTime) + Me.pnBottom.Controls.Add(Me.cbSingle) + Me.pnBottom.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pnBottom.Location = New System.Drawing.Point(0, 253) + Me.pnBottom.Name = "pnBottom" + Me.pnBottom.Size = New System.Drawing.Size(536, 72) + Me.pnBottom.TabIndex = 5 + ' + 'rbGame2 + ' + Me.rbGame2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rbGame2.Location = New System.Drawing.Point(408, 48) + Me.rbGame2.Name = "rbGame2" + Me.rbGame2.Size = New System.Drawing.Size(120, 16) + Me.rbGame2.TabIndex = 13 + Me.rbGame2.Text = "The Voting Game" + ' + 'rbGame1 + ' + Me.rbGame1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rbGame1.Location = New System.Drawing.Point(408, 32) + Me.rbGame1.Name = "rbGame1" + Me.rbGame1.Size = New System.Drawing.Size(120, 16) + Me.rbGame1.TabIndex = 12 + Me.rbGame1.Text = "Color Life" + ' + 'rbGame0 + ' + Me.rbGame0.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.rbGame0.Checked = True + Me.rbGame0.Location = New System.Drawing.Point(408, 16) + Me.rbGame0.Name = "rbGame0" + Me.rbGame0.Size = New System.Drawing.Size(120, 16) + Me.rbGame0.TabIndex = 11 + Me.rbGame0.TabStop = True + Me.rbGame0.Text = "Conway's Life" + ' + 'lbG + ' + Me.lbG.Location = New System.Drawing.Point(96, 32) + Me.lbG.Name = "lbG" + Me.lbG.Size = New System.Drawing.Size(72, 16) + Me.lbG.TabIndex = 9 + Me.lbG.Text = "Generations:" + Me.lbG.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lbT + ' + Me.lbT.Location = New System.Drawing.Point(128, 16) + Me.lbT.Name = "lbT" + Me.lbT.Size = New System.Drawing.Size(40, 16) + Me.lbT.TabIndex = 8 + Me.lbT.Text = "Ticks:" + Me.lbT.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lbGen + ' + Me.lbGen.Location = New System.Drawing.Point(168, 32) + Me.lbGen.Name = "lbGen" + Me.lbGen.Size = New System.Drawing.Size(136, 16) + Me.lbGen.TabIndex = 7 + ' + 'cbGo + ' + Me.cbGo.Location = New System.Drawing.Point(8, 8) + Me.cbGo.Name = "cbGo" + Me.cbGo.TabIndex = 0 + Me.cbGo.Text = "Go" + ' + 'lbTime + ' + Me.lbTime.Location = New System.Drawing.Point(168, 16) + Me.lbTime.Name = "lbTime" + Me.lbTime.Size = New System.Drawing.Size(136, 16) + Me.lbTime.TabIndex = 6 + ' + 'cbSingle + ' + Me.cbSingle.Location = New System.Drawing.Point(8, 40) + Me.cbSingle.Name = "cbSingle" + Me.cbSingle.TabIndex = 1 + Me.cbSingle.Text = "Single Step" + ' + 'cbSave + ' + Me.cbSave.Location = New System.Drawing.Point(288, 8) + Me.cbSave.Name = "cbSave" + Me.cbSave.TabIndex = 14 + Me.cbSave.Text = "Save" + ' + 'cbLoad + ' + Me.cbLoad.Location = New System.Drawing.Point(288, 40) + Me.cbLoad.Name = "cbLoad" + Me.cbLoad.TabIndex = 15 + Me.cbLoad.Text = "Load" + ' + 'fLife + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(536, 325) + Me.Controls.Add(Me.pnBottom) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "fLife" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Cellular Automata" + Me.pnBottom.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private oP As FlickerFreePanel + Private oCell As CellularAutomata.CellularAutomataGame + + Private Sub Form1_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + oP = New FlickerFreePanel + + oP.Dock = DockStyle.Fill + Me.Controls.Add(oP) + + CreateGame() + + End Sub + + Private Sub RunOne(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles aTimer.Tick, cbSingle.Click + + oCell.Tick() + lbTime.Text = oCell.TimerTicksElapsed + lbGen.Text = oCell.GenerationCount + + End Sub + + Private Sub cbGo_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGo.Click + + If aTimer.Enabled Then + aTimer.Enabled = False + cbGo.Text = "Go" + rbGame0.Enabled = True + rbGame1.Enabled = True + rbGame2.Enabled = True + Else + aTimer.Enabled = True + cbGo.Text = "Stop" + rbGame0.Enabled = False + rbGame1.Enabled = False + rbGame2.Enabled = False + End If + + End Sub + + Private Sub CreateGame() + + If rbGame0.Checked Then + oCell = New CellularAutomata.ConwaysLife(oP) + oCell.CellRadius = 8 + ElseIf rbGame1.Checked Then + oCell = New CellularAutomata.RainbowLife(oP) + oCell.CellRadius = 8 + Else + oCell = New CellularAutomata.TheVotingGame(oP) + oCell.CellRadius = 32 + End If + + End Sub + + Private Sub rbGame_CheckedChanged(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles rbGame0.CheckedChanged, _ + rbGame1.CheckedChanged, rbGame2.CheckedChanged + + If oP Is Nothing Then Exit Sub + + CreateGame() + End Sub + + Private Sub cbSave_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbSave.Click + + oCell.SaveToFile("c:\fred.lif") + End Sub + + Private Sub cbLoad_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbLoad.Click + + oCell.LoadFromFile("c:\fred.lif") + oP.Invalidate() + + End Sub +End Class + diff --git a/Files/CellularAutomataWithSave/obj/Debug/Automata.FlickerFreePanel.resources b/Files/CellularAutomataWithSave/obj/Debug/Automata.FlickerFreePanel.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Automata.FlickerFreePanel.resources differ diff --git a/Files/CellularAutomataWithSave/obj/Debug/Automata.exe b/Files/CellularAutomataWithSave/obj/Debug/Automata.exe new file mode 100644 index 0000000..773b4b3 Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Automata.exe differ diff --git a/Files/CellularAutomataWithSave/obj/Debug/Automata.fLife.resources b/Files/CellularAutomataWithSave/obj/Debug/Automata.fLife.resources new file mode 100644 index 0000000..3819f63 Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Automata.fLife.resources differ diff --git a/Files/CellularAutomataWithSave/obj/Debug/Automata.pdb b/Files/CellularAutomataWithSave/obj/Debug/Automata.pdb new file mode 100644 index 0000000..b906182 Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Automata.pdb differ diff --git a/Files/CellularAutomataWithSave/obj/Debug/Life.LifePanel.resources b/Files/CellularAutomataWithSave/obj/Debug/Life.LifePanel.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Life.LifePanel.resources differ diff --git a/Files/CellularAutomataWithSave/obj/Debug/Life.exe b/Files/CellularAutomataWithSave/obj/Debug/Life.exe new file mode 100644 index 0000000..20c46c3 Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Life.exe differ diff --git a/Files/CellularAutomataWithSave/obj/Debug/Life.pdb b/Files/CellularAutomataWithSave/obj/Debug/Life.pdb new file mode 100644 index 0000000..1c1bc1d Binary files /dev/null and b/Files/CellularAutomataWithSave/obj/Debug/Life.pdb differ diff --git a/Files/CellularAutomataWithSave/old/LifeClasses.resx b/Files/CellularAutomataWithSave/old/LifeClasses.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/Files/CellularAutomataWithSave/old/LifeClasses.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/CellularAutomataWithSave/old/LifeClasses.vb b/Files/CellularAutomataWithSave/old/LifeClasses.vb new file mode 100644 index 0000000..f704b7e --- /dev/null +++ b/Files/CellularAutomataWithSave/old/LifeClasses.vb @@ -0,0 +1,312 @@ +Imports System.Drawing.Drawing2D + +Public MustInherit Class CellularAutomataPanel + Inherits System.Windows.Forms.Panel + + Protected FCells As ArrayList + Private FRows As Integer + Private FCols As Integer + + Private oRand As Random + + Property Rows() + Get + Return FRows + End Get + Set(ByVal Value) + FRows = Value + End Set + End Property + + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + oRand = New Random + CreateData() + End Sub + + Function HalfTheTime() As Boolean + Return oRand.Next(0, Int16.MaxValue) Mod 2 = 0 + End Function + + Private FCellRadius As Integer = 8 + Property CellRadius() As Integer + Get + Return FCellRadius + End Get + Set(ByVal Value As Integer) + FCellRadius = Value + CreateData() + Me.Invalidate() + End Set + End Property + + Private Sub CreateData() + + Dim oC As LifeCell + Dim iRow As Integer = 0 + Dim iCol As Integer + + FCells = New ArrayList + Do + iCol = 0 + Do + oC = New LifeCell(Me) + With oC + .Position = New Point(iCol * CellRadius, iRow * CellRadius) + .Alive = oRand.Next(0, 1000) Mod 5 = 0 + End With + FCells.Add(oC) + + iCol += 1 + Loop Until iCol * CellRadius > Me.Width + iRow += 1 + + Loop Until (iRow * CellRadius) > Me.Height + + FRows = iRow + FCols = iCol + + Debug.Assert(FRows * FCols = FCells.Count) + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + Draw(e.Graphics) + End Sub + + Protected Overrides Sub OnResize(ByVal eventargs As System.EventArgs) + MyBase.OnResize(eventargs) + Call CreateData() + Me.Invalidate() + End Sub + + Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + MyBase.OnMouseDown(e) + + Dim oC As LifeCell + + For Each oC In FCells + If oC.ClientRectangle.Contains(e.X, e.Y) Then + If e.Button = MouseButtons.Left Then + oC.Alive = Not oC.Alive + Me.Invalidate() + Exit Sub + End If + If e.Button = MouseButtons.Right Then + MsgBox("neighbors:" & oC.Neighbors) + End If + End If + Next + + End Sub + + + Private Sub Draw(ByVal g As Graphics) + + Dim oC As LifeCell + For Each oC In FCells + oC.Draw(g) + Next + + End Sub + + Private Sub IndextoRowCol(ByVal i As Integer, ByRef iRow As Integer, ByRef iCol As Integer) + iRow = i \ FCols + iCol = i Mod FCols + End Sub + + Private Function CellAt(ByVal iRow As Integer, ByVal iCol As Integer) As LifeCell + + If iRow < 0 Then Return Nothing + If iRow >= FRows Then Return Nothing + If iCol < 0 Then Return Nothing + If iCol >= FCols Then Return Nothing + + Return FCells((iRow * FCols) + iCol) + End Function + + Public Sub NextGeneration() + + Dim i As Integer + Dim iRow, iCol As Integer + Dim iLRow, iLCol As Integer 'loop variables + Dim oC, oCn As LifeCell + Dim oHRT As HighResTimer + + oHRT = New HighResTimer + oHRT.StartTimer() + + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + oC.Neighbors = 0 + IndextoRowCol(i, iRow, iCol) + + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing + Else + oCn = CellAt(iRow + iLRow, iCol + iLCol) + If Not (oCn Is Nothing) Then + If oCn.Alive Then + oC.Neighbors += 1 + End If + End If + End If + Next + Next + Next + + 'have to do this in two passes, or changing a cell mid-pass would affect neighbors + For Each oC In FCells + oC.LiveToSeeAnotherDay() + Next + + FTicksElapsed = oHRT.EndTimer() + Me.Invalidate() + End Sub + + Public Sub NextGeneration2() + + Dim i As Integer + Dim iRow, iCol As Integer + Dim iLRow, iLCol As Integer 'loop variables + Dim oC, oCn As LifeCell + Dim oHRT As HighResTimer + + oHRT = New HighResTimer + oHRT.StartTimer() + + 'clear + For Each oC In FCells + oC.Neighbors = 0 + Next + + For i = 0 To FCells.Count - 1 + oC = FCells.Item(i) + IndextoRowCol(i, iRow, iCol) + + If oC.Alive Then + For iLRow = -1 To 1 + For iLCol = -1 To 1 + If iLRow = 0 And iLCol = 0 Then + 'nothing + Else + oCn = CellAt(iRow + iLRow, iCol + iLCol) + If Not (oCn Is Nothing) Then + oCn.Neighbors += 1 + End If + End If + Next + Next + + End If + Next + + 'have to do this in two passes, or changing a cell mid-pass would affect neighbors + For Each oC In FCells + oC.LiveToSeeAnotherDay() + Next + + FTicksElapsed = oHRT.EndTimer() + Me.Invalidate() + End Sub + + Dim FTicksElapsed As Long + ReadOnly Property TicksElapsed() As Long + Get + Return FTicksElapsed + End Get + End Property + + Private Class LifeCell + + Private FPan As LifePanel + + Public Sub New(ByVal lp As LifePanel) + MyBase.new() + FPan = lp + End Sub + + Private FAlive As Boolean = False + Property Alive() As Boolean + Get + Return FAlive + End Get + Set(ByVal Value As Boolean) + FAlive = Value + End Set + End Property + + Private FNeighbors As Integer + Property Neighbors() As Integer + Get + Return FNeighbors + End Get + Set(ByVal Value As Integer) + FNeighbors = Value + End Set + End Property + + Private fPos As Point + Property Position() As Point + Get + Return fPos + End Get + Set(ByVal Value As Point) + fPos = Value + End Set + End Property + + Public Overridable Sub Draw(ByVal g As Graphics) + + Dim ogc As GraphicsContainer + Dim iRad As Integer + Dim r As Rectangle + Dim b As Brush + + iRad = FPan.CellRadius - 2 + r = New Rectangle(1, 1, iRad, iRad) + If Me.Alive Then + b = Brushes.Yellow + Else + b = Brushes.Black + End If + + ogc = g.BeginContainer + Try + g.TranslateTransform(fPos.X, fPos.Y) + g.FillRectangle(b, r) + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Public Sub LiveToSeeAnotherDay() + If Not Alive Then + 'not alive now, comes to life if 3 neighbors + Alive = (Neighbors = 3) + Else + 'alive now, stays alive w/ 2 or 3 neighbors + Alive = (Neighbors = 2 Or Neighbors = 3) + End If + End Sub + + ReadOnly Property ClientRectangle() As Rectangle + Get + Return New Rectangle(fPos.X, fPos.Y, FPan.CellRadius, FPan.CellRadius) + End Get + End Property + + End Class + +End Class + diff --git a/Files/Common/FlickerFreePanel.resx b/Files/Common/FlickerFreePanel.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/Files/Common/FlickerFreePanel.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/Common/FlickerFreePanel.vb b/Files/Common/FlickerFreePanel.vb new file mode 100644 index 0000000..e2a8e1b --- /dev/null +++ b/Files/Common/FlickerFreePanel.vb @@ -0,0 +1,17 @@ +Imports System.Windows.Forms + +Public Class FlickerFreePanel + Inherits System.Windows.Forms.Panel + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + Me.BackColor = Color.Black + + End Sub + +End Class diff --git a/Files/Common/WavLibrary.vb b/Files/Common/WavLibrary.vb new file mode 100644 index 0000000..8ba1f71 --- /dev/null +++ b/Files/Common/WavLibrary.vb @@ -0,0 +1,133 @@ +'loads WAV files from executable or from disk into memory and plays them. +'each WAV file is referenced by a short name given it during load +Public Class WavLibrary + + Private FSounds As Hashtable + + Public Sub New() + MyBase.New() + FSounds = New Hashtable + End Sub + + Public Sub Dispose() + + Dim w As WavFile + + For Each w In FSounds.Values + w.Dispose() + Next + End Sub + + Public Function LoadFromResource(ByVal cResName As String, ByVal cName As String) As Boolean + + Dim w As WavFile + + w = New WavFile(cName) + If w.LoadFromResource(cResName) Then + FSounds.Add(w.Name, w) + End If + + End Function + + Public Overloads Sub Play(ByVal cName As String, Optional ByVal bSync As Boolean = False) + + Dim w As WavFile + + w = FSounds.Item(cName) + If w Is Nothing Then + Throw New Exception("Sound name " & cName & " not found") + Else + w.Play(bSync) + End If + End Sub + + 'play and pause + Public Overloads Sub Play(ByVal cName As String, _ + ByVal mSec As Integer, _ + Optional ByVal bSync As Boolean = False) + + Dim w As WavFile + + w = FSounds.Item(cName) + If w Is Nothing Then Exit Sub + + w.Play(mSec, bSync) + + End Sub + + Private Class WavFile + + Private Declare Function sndPlaySound Lib "winmm.dll" _ + Alias "sndPlaySoundA" (ByVal szSound As Byte(), ByVal UFlags As Int32) As Int32 + + Private Const SND_ASYNC As Int32 = &H1 + Private Const SND_MEMORY As Int32 = &H4 + + Private bstr() As Byte + Private FName As String + + Public Sub New(ByVal cName As String) + MyBase.New() + FName = cName + End Sub + + Public Sub Dispose() + bstr = Nothing + End Sub + + Property Name() As String + Get + Return FName + End Get + Set(ByVal Value As String) + FName = Value + End Set + End Property + + Public Function LoadFromResource(ByVal cResName As String) As Boolean + + Dim a As System.IO.Stream + Dim bRet As Boolean = False + + a = System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(cResName) + If a Is Nothing Then Exit Function + + ReDim bstr(a.Length) + + Try + a.Read(bstr, 0, Int(a.Length)) + bRet = True + Catch oEX As Exception + bRet = False + Finally + a = Nothing + End Try + + Return bRet + + End Function + + 'always pause at least a little, or sound often can't be heard + Public Overloads Sub Play(ByVal bSync As Boolean) + Play(mSec:=10, bSync:=bSync) + End Sub + + Public Overloads Sub Play(ByVal mSec As Integer, ByVal bSync As Boolean) + + If bstr Is Nothing Then Exit Sub + Dim iFlags As Integer + + Try + iFlags = SND_MEMORY + If Not bSync Then iFlags = iFlags Or SND_ASYNC + sndPlaySound(bstr, iFlags) + System.Threading.Thread.Sleep(mSec) + Catch oEX As Exception + 'nothing + End Try + + End Sub + + End Class +End Class + diff --git a/Files/DicePanel/AssemblyInfo.vb b/Files/DicePanel/AssemblyInfo.vb new file mode 100644 index 0000000..a5c18ee --- /dev/null +++ b/Files/DicePanel/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/DicePanel/DicePanel.resx b/Files/DicePanel/DicePanel.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Files/DicePanel/DicePanel.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/DicePanel/DicePanel.sln b/Files/DicePanel/DicePanel.sln new file mode 100644 index 0000000..e8ea1d9 --- /dev/null +++ b/Files/DicePanel/DicePanel.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DicePanel", "DicePanel.vbproj", "{3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.ActiveCfg = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.Build.0 = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.ActiveCfg = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/DicePanel/DicePanel.sln.old b/Files/DicePanel/DicePanel.sln.old new file mode 100644 index 0000000..ed2a9c0 --- /dev/null +++ b/Files/DicePanel/DicePanel.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DicePanel", "DicePanel.vbproj", "{3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.ActiveCfg = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.Build.0 = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.ActiveCfg = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/DicePanel/DicePanel.suo b/Files/DicePanel/DicePanel.suo new file mode 100644 index 0000000..e9db288 Binary files /dev/null and b/Files/DicePanel/DicePanel.suo differ diff --git a/Files/DicePanel/DicePanel.vb b/Files/DicePanel/DicePanel.vb new file mode 100644 index 0000000..0f23c6f --- /dev/null +++ b/Files/DicePanel/DicePanel.vb @@ -0,0 +1,551 @@ +Imports System.Math +Imports System.Drawing +Imports System.Drawing.Imaging +Imports System.Windows.Forms +Imports System.ComponentModel + +Namespace DicePanel + + _ + Public Class DicePanel + Inherits System.Windows.Forms.Panel + + Private aDice As ArrayList + + Protected FbmStop As Bitmap + Protected FbmxRot As Bitmap + Protected FbmyRot As Bitmap + Protected FRand As New Random + + Private bmBack As Bitmap 'background bitmap + Public Event DieBounced() + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + Me.BackColor = Color.Black + + Dim a As Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + FbmxRot = New Bitmap(a.GetManifestResourceStream("DicePanel.dicexrot.bmp")) + FbmyRot = New Bitmap(a.GetManifestResourceStream("DicePanel.diceyrot.bmp")) + FbmStop = New Bitmap(a.GetManifestResourceStream("DicePanel.dicedone.bmp")) + + 'NEW. this used to be a major pain in VB6 + FbmxRot.MakeTransparent(Color.Black) + FbmyRot.MakeTransparent(Color.Black) + FbmStop.MakeTransparent(Color.Black) + + End Sub + + 'called from form dispose + Public Overloads Sub Dispose() + FbmxRot.Dispose() + FbmyRot.Dispose() + FbmStop.Dispose() + bmBack.Dispose() + MyBase.Dispose() + End Sub + + Private FNumDice As Integer = 2 + + _ + Property NumDice() As Integer + Get + Return FNumDice + End Get + Set(ByVal Value As Integer) + FNumDice = Value + + 'regen dice, but only if done once before, or else dbl init + If DiceGenerated() Then + Dim d As Die + GenerateDice() + Clear() + For Each d In aDice + d.DrawDie(bmBack) + Next + Me.Invalidate() + End If + End Set + End Property + + Private FDebugDrawMode As Boolean = False + + _ + Property DebugDrawMode() As Boolean + Get + Return FDebugDrawMode + End Get + Set(ByVal Value As Boolean) + FDebugDrawMode = Value + End Set + End Property + + Private Sub GenerateDice() + + Dim d As Die + Dim dOld As Die + Dim bDone As Boolean + Dim iTry As Integer + + aDice = New ArrayList + + Do While aDice.Count < NumDice + d = New Die(Me) + iTry = 0 + + Do + iTry += 1 + bDone = True + d.InitializeLocation() + For Each dOld In aDice + If d.Overlapping(dOld) Then + bDone = False + End If + Next + Loop Until bDone Or iTry > 1000 + aDice.Add(d) + Loop + + End Sub + + _ + ReadOnly Property Result() As Integer + Get + Dim d As Die + Dim i As Integer = 0 + + For Each d In aDice + i += d.Result + Next + Return i + End Get + End Property + + Private ReadOnly Property AllDiceStopped() As Boolean + Get + Dim d As Die + Dim r As Boolean + + r = True + For Each d In aDice + If d.IsRolling Then + r = False + End If + Next + + Return r + End Get + End Property + + Public Sub RollDice() + + Dim d As Die + + For Each d In aDice + d.InitializeRoll() + Next + + Do + Clear() 'NEW - clear only once per frame + + For Each d In aDice + d.UpdateDiePosition() + 'HandleCollisions() + d.DrawDie(bmBack) + Next + HandleCollisions() + Me.Invalidate() + Application.DoEvents() + Loop Until AllDiceStopped + + End Sub + + Private Sub HandleCollisions() + + Dim di As Die + Dim dj As Die + Dim i As Integer + Dim j As Integer + + If NumDice = 1 Then Exit Sub + + 'can't use foreach loops here, want to start j loop index AFTER first loop + For i = 0 To aDice.Count - 2 + For j = i + 1 To aDice.Count - 1 + di = aDice.Item(i) + dj = aDice.Item(j) + di.HandleCollision(dj) + Next + Next + + End Sub + + Private Sub SetupBackgroundAndDice() + MakeBackgroundBitmap() + + Dim d As Die + If Not DiceGenerated() Then + GenerateDice() + End If + For Each d In aDice + d.DrawDie(bmBack) + Next + + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + + 'happens in design mode + If bmBack Is Nothing Then + Call SetupBackgroundAndDice() + End If + e.Graphics.DrawImageUnscaled(bmBack, 0, 0) + End Sub + + Protected Overrides Sub OnResize(ByVal eventargs As System.EventArgs) + MyBase.OnResize(eventargs) + Call SetupBackgroundAndDice() + End Sub + + Private Sub MakeBackgroundBitmap() + If Not bmBack Is Nothing Then bmBack.Dispose() + bmBack = New Bitmap(Me.Width, Me.Height, PixelFormat.Format32bppPArgb) + Clear() + End Sub + + Private Sub Clear() + + Dim gr As Graphics + + gr = Graphics.FromImage(bmBack) + Try + gr.Clear(Color.Black) + Finally + gr.Dispose() + End Try + End Sub + + Private Function DiceGenerated() As Boolean + Return Not (aDice Is Nothing) + End Function + + Protected Sub OnDieBounced() + RaiseEvent DieBounced() + End Sub + + Protected Friend Class Die + + Private Const MAXMOVE As Integer = 5 + Private Enum DieStatus + dsStopped = 0 + dsRolling = 1 + dsLanding = 2 + End Enum + + Private FRollLoop As Integer + + Private h As Integer = 72 + Private w As Integer = 72 + Private FxPos As Integer + Private FyPos As Integer + + Private dxDir As Integer '-MAXMOVE to MAXMOVE + Private dyDir As Integer '-MAXMOVE to MAXMOVE, indicates direction moving + + Private FPanel As DicePanel + Private FStatus As DieStatus = DieStatus.dsLanding + + Public Sub New(ByVal pn As DicePanel) + MyBase.New() + FPanel = pn + End Sub + + Private FFrame As Integer + Private Property Frame() As Integer + Get + Return FFrame + End Get + Set(ByVal Value As Integer) + FFrame = Value + + If FFrame < 0 Then FFrame += 36 + If FFrame > 35 Then FFrame -= 36 + End Set + End Property + + + Private FResult As Integer 'result of the die, 1-6 + Property Result() As Integer + Get + Return FResult + End Get + Set(ByVal Value As Integer) + If Value < 1 Or Value > 6 Then + Throw New Exception("Invalid Die Value") + Else + FResult = Value + End If + End Set + End Property + + Private Property xPos() As Integer + Get + Return FxPos + End Get + Set(ByVal Value As Integer) + FxPos = Value + + If FxPos < 0 Then + FxPos = 0 + Call BounceX() + End If + If FxPos > FPanel.Width - w Then + FxPos = FPanel.Width - w + Call BounceX() + End If + End Set + End Property + + Private Property yPos() As Integer + Get + Return FyPos + End Get + Set(ByVal Value As Integer) + FyPos = Value + + If FyPos < 0 Then + FyPos = 0 + Call BounceY() + End If + If FyPos > FPanel.Height - h Then + FyPos = FPanel.Height - h + Call BounceY() + End If + End Set + End Property + + Public Sub InitializeLocation() + Try + xPos = FPanel.FRand.Next(0, FPanel.Width - w) + yPos = FPanel.FRand.Next(0, FPanel.Height - h) + Catch oEX As Exception + xPos = 0 + yPos = 0 + End Try + End Sub + + Public Sub UpdateDiePosition() + + Select Case FStatus + Case DieStatus.dsLanding + 'if landing reduce the frame by 1, regardless of direction + Frame -= 1 + Case DieStatus.dsRolling + 'frame goes up or down based on y direction + Frame += (1 * Sign(dyDir)) + 'NEW - need because other dice might be moving if i've stopped + Case DieStatus.dsStopped + Exit Sub 'don't move if stopped + End Select + + 'update the position + xPos += dxDir + yPos += dyDir + + FRollLoop += 1 + + Select Case FStatus + Case DieStatus.dsRolling + 'after 100 frames, check for a small chance that the die will stop rolling + If FRollLoop > 100 And FPanel.FRand.Next(1, 100) < 10 Then + FStatus = DieStatus.dsLanding + FRollLoop = 0 + + Frame = Result * 6 + End If + + Case DieStatus.dsLanding + 'die lands for 6 frames and stops + If FRollLoop > 5 Then + FStatus = DieStatus.dsStopped + End If + End Select + + End Sub + + Public Sub InitializeRoll() + + Do + 'initialize the directions, 0/1 no good + dxDir = FPanel.FRand.Next(-MAXMOVE, MAXMOVE + 1) + Loop Until Abs(dxDir) > 2 + Do + dyDir = FPanel.FRand.Next(-MAXMOVE, MAXMOVE + 1) + Loop Until Abs(dyDir) > 2 + Result = FPanel.FRand.Next(1, 7) 'decide what the result will be + + FRollLoop = 0 + FStatus = DieStatus.dsRolling + + End Sub + + Public Sub DrawDie(ByVal bDest As Bitmap) + + Dim gr As Graphics + Dim b As Bitmap + + Dim x As Integer = (Frame Mod 6) * w + Dim y As Integer = (Frame \ 6) * h + Dim r As New System.Drawing.Rectangle(x, y, w, h) + + 'select the correct bitmap based on what the die is doing, and what direction it's going + If FStatus = DieStatus.dsRolling Then + 'check quandrant rolling towards based on sign of xdir*ydir + If (dxDir * dyDir) > 0 Then + b = FPanel.FbmyRot + Else + b = FPanel.FbmxRot + End If + Else + b = FPanel.FbmStop + End If + + gr = Graphics.FromImage(bDest) + Try + gr.DrawImage(b, xPos, yPos, r, GraphicsUnit.Pixel) + If FPanel.DebugDrawMode Then + Dim p As New Pen(Color.Yellow) + Dim xc, yc As Single + + xc = xPos + (w \ 2) + yc = yPos + (h \ 2) + + gr.DrawRectangle(p, Me.Rect) + gr.DrawLine(p, xc, yc, xc + Sign(dxDir) * (w \ 2), yc + Sign(dyDir) * (h \ 2)) + End If + Finally + gr.Dispose() + End Try + + End Sub + + ReadOnly Property IsNotRolling() As Boolean + Get + Return FStatus = DieStatus.dsStopped + End Get + End Property + + ReadOnly Property IsRolling() As Boolean + Get + Return Not IsNotRolling + End Get + End Property + + ReadOnly Property Rect() As Rectangle + Get + Return New Rectangle(xPos, yPos, w, h) + End Get + End Property + + Public Function Overlapping(ByVal d As Die) As Boolean + Return d.Rect.IntersectsWith(Me.Rect) + End Function + + Public Sub HandleCollision(ByVal d As Die) + If Me.Overlapping(d) Then + If Abs(d.yPos - Me.yPos) <= Abs(d.xPos - Me.xPos) Then + HandleBounceX(d) + Else + HandleBounceY(d) + End If + End If + End Sub + + Private Sub HandleBounceX(ByVal d As Die) + + Dim dLeft As Die + Dim dRight As Die + + If Me.xPos < d.xPos Then + dLeft = Me + dRight = d + Else + dLeft = d + dRight = Me + End If + + 'moving toward each other + If dLeft.dxDir > 0 And dRight.dxDir < 0 Then + Me.BounceX() + d.BounceX() + Exit Sub + End If + + 'moving right, left one caught up to right one + If dLeft.dxDir > 0 And dRight.dxDir > 0 Then + dLeft.BounceX() + Exit Sub + End If + + 'moving left, right one caught up to left one + If dLeft.dxDir < 0 And dRight.dxDir < 0 Then + dRight.BounceX() + End If + + End Sub + + Private Sub HandleBounceY(ByVal d As Die) + + Dim dTop As Die + Dim dBot As Die + + If Me.yPos < d.yPos Then + dTop = Me + dBot = d + Else + dTop = d + dBot = Me + End If + + If dTop.dyDir > 0 And dBot.dyDir < 0 Then + Me.BounceY() + d.BounceY() + Exit Sub + End If + + 'moving down, top one caught up to bottom one + If dTop.dyDir > 0 And dBot.dyDir > 0 Then + dTop.BounceY() + Exit Sub + End If + + 'moving left, bottom one caught up to top one + If dTop.dyDir < 0 And dBot.dyDir < 0 Then + dBot.BounceY() + End If + + End Sub + + Private Sub BounceX() + dxDir = -dxDir + FPanel.OnDieBounced() + End Sub + + Private Sub BounceY() + dyDir = -dyDir + FPanel.OnDieBounced() + End Sub + + End Class + + End Class +End Namespace \ No newline at end of file diff --git a/Files/DicePanel/DicePanel.vbproj b/Files/DicePanel/DicePanel.vbproj new file mode 100644 index 0000000..40be248 --- /dev/null +++ b/Files/DicePanel/DicePanel.vbproj @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/DicePanel/DicePanel.vbproj.user b/Files/DicePanel/DicePanel.vbproj.user new file mode 100644 index 0000000..478a130 --- /dev/null +++ b/Files/DicePanel/DicePanel.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/DicePanel/bin/DicePanel.dll b/Files/DicePanel/bin/DicePanel.dll new file mode 100644 index 0000000..5e4a3c7 Binary files /dev/null and b/Files/DicePanel/bin/DicePanel.dll differ diff --git a/Files/DicePanel/bin/DicePanel.pdb b/Files/DicePanel/bin/DicePanel.pdb new file mode 100644 index 0000000..1712e0b Binary files /dev/null and b/Files/DicePanel/bin/DicePanel.pdb differ diff --git a/Files/DicePanel/obj/Debug/DicePanel.DicePanel.DicePanel.resources b/Files/DicePanel/obj/Debug/DicePanel.DicePanel.DicePanel.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/DicePanel/obj/Debug/DicePanel.DicePanel.DicePanel.resources differ diff --git a/Files/DicePanel/obj/Debug/DicePanel.dll b/Files/DicePanel/obj/Debug/DicePanel.dll new file mode 100644 index 0000000..5e4a3c7 Binary files /dev/null and b/Files/DicePanel/obj/Debug/DicePanel.dll differ diff --git a/Files/DicePanel/obj/Debug/DicePanel.pdb b/Files/DicePanel/obj/Debug/DicePanel.pdb new file mode 100644 index 0000000..1712e0b Binary files /dev/null and b/Files/DicePanel/obj/Debug/DicePanel.pdb differ diff --git a/Files/DicePanelNew/AssemblyInfo.vb b/Files/DicePanelNew/AssemblyInfo.vb new file mode 100644 index 0000000..a5c18ee --- /dev/null +++ b/Files/DicePanelNew/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/DicePanelNew/DicePanelNew.resx b/Files/DicePanelNew/DicePanelNew.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Files/DicePanelNew/DicePanelNew.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/DicePanelNew/DicePanelNew.sln b/Files/DicePanelNew/DicePanelNew.sln new file mode 100644 index 0000000..126d73c --- /dev/null +++ b/Files/DicePanelNew/DicePanelNew.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DicePanelNew", "DicePanelNew.vbproj", "{3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.ActiveCfg = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.Build.0 = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.ActiveCfg = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/DicePanelNew/DicePanelNew.suo b/Files/DicePanelNew/DicePanelNew.suo new file mode 100644 index 0000000..64e357a Binary files /dev/null and b/Files/DicePanelNew/DicePanelNew.suo differ diff --git a/Files/DicePanelNew/DicePanelNew.vb b/Files/DicePanelNew/DicePanelNew.vb new file mode 100644 index 0000000..4f02db6 --- /dev/null +++ b/Files/DicePanelNew/DicePanelNew.vb @@ -0,0 +1,817 @@ +Imports System.Math +Imports System.Drawing +Imports System.Drawing.Imaging +Imports System.Windows.Forms +Imports System.ComponentModel + +Namespace DicePanelNew + + _ + Public Class DicePanelNew + Inherits System.Windows.Forms.Panel + + Private aDice As ArrayList + + Protected FbStop As Bitmap + Protected FbxRot As Bitmap + Protected FbyRot As Bitmap + Protected FbHalo As Bitmap + Protected FRand As New Random + + Private bBack As Bitmap 'background bitmap + Public Event DieBounced() + Public Event DieFrozen(ByVal bUnFreeze As Boolean) + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + Me.BackColor = Color.Black + + Dim a As Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + FbxRot = New Bitmap(a.GetManifestResourceStream("DicePanelNew.dicexrot.bmp")) + FbyRot = New Bitmap(a.GetManifestResourceStream("DicePanelNew.diceyrot.bmp")) + FbStop = New Bitmap(a.GetManifestResourceStream("DicePanelNew.dicedone.bmp")) + 'new + FbHalo = New Bitmap(a.GetManifestResourceStream("DicePanelNew.diehalo.bmp")) + + FbxRot.MakeTransparent(Color.Black) + FbyRot.MakeTransparent(Color.Black) + FbStop.MakeTransparent(Color.Black) + 'new + FbHalo.MakeTransparent(Color.Black) + + End Sub + + Public Overloads Sub Dispose() + FbxRot.Dispose() + FbyRot.Dispose() + FbStop.Dispose() + bBack.Dispose() + MyBase.Dispose() + End Sub + + Private FNumDice As Integer = 2 + + _ + Property NumDice() As Integer + Get + Return FNumDice + End Get + Set(ByVal Value As Integer) + FNumDice = Value + + 'regen dice, but only if done once before, or else dbl init + If DiceGenerated() Then + Dim d As Die + GenerateDice() + Clear() + For Each d In aDice + d.DrawDie(bBack) + Next + Me.Invalidate() + End If + End Set + End Property + + Private FDebugDrawMode As Boolean = False + + _ + Property DebugDrawMode() As Boolean + Get + Return FDebugDrawMode + End Get + Set(ByVal Value As Boolean) + FDebugDrawMode = Value + End Set + End Property + + 'new + Private FClickToFreeze As Boolean + + 'new + _ + Property ClickToFreeze() As Boolean + Get + Return FClickToFreeze + End Get + Set(ByVal Value As Boolean) + FClickToFreeze = Value + End Set + End Property + + Private Sub GenerateDice() + + Dim d As Die + Dim dOld As Die + Dim bDone As Boolean + Dim iTry As Integer + + aDice = New ArrayList + + Do While aDice.Count < NumDice + d = New Die(Me) + iTry = 0 + + Do + iTry += 1 + bDone = True + d.InitializeLocation() + For Each dOld In aDice + If d.Overlapping(dOld) Then + bDone = False + End If + Next + Loop Until bDone Or iTry > 1000 + aDice.Add(d) + Loop + + End Sub + + _ + ReadOnly Property Result() As Integer + Get + Dim d As Die + Dim i As Integer = 0 + + For Each d In aDice + i += d.Result + Next + Return i + End Get + End Property + + 'new, changed visibility + Public ReadOnly Property AllDiceStopped() As Boolean + Get + Dim d As Die + Dim r As Boolean + + r = True + For Each d In aDice + If d.IsRolling Then + r = False + End If + Next + + Return r + End Get + End Property + + Public Sub RollDice() + + Dim d As Die + + 'don't roll if all frozen + If AllDiceFrozen() Then Exit Sub + + For Each d In aDice + d.InitializeRoll() + Next + + Do + Clear() + For Each d In aDice + d.UpdateDiePosition() + d.DrawDie(bBack) + Next + HandleCollisions() + Me.Invalidate() + Application.DoEvents() + Loop Until AllDiceStopped + + End Sub + + Private Sub HandleCollisions() + + Dim di As Die + Dim dj As Die + Dim i As Integer + Dim j As Integer + + If NumDice = 1 Then Exit Sub + + 'can't use foreach loops here, want to start j loop index AFTER first loop + For i = 0 To aDice.Count - 2 + For j = i + 1 To aDice.Count - 1 + di = aDice.Item(i) + dj = aDice.Item(j) + di.HandleCollision(dj) + Next + Next + + End Sub + + Private Sub SetupBackgroundAndDice() + MakeBackgroundBitmap() + + Dim d As Die + If Not DiceGenerated() Then + GenerateDice() + End If + For Each d In aDice + d.DrawDie(bBack) + Next + + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + + 'happens in design mode + If bBack Is Nothing Then + Call SetupBackgroundAndDice() + End If + e.Graphics.DrawImageUnscaled(bBack, 0, 0) + End Sub + + Protected Overrides Sub OnResize(ByVal eventargs As System.EventArgs) + MyBase.OnResize(eventargs) + Call SetupBackgroundAndDice() + End Sub + + 'new + Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + Dim d As Die + Dim bFound As Boolean = False + + If e.Button = MouseButtons.Left Then + If ClickToFreeze Then + + For Each d In aDice + If d.ClickedOn(e.X, e.Y) Then + d.Frozen = Not d.Frozen + bFound = True + Exit For + End If + Next + + If bFound Then + Clear() + For Each d In aDice + d.DrawDie(bBack) + Next + Invalidate() + End If + + Exit Sub 'don't run mybase if clicktofrezze + End If + End If + + MyBase.OnMouseDown(e) + End Sub + + Private Sub MakeBackgroundBitmap() + If Not bBack Is Nothing Then bBack.Dispose() + bBack = New Bitmap(Me.Width, Me.Height, PixelFormat.Format32bppPArgb) + Clear() + End Sub + + Private Sub Clear() + + Dim gr As Graphics + + gr = Graphics.FromImage(bBack) + Try + gr.Clear(Color.Black) + Finally + gr.Dispose() + End Try + End Sub + + Private Function DiceGenerated() As Boolean + Return Not (aDice Is Nothing) + End Function + + Protected Sub OnDieBounced() + RaiseEvent DieBounced() + End Sub + + Protected Sub OnDieFrozen(ByVal bUnFreeze As Boolean) + RaiseEvent DieFrozen(bUnFreeze) + End Sub + + 'new + 'don't roll if all frozen + Private Function AllDiceFrozen() As Boolean + + Dim d As Die + If ClickToFreeze Then + + For Each d In aDice + If Not d.Frozen Then + Return False + End If + Next + Return True + + End If + + End Function + + 'new + Public Sub ClearFreeze() + Dim d As Die + + If ClickToFreeze Then + + For Each d In aDice + If d.Frozen Then + d.Frozen = False + End If + Next + End If + + End Sub + + 'the score for the numeric 1-6 categories in Y + Public Function YhatzeeNumberScore(ByVal iNum As Integer) As Integer + + Dim d As Die + Dim iTot As Integer = 0 + + For Each d In aDice + If d.Result = iNum Then + iTot += iNum + End If + Next + Return iTot + + End Function + + Public Function YhatzeeeOfAKindScore(ByVal NumofAKind As Integer) As Integer + + Dim d As Die + Dim iOccur(6) As Integer + Dim i As Integer + + For Each d In aDice + iOccur(d.Result) += 1 + Next + + For i = 0 To 6 + If iOccur(i) >= NumofAKind Then + Return Me.Result + End If + Next + + End Function + + Public Function YhatzeeeFiveOfAKindScore() As Integer + + Const SCORE As Integer = 50 + + Dim d As Die + Dim iOccur(6) As Integer + Dim i As Integer + + For Each d In aDice + iOccur(d.Result) += 1 + Next + + For i = 0 To 6 + If iOccur(i) >= 5 Then + Return SCORE + End If + Next + + End Function + + Public Function YhatzeeeChanceScore() As Integer + Return Me.Result + End Function + + Public Function YhatzeeeSmallStraightScore() As Integer + + Const SCORE As Integer = 30 + Dim d As Die + Dim iOccur(6) As Integer + Dim i As Integer + + For Each d In aDice + iOccur(d.Result) += 1 + Next + + If iOccur(1) >= 1 And iOccur(2) >= 1 And iOccur(3) >= 1 And iOccur(4) >= 1 Then + Return SCORE + End If + + If iOccur(2) >= 1 And iOccur(3) >= 1 And iOccur(4) >= 1 And iOccur(5) >= 1 Then + Return SCORE + End If + + End Function + + Public Function YhatzeeeLargeStraightScore() As Integer + + Const SCORE As Integer = 40 + Dim d As Die + Dim iOccur(6) As Integer + Dim i As Integer + + For Each d In aDice + iOccur(d.Result) += 1 + Next + + If iOccur(1) = 1 And iOccur(2) = 1 And iOccur(3) = 1 And iOccur(4) = 1 And iOccur(5) = 1 Then + Return SCORE + End If + + If iOccur(2) = 1 And iOccur(3) = 1 And iOccur(4) = 1 And iOccur(5) = 1 And iOccur(6) = 1 Then + Return SCORE + End If + + End Function + + Public Function YhatzeeeFullHouseScore() As Integer + + Const SCORE As Integer = 25 + Dim d As Die + Dim iOccur(6) As Integer + Dim i As Integer + Dim bPair As Boolean + Dim bTrip As Boolean + + + For Each d In aDice + iOccur(d.Result) += 1 + Next + + For i = 0 To 6 + If iOccur(i) = 2 Then + bPair = True + ElseIf iOccur(i) = 3 Then + bTrip = True + End If + Next + + If bPair And bTrip Then + Return SCORE + End If + + End Function + + Private Class Die + + Private Const MAXMOVE As Integer = 5 + Private Enum DieStatus + dsStopped = 0 + dsRolling = 1 + dsLanding = 2 + End Enum + + Private FRollLoop As Integer + + Private h As Integer = 72 + Private w As Integer = 72 + Private FxPos As Integer + Private FyPos As Integer + + Private dxDir As Integer '-MAXMOVE to MAXMOVE + Private dyDir As Integer '-MAXMOVE to MAXMOVE, indicates direction moving + + Private FPanel As DicePanelNew + Private FStatus As DieStatus = DieStatus.dsLanding + + Public Sub New(ByVal pn As DicePanelNew) + MyBase.New() + FPanel = pn + End Sub + + Private FFrame As Integer + Private Property Frame() As Integer + Get + Return FFrame + End Get + Set(ByVal Value As Integer) + FFrame = Value + + If FFrame < 0 Then FFrame += 36 + If FFrame > 35 Then FFrame -= 36 + End Set + End Property + + + Private FResult As Integer 'result of the die, 1-6 + Property Result() As Integer + Get + Return FResult + End Get + Set(ByVal Value As Integer) + If Value < 1 Or Value > 6 Then + Throw New Exception("Invalid Die Value") + Else + FResult = Value + End If + End Set + End Property + + Private Property xPos() As Integer + Get + Return FxPos + End Get + Set(ByVal Value As Integer) + FxPos = Value + + If FxPos < 0 Then + FxPos = 0 + Call BounceX() + End If + If FxPos > FPanel.Width - w Then + FxPos = FPanel.Width - w + Call BounceX() + End If + End Set + End Property + + Private Property yPos() As Integer + Get + Return FyPos + End Get + Set(ByVal Value As Integer) + FyPos = Value + + If FyPos < 0 Then + FyPos = 0 + Call BounceY() + End If + If FyPos > FPanel.Height - h Then + FyPos = FPanel.Height - h + Call BounceY() + End If + End Set + End Property + + 'NEW - determines if die is 'locked' + Private FFrozen As Boolean + Property Frozen() As Boolean + Get + Return FFrozen + End Get + Set(ByVal Value As Boolean) + FFrozen = Value + FPanel.OnDieFrozen(FFrozen) + End Set + End Property + + Public Sub InitializeLocation() + Try + xPos = FPanel.FRand.Next(0, FPanel.Width - w) + yPos = FPanel.FRand.Next(0, FPanel.Height - h) + Catch oEX As Exception + xPos = 0 + yPos = 0 + End Try + End Sub + + Public Sub UpdateDiePosition() + + Select Case pStatus + Case DieStatus.dsLanding + 'if landing reduce the frame by 1, regardless of direction + Frame -= 1 + Case DieStatus.dsRolling + 'frame goes up or down based on y direction + Frame += (1 * Sign(dyDir)) + 'NEW - need because other dice might be moving if i've stopped + Case DieStatus.dsStopped + Exit Sub 'don't move if stopped + End Select + + 'update the position + xPos += dxDir + yPos += dyDir + + FRollLoop += 1 + + Select Case pStatus + Case DieStatus.dsRolling + 'after 75 frames, check for a small chance that the die will stop rolling + 'reduced to 75 frames from 100 for yhatzee, could be a property for user-customization + If FRollLoop > 75 And FPanel.FRand.Next(1, 100) < 10 Then + pStatus = DieStatus.dsLanding + FRollLoop = 0 + + Frame = Result * 6 + End If + + Case DieStatus.dsLanding + 'die lands for 6 frames and stops + If FRollLoop > 5 Then + pStatus = DieStatus.dsStopped + End If + End Select + + End Sub + + 'new, done for directional changing, collision but + Private Property pStatus() As DieStatus + Get + Return FStatus + End Get + Set(ByVal Value As DieStatus) + FStatus = Value + If Value = DieStatus.dsStopped Then + dxDir = 0 'stop direction + dyDir = 0 + + End If + End Set + End Property + + Public Sub InitializeRoll() + + 'new + If Not Frozen Then + Do + dxDir = FPanel.FRand.Next(-MAXMOVE, MAXMOVE + 1) + Loop Until Abs(dxDir) > 2 + Do + dyDir = FPanel.FRand.Next(-MAXMOVE, MAXMOVE + 1) + Loop Until Abs(dyDir) > 2 + Result = FPanel.FRand.Next(1, 7) 'decide what the result will be + + FRollLoop = 0 + pStatus = DieStatus.dsRolling + Else + pStatus = DieStatus.dsStopped + End If + End Sub + + Public Sub DrawDie(ByVal bDest As Bitmap) + + Dim gr As Graphics + Dim b As Bitmap + + Dim x As Integer = (Frame Mod 6) * w + Dim y As Integer = (Frame \ 6) * h + Dim r As New System.Drawing.Rectangle(x, y, w, h) + + 'select the correct bitmap based on what the die is doing, and what direction it's going + If pStatus = DieStatus.dsRolling Then + 'check quandrant rolling towards based on sign of xdir*ydir + If (dxDir * dyDir) > 0 Then + b = FPanel.FbyRot + Else + b = FPanel.FbxRot + End If + Else + b = FPanel.FbStop + End If + + gr = Graphics.FromImage(bDest) + Try + 'new + If Frozen Then + gr.DrawImage(FPanel.FbHalo, xPos, yPos, New Rectangle(0, 0, w, h), GraphicsUnit.Pixel) + End If + + gr.DrawImage(b, xPos, yPos, r, GraphicsUnit.Pixel) + If FPanel.DebugDrawMode Then + Dim p As New Pen(Color.Yellow) + Dim xc, yc As Single + + xc = xPos + (w \ 2) + yc = yPos + (h \ 2) + + gr.DrawRectangle(p, Me.Rect) + gr.DrawLine(p, xc, yc, xc + Sign(dxDir) * (w \ 2), yc + Sign(dyDir) * (h \ 2)) + End If + Finally + gr.Dispose() + End Try + + End Sub + + ReadOnly Property IsNotRolling() As Boolean + Get + Return pStatus = DieStatus.dsStopped + End Get + End Property + + ReadOnly Property IsRolling() As Boolean + Get + Return Not IsNotRolling + End Get + End Property + + ReadOnly Property Rect() As Rectangle + Get + Return New Rectangle(xPos, yPos, w, h) + End Get + End Property + + Public Function Overlapping(ByVal d As Die) As Boolean + Return d.Rect.IntersectsWith(Me.Rect) + End Function + + Public Sub HandleCollision(ByVal d As Die) + If Me.Overlapping(d) Then + If Abs(d.yPos - Me.yPos) <= Abs(d.xPos - Me.xPos) Then + HandleBounceX(d) + Else + HandleBounceY(d) + End If + End If + End Sub + + Private Sub HandleBounceX(ByVal d As Die) + + Dim dLeft As Die + Dim dRight As Die + + If Me.xPos < d.xPos Then + dLeft = Me + dRight = d + Else + dLeft = d + dRight = Me + End If + + 'moving toward each other + If dLeft.dxDir >= 0 And dRight.dxDir <= 0 Then + Me.BounceX() + d.BounceX() + Exit Sub + End If + + 'moving right, left one caught up to right one + If dLeft.dxDir > 0 And dRight.dxDir >= 0 Then + dLeft.BounceX() + Exit Sub + End If + + 'moving left, right one caught up to left one + If dLeft.dxDir <= 0 And dRight.dxDir < 0 Then + dRight.BounceX() + End If + + End Sub + + Private Sub HandleBounceY(ByVal d As Die) + + Dim dTop As Die + Dim dBot As Die + + If Me.yPos < d.yPos Then + dTop = Me + dBot = d + Else + dTop = d + dBot = Me + End If + + If dTop.dyDir >= 0 And dBot.dyDir <= 0 Then + Me.BounceY() + d.BounceY() + Exit Sub + End If + + 'moving down, top one caught up to bottom one + If dTop.dyDir > 0 And dBot.dyDir >= 0 Then + dTop.BounceY() + Exit Sub + End If + + 'moving left, bottom one caught up to top one + If dTop.dyDir <= 0 And dBot.dyDir < 0 Then + dBot.BounceY() + End If + + End Sub + + Private Sub BounceX() + dxDir = -dxDir + + 'no sound if not moving + If pStatus <> DieStatus.dsStopped Then + FPanel.OnDieBounced() + End If + End Sub + + Private Sub BounceY() + dyDir = -dyDir + + 'no sound if not moving + If pStatus <> DieStatus.dsStopped Then + FPanel.OnDieBounced() + End If + End Sub + + 'new + Public Function ClickedOn(ByVal x As Integer, ByVal y As Integer) As Boolean + Return Me.Rect.Contains(x, y) + End Function + + End Class + + End Class +End Namespace \ No newline at end of file diff --git a/Files/DicePanelNew/DicePanelNew.vbproj b/Files/DicePanelNew/DicePanelNew.vbproj new file mode 100644 index 0000000..e235e64 --- /dev/null +++ b/Files/DicePanelNew/DicePanelNew.vbproj @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/DicePanelNew/DicePanelNew.vbproj.user b/Files/DicePanelNew/DicePanelNew.vbproj.user new file mode 100644 index 0000000..478a130 --- /dev/null +++ b/Files/DicePanelNew/DicePanelNew.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/DicePanelNew/bin/DicePanelNew.dll b/Files/DicePanelNew/bin/DicePanelNew.dll new file mode 100644 index 0000000..f2b80ea Binary files /dev/null and b/Files/DicePanelNew/bin/DicePanelNew.dll differ diff --git a/Files/DicePanelNew/bin/DicePanelNew.pdb b/Files/DicePanelNew/bin/DicePanelNew.pdb new file mode 100644 index 0000000..6f77a79 Binary files /dev/null and b/Files/DicePanelNew/bin/DicePanelNew.pdb differ diff --git a/Files/DicePanelNew/obj/Debug/DicePanel.DicePanel.DicePanel.resources b/Files/DicePanelNew/obj/Debug/DicePanel.DicePanel.DicePanel.resources new file mode 100644 index 0000000..4e892e6 Binary files /dev/null and b/Files/DicePanelNew/obj/Debug/DicePanel.DicePanel.DicePanel.resources differ diff --git a/Files/DicePanelNew/obj/Debug/DicePanel.dll b/Files/DicePanelNew/obj/Debug/DicePanel.dll new file mode 100644 index 0000000..9521d20 Binary files /dev/null and b/Files/DicePanelNew/obj/Debug/DicePanel.dll differ diff --git a/Files/DicePanelNew/obj/Debug/DicePanel.pdb b/Files/DicePanelNew/obj/Debug/DicePanel.pdb new file mode 100644 index 0000000..d68ba38 Binary files /dev/null and b/Files/DicePanelNew/obj/Debug/DicePanel.pdb differ diff --git a/Files/DicePanelNew/obj/Debug/DicePanelNew.DicePanelNew.DicePanelNew.resources b/Files/DicePanelNew/obj/Debug/DicePanelNew.DicePanelNew.DicePanelNew.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/DicePanelNew/obj/Debug/DicePanelNew.DicePanelNew.DicePanelNew.resources differ diff --git a/Files/DicePanelNew/obj/Debug/DicePanelNew.dll b/Files/DicePanelNew/obj/Debug/DicePanelNew.dll new file mode 100644 index 0000000..f2b80ea Binary files /dev/null and b/Files/DicePanelNew/obj/Debug/DicePanelNew.dll differ diff --git a/Files/DicePanelNew/obj/Debug/DicePanelNew.pdb b/Files/DicePanelNew/obj/Debug/DicePanelNew.pdb new file mode 100644 index 0000000..6f77a79 Binary files /dev/null and b/Files/DicePanelNew/obj/Debug/DicePanelNew.pdb differ diff --git a/Files/DirectXDemo/AssemblyInfo.vb b/Files/DirectXDemo/AssemblyInfo.vb new file mode 100644 index 0000000..f28451f --- /dev/null +++ b/Files/DirectXDemo/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/DirectXDemo/DirectXDemo.sln b/Files/DirectXDemo/DirectXDemo.sln new file mode 100644 index 0000000..37c7153 --- /dev/null +++ b/Files/DirectXDemo/DirectXDemo.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DirectXDemo", "DirectXDemo.vbproj", "{D68CABC5-7EEA-4E87-9D67-C2159CE9565E}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {D68CABC5-7EEA-4E87-9D67-C2159CE9565E}.Debug.ActiveCfg = Debug|.NET + {D68CABC5-7EEA-4E87-9D67-C2159CE9565E}.Debug.Build.0 = Debug|.NET + {D68CABC5-7EEA-4E87-9D67-C2159CE9565E}.Release.ActiveCfg = Release|.NET + {D68CABC5-7EEA-4E87-9D67-C2159CE9565E}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/DirectXDemo/DirectXDemo.suo b/Files/DirectXDemo/DirectXDemo.suo new file mode 100644 index 0000000..eeccf94 Binary files /dev/null and b/Files/DirectXDemo/DirectXDemo.suo differ diff --git a/Files/DirectXDemo/DirectXDemo.vbproj b/Files/DirectXDemo/DirectXDemo.vbproj new file mode 100644 index 0000000..0077a5f --- /dev/null +++ b/Files/DirectXDemo/DirectXDemo.vbproj @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/DirectXDemo/DirectXDemo.vbproj.user b/Files/DirectXDemo/DirectXDemo.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Files/DirectXDemo/DirectXDemo.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/DirectXDemo/Form1.resx b/Files/DirectXDemo/Form1.resx new file mode 100644 index 0000000..179f9b0 --- /dev/null +++ b/Files/DirectXDemo/Form1.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + Form1 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/DirectXDemo/Form1.vb b/Files/DirectXDemo/Form1.vb new file mode 100644 index 0000000..a9cd0b0 --- /dev/null +++ b/Files/DirectXDemo/Form1.vb @@ -0,0 +1,204 @@ +Imports Microsoft.DirectX +Imports Microsoft.DirectX.DirectDraw + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None + Me.Name = "Form1" + Me.Text = "Form1" + + End Sub + +#End Region + Private Const WID As Integer = 1024 + Private Const HGT As Integer = 768 + Private Const NUMDICE As Integer = 250 + + Private FNeedToRestore As Boolean + Private FDraw As Microsoft.DirectX.DirectDraw.Device + Private FFront As Microsoft.DirectX.DirectDraw.Surface + Private FBack As Microsoft.DirectX.DirectDraw.Surface + Private FDieSurf As Microsoft.DirectX.DirectDraw.Surface + + Private FDice As ArrayList + + Private Sub Form1_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + Me.Cursor.Dispose() 'byebye cursor + InitializeDirectDraw() + SetupDice() + + While Created + DrawFrame() + End While + End Sub + + Private Sub InitializeDirectDraw() + + Dim oSurfaceDesc As New SurfaceDescription + Dim oSurfaceCaps As New SurfaceCaps + Dim i As Integer + + FDraw = New Microsoft.DirectX.DirectDraw.Device + + FDraw.SetCooperativeLevel(Me, _ + Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.FullscreenExclusive) + + FDraw.SetDisplayMode(WID, HGT, 16, 0, False) + + With oSurfaceDesc + .SurfaceCaps.PrimarySurface = True + .SurfaceCaps.Flip = True + .SurfaceCaps.Complex = True + .BackBufferCount = 1 + FFront = New Surface(oSurfaceDesc, FDraw) + oSurfaceCaps.BackBuffer = True + FBack = FFront.GetAttachedSurface(oSurfaceCaps) + FBack.ForeColor = Color.White + .Clear() + End With + + FNeedToRestore = True + + End Sub + + Public Sub RestoreSurfaces() + + Dim oCK As New ColorKey + + FDraw.RestoreAllSurfaces() + + Dim a As Reflection.Assembly = _ + System.Reflection.Assembly.GetExecutingAssembly() + + If Not FDieSurf Is Nothing Then + FDieSurf.Dispose() + FDieSurf = Nothing + End If + + FDieSurf = New Surface(a.GetManifestResourceStream( _ + "DirectXDemo.dicexrot.bmp"), New SurfaceDescription, FDraw) + + FDieSurf.SetColorKey(ColorKeyFlags.SourceDraw, oCK) + + End Sub + + Private Sub SetupDice() + + Dim d As SimpleDie + Dim r As New Random + + FDice = New ArrayList + Do While FDice.Count < NUMDICE + d = New SimpleDie(New Point(r.Next(0, WID - 72), r.Next(0, HGT - 72))) + FDice.Add(d) + Loop + + End Sub + + Private Sub DrawFrame() + + Dim d As SimpleDie + + If FFront Is Nothing Then Exit Sub + + 'can't draw now, device not ready + If Not FDraw.TestCooperativeLevel() Then + FNeedToRestore = True + Exit Sub + End If + + If FNeedToRestore Then + RestoreSurfaces() + FNeedToRestore = False + End If + + FBack.ColorFill(0) + For Each d In FDice + d.Draw(FBack, FDieSurf) + Next + + Try + FBack.ForeColor = Color.White + FBack.DrawText(10, 10, "Press escape to exit", False) + FFront.Flip(FBack, FlipFlags.DoNotWait) + Catch oEX As Exception + Debug.WriteLine(oEX.Message) + Finally + Application.DoEvents() + End Try + + End Sub + + Private Sub Form1_KeyUp(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp + + If e.KeyCode = Keys.Escape Then + Me.Close() + End If + End Sub + +End Class + +Public Class SimpleDie + Private FLocation As Point + Private FFrame As Integer + + Public Sub New(ByVal p As Point) + FLocation = p + End Sub + + ReadOnly Property pLocation() As Point + Get + Return FLocation + End Get + End Property + + Public Sub Draw(ByVal FDest As Surface, ByVal FSource As Surface) + + Dim oRect As Rectangle + + oRect = New Rectangle((FFrame Mod 6) * 72, (FFrame \ 6) * 72, 72, 72) + + FDest.DrawFast(FLocation.X, FLocation.Y, FSource, oRect, _ + DrawFastFlags.DoNotWait Or DrawFastFlags.SourceColorKey) + + FFrame = (FFrame + 1) Mod 36 + End Sub +End Class \ No newline at end of file diff --git a/Files/DirectXDemo/bin/DirectXDemo.exe b/Files/DirectXDemo/bin/DirectXDemo.exe new file mode 100644 index 0000000..749d3d3 Binary files /dev/null and b/Files/DirectXDemo/bin/DirectXDemo.exe differ diff --git a/Files/DirectXDemo/bin/DirectXDemo.pdb b/Files/DirectXDemo/bin/DirectXDemo.pdb new file mode 100644 index 0000000..fbb0723 Binary files /dev/null and b/Files/DirectXDemo/bin/DirectXDemo.pdb differ diff --git a/Files/DirectXDemo/obj/Debug/DirectXDemo.Form1.resources b/Files/DirectXDemo/obj/Debug/DirectXDemo.Form1.resources new file mode 100644 index 0000000..ff93659 Binary files /dev/null and b/Files/DirectXDemo/obj/Debug/DirectXDemo.Form1.resources differ diff --git a/Files/DirectXDemo/obj/Debug/DirectXDemo.exe b/Files/DirectXDemo/obj/Debug/DirectXDemo.exe new file mode 100644 index 0000000..749d3d3 Binary files /dev/null and b/Files/DirectXDemo/obj/Debug/DirectXDemo.exe differ diff --git a/Files/DirectXDemo/obj/Debug/DirectXDemo.pdb b/Files/DirectXDemo/obj/Debug/DirectXDemo.pdb new file mode 100644 index 0000000..fbb0723 Binary files /dev/null and b/Files/DirectXDemo/obj/Debug/DirectXDemo.pdb differ diff --git a/Files/FirstApplication/AssemblyInfo.vb b/Files/FirstApplication/AssemblyInfo.vb new file mode 100644 index 0000000..bfb3aaa --- /dev/null +++ b/Files/FirstApplication/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/FirstApplication/FirstApplication.sln b/Files/FirstApplication/FirstApplication.sln new file mode 100644 index 0000000..0aaed18 --- /dev/null +++ b/Files/FirstApplication/FirstApplication.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FirstApplication", "FirstApplication.vbproj", "{E7DE4526-6703-4B86-9102-D5326AE7A4AA}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E7DE4526-6703-4B86-9102-D5326AE7A4AA}.Debug.ActiveCfg = Debug|.NET + {E7DE4526-6703-4B86-9102-D5326AE7A4AA}.Debug.Build.0 = Debug|.NET + {E7DE4526-6703-4B86-9102-D5326AE7A4AA}.Release.ActiveCfg = Release|.NET + {E7DE4526-6703-4B86-9102-D5326AE7A4AA}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/FirstApplication/FirstApplication.suo b/Files/FirstApplication/FirstApplication.suo new file mode 100644 index 0000000..f12e48f Binary files /dev/null and b/Files/FirstApplication/FirstApplication.suo differ diff --git a/Files/FirstApplication/FirstApplication.vbproj b/Files/FirstApplication/FirstApplication.vbproj new file mode 100644 index 0000000..16da4cd --- /dev/null +++ b/Files/FirstApplication/FirstApplication.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/FirstApplication/FirstApplication.vbproj.user b/Files/FirstApplication/FirstApplication.vbproj.user new file mode 100644 index 0000000..77f7b49 --- /dev/null +++ b/Files/FirstApplication/FirstApplication.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/FirstApplication/Form1.resx b/Files/FirstApplication/Form1.resx new file mode 100644 index 0000000..8232d46 --- /dev/null +++ b/Files/FirstApplication/Form1.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + Form1 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/FirstApplication/Form1.vb b/Files/FirstApplication/Form1.vb new file mode 100644 index 0000000..80a24db --- /dev/null +++ b/Files/FirstApplication/Form1.vb @@ -0,0 +1,151 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Button2 As System.Windows.Forms.Button + Friend WithEvents Button3 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button + Me.Label1 = New System.Windows.Forms.Label + Me.Button2 = New System.Windows.Forms.Button + Me.Button3 = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(16, 72) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(104, 23) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "operators" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(16, 16) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(248, 48) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "This application shows simple basic syntax examples behind each button, which are" & _ + " explained in Appendix A" + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(16, 104) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(104, 23) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "loops and If-Then" + ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(16, 136) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(104, 23) + Me.Button3.TabIndex = 3 + Me.Button3.Text = "Functions" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(292, 266) + Me.Controls.Add(Me.Button3) + Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.Button1) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.Text = "Form1" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click + + Dim x As Integer + Dim y As Integer + Dim r As Integer + + x = 41 + y = 35 + + r = x + y + Debug.WriteLine("answer is " & r) + + r = x - y + Debug.WriteLine("answer is " & r) + End Sub + + Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + + Dim iVal As Integer + + For iVal = 1 To 10 + If iVal Mod 2 = 0 Then + Debug.WriteLine(iVal & " is even") + Else + Debug.WriteLine(iVal & " is odd") + End If + Next + + End Sub + + Private Sub Button3_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles Button3.Click + + Dim iVal As Integer + + For iVal = 1 To 10 + If IsAnEvenNumber(iVal) Then + Call OutputResult(iVal, "even") + Else + Call OutputResult(iVal, "odd") + End If + Next + + End Sub + + Function IsAnEvenNumber(ByVal iVal As Integer) As Boolean + + If iVal Mod 2 = 0 Then + Return True + Else + Return False + End If + + End Function + + Sub OutputResult(ByVal iVal As Integer, ByVal cResult As String) + Debug.WriteLine(iVal & " is " & cResult) + End Sub +End Class diff --git a/Files/FirstApplication/bin/FirstApplication.exe b/Files/FirstApplication/bin/FirstApplication.exe new file mode 100644 index 0000000..142234b Binary files /dev/null and b/Files/FirstApplication/bin/FirstApplication.exe differ diff --git a/Files/FirstApplication/bin/FirstApplication.pdb b/Files/FirstApplication/bin/FirstApplication.pdb new file mode 100644 index 0000000..c338f9e Binary files /dev/null and b/Files/FirstApplication/bin/FirstApplication.pdb differ diff --git a/Files/FirstApplication/obj/Debug/FirstApplication.Form1.resources b/Files/FirstApplication/obj/Debug/FirstApplication.Form1.resources new file mode 100644 index 0000000..0e54fb4 Binary files /dev/null and b/Files/FirstApplication/obj/Debug/FirstApplication.Form1.resources differ diff --git a/Files/FirstApplication/obj/Debug/FirstApplication.exe b/Files/FirstApplication/obj/Debug/FirstApplication.exe new file mode 100644 index 0000000..142234b Binary files /dev/null and b/Files/FirstApplication/obj/Debug/FirstApplication.exe differ diff --git a/Files/FirstApplication/obj/Debug/FirstApplication.pdb b/Files/FirstApplication/obj/Debug/FirstApplication.pdb new file mode 100644 index 0000000..c338f9e Binary files /dev/null and b/Files/FirstApplication/obj/Debug/FirstApplication.pdb differ diff --git a/Files/GarbageDemoOne/AssemblyInfo.vb b/Files/GarbageDemoOne/AssemblyInfo.vb new file mode 100644 index 0000000..d09767f --- /dev/null +++ b/Files/GarbageDemoOne/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/GarbageDemoOne/Form1.resx b/Files/GarbageDemoOne/Form1.resx new file mode 100644 index 0000000..6934ccf --- /dev/null +++ b/Files/GarbageDemoOne/Form1.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + (Default) + + + False + + + False + + + Form1 + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/GarbageDemoOne/Form1.vb b/Files/GarbageDemoOne/Form1.vb new file mode 100644 index 0000000..0129c3c --- /dev/null +++ b/Files/GarbageDemoOne/Form1.vb @@ -0,0 +1,80 @@ +Imports System.io + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.Text = "Finalize Demo" + + End Sub + +#End Region + + Private oHog As ResourceHog + + Private Sub Form1_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + oHog = New ResourceHog(Application.ExecutablePath) + End Sub +End Class + + +Class ResourceHog + + Private f As FileStream + Private oRead As BinaryReader + + Public Sub New(ByVal cFilename As String) + MyBase.New() + + f = New FileStream(cFilename, FileMode.Open, FileAccess.Read) + oRead = New BinaryReader(f) + Debug.WriteLine("file opened " & DateTime.Now) + End Sub + + Protected Overrides Sub Finalize() + MyBase.Finalize() + + oRead.Close() + f.Close() + Debug.WriteLine("file closed " & DateTime.Now) + End Sub + +End Class + diff --git a/Files/GarbageDemoOne/GarbageDemoOne.sln b/Files/GarbageDemoOne/GarbageDemoOne.sln new file mode 100644 index 0000000..5cd85e8 --- /dev/null +++ b/Files/GarbageDemoOne/GarbageDemoOne.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GarbageDemoOne", "GarbageDemoOne.vbproj", "{0AABB465-93E5-4227-9B71-D3E71372D975}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {0AABB465-93E5-4227-9B71-D3E71372D975}.Debug.ActiveCfg = Debug|.NET + {0AABB465-93E5-4227-9B71-D3E71372D975}.Debug.Build.0 = Debug|.NET + {0AABB465-93E5-4227-9B71-D3E71372D975}.Release.ActiveCfg = Release|.NET + {0AABB465-93E5-4227-9B71-D3E71372D975}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GarbageDemoOne/GarbageDemoOne.suo b/Files/GarbageDemoOne/GarbageDemoOne.suo new file mode 100644 index 0000000..edd15cb Binary files /dev/null and b/Files/GarbageDemoOne/GarbageDemoOne.suo differ diff --git a/Files/GarbageDemoOne/GarbageDemoOne.vbproj b/Files/GarbageDemoOne/GarbageDemoOne.vbproj new file mode 100644 index 0000000..30a5105 --- /dev/null +++ b/Files/GarbageDemoOne/GarbageDemoOne.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/GarbageDemoOne/GarbageDemoOne.vbproj.user b/Files/GarbageDemoOne/GarbageDemoOne.vbproj.user new file mode 100644 index 0000000..d97d2f1 --- /dev/null +++ b/Files/GarbageDemoOne/GarbageDemoOne.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/GarbageDemoOne/bin/GarbageDemoOne.exe b/Files/GarbageDemoOne/bin/GarbageDemoOne.exe new file mode 100644 index 0000000..e38e769 Binary files /dev/null and b/Files/GarbageDemoOne/bin/GarbageDemoOne.exe differ diff --git a/Files/GarbageDemoOne/bin/GarbageDemoOne.pdb b/Files/GarbageDemoOne/bin/GarbageDemoOne.pdb new file mode 100644 index 0000000..cf644b4 Binary files /dev/null and b/Files/GarbageDemoOne/bin/GarbageDemoOne.pdb differ diff --git a/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.Form1.resources b/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.Form1.resources new file mode 100644 index 0000000..ff93659 Binary files /dev/null and b/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.Form1.resources differ diff --git a/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.exe b/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.exe new file mode 100644 index 0000000..e38e769 Binary files /dev/null and b/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.exe differ diff --git a/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.pdb b/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.pdb new file mode 100644 index 0000000..cf644b4 Binary files /dev/null and b/Files/GarbageDemoOne/obj/Debug/GarbageDemoOne.pdb differ diff --git a/Files/GarbageDemoTwo/AssemblyInfo.vb b/Files/GarbageDemoTwo/AssemblyInfo.vb new file mode 100644 index 0000000..805c83f --- /dev/null +++ b/Files/GarbageDemoTwo/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/GarbageDemoTwo/Form1.resx b/Files/GarbageDemoTwo/Form1.resx new file mode 100644 index 0000000..3ac5284 --- /dev/null +++ b/Files/GarbageDemoTwo/Form1.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Files/GarbageDemoTwo/Form1.vb b/Files/GarbageDemoTwo/Form1.vb new file mode 100644 index 0000000..291fb61 --- /dev/null +++ b/Files/GarbageDemoTwo/Form1.vb @@ -0,0 +1,121 @@ +Imports System.IO + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Button1 As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(24, 64) + Me.Button1.Name = "Button1" + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Button1" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.Controls.Add(Me.Button1) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.Text = "Form1" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private oHogLong As DisposableResourceHog + + Private Sub Form1_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + oHogLong = New DisposableResourceHog(Application.ExecutablePath, "Long") + + End Sub + + Private Sub Button1_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles Button1.Click + + Dim oHog As DisposableResourceHog + + oHog = New DisposableResourceHog(Application.ExecutablePath, "Short") + oHog.Dispose() + End Sub +End Class + +Public Class DisposableResourceHog + Implements IDisposable + + Private f As FileStream + Private oRead As BinaryReader + Private FName As String + + Public Sub New(ByVal cFilename As String, ByVal cName As String) + MyBase.New() + + FName = cName + f = New FileStream(cFilename, FileMode.Open, FileAccess.Read) + oRead = New BinaryReader(f) + Debug.WriteLine(FName & " file opened " & DateTime.Now) + + End Sub + + Protected Overrides Sub Finalize() + MyBase.Finalize() + Dispose(False) + End Sub + + Public Overloads Sub Dispose() Implements System.IDisposable.Dispose + Dispose(True) + GC.SuppressFinalize(Me) + End Sub + + Private Disposed As Boolean = False + + Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean) + If Not Me.Disposed Then + + If disposing Then + oRead.Close() + f.Close() + Debug.WriteLine(FName & " file closed " & DateTime.Now) + End If + End If + + Me.Disposed = True + End Sub + +End Class diff --git a/Files/GarbageDemoTwo/GarbageDemoTwo.sln b/Files/GarbageDemoTwo/GarbageDemoTwo.sln new file mode 100644 index 0000000..8845727 --- /dev/null +++ b/Files/GarbageDemoTwo/GarbageDemoTwo.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GarbageDemoTwo", "GarbageDemoTwo.vbproj", "{ACD80312-D007-4C37-8E80-80F920546D5B}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {ACD80312-D007-4C37-8E80-80F920546D5B}.Debug.ActiveCfg = Debug|.NET + {ACD80312-D007-4C37-8E80-80F920546D5B}.Debug.Build.0 = Debug|.NET + {ACD80312-D007-4C37-8E80-80F920546D5B}.Release.ActiveCfg = Release|.NET + {ACD80312-D007-4C37-8E80-80F920546D5B}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GarbageDemoTwo/GarbageDemoTwo.suo b/Files/GarbageDemoTwo/GarbageDemoTwo.suo new file mode 100644 index 0000000..df0c02e Binary files /dev/null and b/Files/GarbageDemoTwo/GarbageDemoTwo.suo differ diff --git a/Files/GarbageDemoTwo/GarbageDemoTwo.vbproj b/Files/GarbageDemoTwo/GarbageDemoTwo.vbproj new file mode 100644 index 0000000..5f40c43 --- /dev/null +++ b/Files/GarbageDemoTwo/GarbageDemoTwo.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/GarbageDemoTwo/GarbageDemoTwo.vbproj.user b/Files/GarbageDemoTwo/GarbageDemoTwo.vbproj.user new file mode 100644 index 0000000..d97d2f1 --- /dev/null +++ b/Files/GarbageDemoTwo/GarbageDemoTwo.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/GarbageDemoTwo/bin/GarbageDemoTwo.exe b/Files/GarbageDemoTwo/bin/GarbageDemoTwo.exe new file mode 100644 index 0000000..18bbf11 Binary files /dev/null and b/Files/GarbageDemoTwo/bin/GarbageDemoTwo.exe differ diff --git a/Files/GarbageDemoTwo/bin/GarbageDemoTwo.pdb b/Files/GarbageDemoTwo/bin/GarbageDemoTwo.pdb new file mode 100644 index 0000000..0f8731b Binary files /dev/null and b/Files/GarbageDemoTwo/bin/GarbageDemoTwo.pdb differ diff --git a/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.Form1.resources b/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.Form1.resources new file mode 100644 index 0000000..030965f Binary files /dev/null and b/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.Form1.resources differ diff --git a/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.exe b/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.exe new file mode 100644 index 0000000..18bbf11 Binary files /dev/null and b/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.exe differ diff --git a/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.pdb b/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.pdb new file mode 100644 index 0000000..0f8731b Binary files /dev/null and b/Files/GarbageDemoTwo/obj/Debug/GarbageDemoTwo.pdb differ diff --git a/Files/GuessTheDieRoll/AssemblyInfo.vb b/Files/GuessTheDieRoll/AssemblyInfo.vb new file mode 100644 index 0000000..558021e --- /dev/null +++ b/Files/GuessTheDieRoll/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/GuessTheDieRoll/Form1.resx b/Files/GuessTheDieRoll/Form1.resx new file mode 100644 index 0000000..7c25001 --- /dev/null +++ b/Files/GuessTheDieRoll/Form1.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + fGuess + + + Assembly + + \ No newline at end of file diff --git a/Files/GuessTheDieRoll/Form1.vb b/Files/GuessTheDieRoll/Form1.vb new file mode 100644 index 0000000..66a63d0 --- /dev/null +++ b/Files/GuessTheDieRoll/Form1.vb @@ -0,0 +1,399 @@ + +Public Class fGuess + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents lbOne As System.Windows.Forms.Label + Friend WithEvents lbTwo As System.Windows.Forms.Label + Friend WithEvents lbThree As System.Windows.Forms.Label + Friend WithEvents lbSix As System.Windows.Forms.Label + Friend WithEvents lbFive As System.Windows.Forms.Label + Friend WithEvents lbFour As System.Windows.Forms.Label + Friend WithEvents lbResult As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.lbOne = New System.Windows.Forms.Label + Me.lbTwo = New System.Windows.Forms.Label + Me.lbThree = New System.Windows.Forms.Label + Me.lbSix = New System.Windows.Forms.Label + Me.lbFive = New System.Windows.Forms.Label + Me.lbFour = New System.Windows.Forms.Label + Me.lbResult = New System.Windows.Forms.Label + Me.SuspendLayout() + ' + 'lbOne + ' + Me.lbOne.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbOne.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbOne.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbOne.Location = New System.Drawing.Point(26, 24) + Me.lbOne.Name = "lbOne" + Me.lbOne.Size = New System.Drawing.Size(56, 48) + Me.lbOne.TabIndex = 7 + Me.lbOne.Tag = "Yes" + Me.lbOne.Text = "1" + Me.lbOne.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbTwo + ' + Me.lbTwo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbTwo.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbTwo.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbTwo.Location = New System.Drawing.Point(94, 24) + Me.lbTwo.Name = "lbTwo" + Me.lbTwo.Size = New System.Drawing.Size(56, 48) + Me.lbTwo.TabIndex = 8 + Me.lbTwo.Tag = "Yes" + Me.lbTwo.Text = "2" + Me.lbTwo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbThree + ' + Me.lbThree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbThree.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbThree.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbThree.Location = New System.Drawing.Point(162, 24) + Me.lbThree.Name = "lbThree" + Me.lbThree.Size = New System.Drawing.Size(56, 48) + Me.lbThree.TabIndex = 9 + Me.lbThree.Tag = "Yes" + Me.lbThree.Text = "3" + Me.lbThree.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbSix + ' + Me.lbSix.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbSix.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbSix.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbSix.Location = New System.Drawing.Point(366, 24) + Me.lbSix.Name = "lbSix" + Me.lbSix.Size = New System.Drawing.Size(56, 48) + Me.lbSix.TabIndex = 12 + Me.lbSix.Tag = "Yes" + Me.lbSix.Text = "6" + Me.lbSix.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbFive + ' + Me.lbFive.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbFive.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbFive.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbFive.Location = New System.Drawing.Point(298, 24) + Me.lbFive.Name = "lbFive" + Me.lbFive.Size = New System.Drawing.Size(56, 48) + Me.lbFive.TabIndex = 11 + Me.lbFive.Tag = "Yes" + Me.lbFive.Text = "5" + Me.lbFive.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbFour + ' + Me.lbFour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbFour.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbFour.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbFour.Location = New System.Drawing.Point(230, 24) + Me.lbFour.Name = "lbFour" + Me.lbFour.Size = New System.Drawing.Size(56, 48) + Me.lbFour.TabIndex = 10 + Me.lbFour.Tag = "Yes" + Me.lbFour.Text = "4" + Me.lbFour.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbResult + ' + Me.lbResult.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbResult.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lbResult.Location = New System.Drawing.Point(24, 80) + Me.lbResult.Name = "lbResult" + Me.lbResult.Size = New System.Drawing.Size(392, 16) + Me.lbResult.TabIndex = 13 + Me.lbResult.Text = "Correct!" + Me.lbResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'fGuess + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(448, 381) + Me.Controls.Add(Me.lbResult) + Me.Controls.Add(Me.lbSix) + Me.Controls.Add(Me.lbFive) + Me.Controls.Add(Me.lbFour) + Me.Controls.Add(Me.lbThree) + Me.Controls.Add(Me.lbTwo) + Me.Controls.Add(Me.lbOne) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "fGuess" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Guess the Die Roll" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private pnLower As PaintPanel + Private bmBack As Bitmap 'background bitmap + + Private bmStop As Bitmap + Private bmxRot As Bitmap + Private bmyRot As Bitmap + + Private oRand As Random + + Const HGT As Integer = 144 + Const WID As Integer = 144 + + Private diexPos As Integer + Private dieyPos As Integer + Private diexDir As Integer '-8 to 8 + Private dieyDir As Integer '-8 to 8, indicates direction moving + Private dieResult As Integer 'result of the die, 1-6 + Private dieFrame As Integer + + Private Enum DieMovementStatus + dmsStopped = 0 + dmsRolling = 1 + dmsLanding = 2 + End Enum + Private dieStatus As DieMovementStatus = DieMovementStatus.dmsLanding + + Private FGuess As Integer + Property Guess() As Integer + Get + Return FGuess + End Get + + Set(ByVal Value As Integer) + FGuess = Value + End Set + End Property + + Private Sub fGuess_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + pnLower = New PaintPanel + pnLower.BackColor = Color.Black + pnLower.Dock = DockStyle.Bottom + pnLower.Visible = True + AddHandler pnLower.Paint, AddressOf pnLower_Paint + Me.Controls.Add(pnLower) + pnLower.Height = Me.Height - lbResult.Height - lbResult.Top - 48 + + bmBack = New Bitmap(pnLower.Width, pnLower.Height) + + 'initialize the random number generator + oRand = New Random + + Guess = oRand.Next(1, 7) + Call UpdateGuessButtons() + dieFrame = (Guess - 1) * 6 + + Dim a As Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + bmxRot = New Bitmap(a.GetManifestResourceStream("GuessTheDieRoll.dicexrot.bmp")) + bmyRot = New Bitmap(a.GetManifestResourceStream("GuessTheDieRoll.diceyrot.bmp")) + bmStop = New Bitmap(a.GetManifestResourceStream("GuessTheDieRoll.dicedone.bmp")) + + 'initialize the location of the die + diexPos = oRand.Next(0, pnLower.Width - WID) + dieyPos = oRand.Next(0, pnLower.Height - HGT) + DrawDie() + + lbResult.Text = "" + End Sub + + Private Sub cbButtonClick(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles lbOne.Click, _ + lbTwo.Click, lbThree.Click, lbFour.Click, lbFive.Click, lbSix.Click + + Guess = CInt(CType(sender, Label).Text) + Call UpdateGuessButtons() + Call RollTheDie() + + If dieResult = Guess Then + lbResult.Text = "Correct!" + Else + lbResult.Text = "Try Again" + End If + End Sub + + Private Sub pnLower_Paint(ByVal sender As System.Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) + + e.Graphics.DrawImage(bmBack, 0, 0) + End Sub + + Private Sub RollTheDie() + + Dim iLoop As Integer = 0 + + lbResult.Text = "" + + 'initialize the directions, 0/1 no good + Do + diexDir = oRand.Next(-8, 9) + Loop Until Math.Abs(diexDir) > 3 + Do + dieyDir = oRand.Next(-8, 9) + Loop Until Math.Abs(dieyDir) > 3 + + 'decide what the result will be + dieResult = oRand.Next(1, 7) + + Application.DoEvents() + Me.Cursor = Cursors.WaitCursor + + dieStatus = DieMovementStatus.dmsRolling + Do + UpdateDiePosition() + DrawDie() + + iLoop += 1 + + Select Case dieStatus + Case DieMovementStatus.dmsRolling + 'after 100 frames, have a 15% chance + 'that the die will stop rolling + If iLoop > 100 And oRand.Next(1, 100) < 10 Then + dieStatus = DieMovementStatus.dmsLanding + iLoop = 0 + + dieFrame = dieResult * 6 + End If + + Case DieMovementStatus.dmsLanding + 'die lands for 6 frames and stops + If iLoop > 5 Then + dieStatus = DieMovementStatus.dmsStopped + End If + End Select + + Loop Until dieStatus = DieMovementStatus.dmsStopped + Me.Cursor = Cursors.Default + + End Sub + + Private Sub UpdateDiePosition() + + Select Case dieStatus + Case DieMovementStatus.dmsLanding + 'if landing reduce the frame by 1, regardless of direction + dieFrame -= 1 + Case DieMovementStatus.dmsRolling + 'frame goes up or down based on y direction + dieFrame += Math.Sign(dieyDir) + End Select + If dieFrame < 0 Then dieFrame += 36 + If dieFrame > 35 Then dieFrame -= 36 + + 'update the position + + diexPos += diexDir + + 'bounce for x + If diexPos < 0 Then + diexPos = 0 + diexDir = -diexDir + End If + If diexPos > pnLower.Width - WID Then + diexPos = pnLower.Width - WID + diexDir = -diexDir + End If + + dieyPos += dieyDir + 'bounce for y + If dieyPos < 0 Then + dieyPos = 0 + dieyDir = -dieyDir + End If + If dieyPos > pnLower.Height - HGT Then + dieyPos = pnLower.Height - HGT + dieyDir = -dieyDir + End If + + End Sub + + Private Sub DrawDie() + + Dim gr As Graphics + Dim oBitmap As Bitmap + + Dim x As Integer = (dieFrame Mod 6) * WID + Dim y As Integer = (dieFrame \ 6) * HGT + Dim r As New System.Drawing.Rectangle(x, y, WID, HGT) + + 'select the correct bitmap based on what the die is doing, and what direction it's going + If dieStatus = DieMovementStatus.dmsRolling Then + 'check quandrant rolling towards based on sign of xdir*ydir + If (diexDir * dieyDir) > 0 Then + oBitmap = bmyRot + Else + oBitmap = bmxRot + End If + Else + oBitmap = bmStop + End If + + gr = Graphics.FromImage(bmBack) + Try + gr.Clear(Color.Black) + gr.DrawImage(oBitmap, diexPos, dieyPos, r, GraphicsUnit.Pixel) + Finally + gr.Dispose() + End Try + + pnLower.Invalidate() + Application.DoEvents() + + End Sub + + Private Sub UpdateGuessButtons() + + Dim ctl As Control + Dim clrBack As Color = Color.Blue + Dim clrFore As Color = Color.White + + For Each ctl In Me.Controls + If TypeOf ctl Is Label Then + With ctl + If .Tag = "Yes" Then + If CInt(.Text) = Guess Then + .BackColor = clrBack + .ForeColor = clrFore + Else + .BackColor = Color.FromKnownColor(KnownColor.Control) + .ForeColor = Color.Black + End If + End If + End With + End If + Next + + End Sub + +End Class diff --git a/Files/GuessTheDieRoll/GuessTheDieRoll.sln b/Files/GuessTheDieRoll/GuessTheDieRoll.sln new file mode 100644 index 0000000..3ca3761 --- /dev/null +++ b/Files/GuessTheDieRoll/GuessTheDieRoll.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GuessTheDieRoll", "GuessTheDieRoll.vbproj", "{28527AC5-BFDA-40CD-99F9-3399875C42D3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.ActiveCfg = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.Build.0 = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.ActiveCfg = Release|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GuessTheDieRoll/GuessTheDieRoll.sln.old b/Files/GuessTheDieRoll/GuessTheDieRoll.sln.old new file mode 100644 index 0000000..cb3968e --- /dev/null +++ b/Files/GuessTheDieRoll/GuessTheDieRoll.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GuessTheDieRoll", "GuessTheDieRoll.vbproj", "{28527AC5-BFDA-40CD-99F9-3399875C42D3}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.ActiveCfg = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.Build.0 = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.ActiveCfg = Release|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GuessTheDieRoll/GuessTheDieRoll.suo b/Files/GuessTheDieRoll/GuessTheDieRoll.suo new file mode 100644 index 0000000..2cfaddf Binary files /dev/null and b/Files/GuessTheDieRoll/GuessTheDieRoll.suo differ diff --git a/Files/GuessTheDieRoll/GuessTheDieRoll.vbproj b/Files/GuessTheDieRoll/GuessTheDieRoll.vbproj new file mode 100644 index 0000000..98ca2e8 --- /dev/null +++ b/Files/GuessTheDieRoll/GuessTheDieRoll.vbproj @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/GuessTheDieRoll/GuessTheDieRoll.vbproj.user b/Files/GuessTheDieRoll/GuessTheDieRoll.vbproj.user new file mode 100644 index 0000000..2864829 --- /dev/null +++ b/Files/GuessTheDieRoll/GuessTheDieRoll.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/GuessTheDieRoll/PaintPanel.resx b/Files/GuessTheDieRoll/PaintPanel.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Files/GuessTheDieRoll/PaintPanel.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/GuessTheDieRoll/PaintPanel.vb b/Files/GuessTheDieRoll/PaintPanel.vb new file mode 100644 index 0000000..79f5b92 --- /dev/null +++ b/Files/GuessTheDieRoll/PaintPanel.vb @@ -0,0 +1,13 @@ +Public Class PaintPanel + Inherits Panel + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + End Sub + +End Class diff --git a/Files/GuessTheDieRoll/bin/GuessTheDieRoll.exe b/Files/GuessTheDieRoll/bin/GuessTheDieRoll.exe new file mode 100644 index 0000000..eb8c19d Binary files /dev/null and b/Files/GuessTheDieRoll/bin/GuessTheDieRoll.exe differ diff --git a/Files/GuessTheDieRoll/bin/GuessTheDieRoll.pdb b/Files/GuessTheDieRoll/bin/GuessTheDieRoll.pdb new file mode 100644 index 0000000..8c06a3e Binary files /dev/null and b/Files/GuessTheDieRoll/bin/GuessTheDieRoll.pdb differ diff --git a/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.PaintPanel.resources b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.PaintPanel.resources new file mode 100644 index 0000000..4e892e6 Binary files /dev/null and b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.PaintPanel.resources differ diff --git a/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.exe b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.exe new file mode 100644 index 0000000..eb8c19d Binary files /dev/null and b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.exe differ diff --git a/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.fGuess.resources b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.fGuess.resources new file mode 100644 index 0000000..c695ae7 Binary files /dev/null and b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.fGuess.resources differ diff --git a/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.pdb b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.pdb new file mode 100644 index 0000000..8c06a3e Binary files /dev/null and b/Files/GuessTheDieRoll/obj/Debug/GuessTheDieRoll.pdb differ diff --git a/Files/GuessTheDieRoll2/AssemblyInfo.vb b/Files/GuessTheDieRoll2/AssemblyInfo.vb new file mode 100644 index 0000000..558021e --- /dev/null +++ b/Files/GuessTheDieRoll2/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/GuessTheDieRoll2/DieStuff.resx b/Files/GuessTheDieRoll2/DieStuff.resx new file mode 100644 index 0000000..df79c33 --- /dev/null +++ b/Files/GuessTheDieRoll2/DieStuff.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/GuessTheDieRoll2/DieStuff.vb b/Files/GuessTheDieRoll2/DieStuff.vb new file mode 100644 index 0000000..2da699c --- /dev/null +++ b/Files/GuessTheDieRoll2/DieStuff.vb @@ -0,0 +1,220 @@ +Imports System.Math + +Public Class PaintPanel + Inherits Panel + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + End Sub + +End Class + +'why is it better? +'encapsulation - outside programmer no longer has to deal with: +'DieStatus, rollloop,h,w,diexPos, etc (all the privates) +' +'better grouping of code +'see Frame and Result property, w/ error checking, and +'you "just know" where code is + +'look at the guess property (form) +'rollthedie more self-explanatory, with object used. + +'putting down 2 die should be easier + +Public Class Die + + Private Enum DieStatus + dsStopped = 0 + dsRolling = 1 + dsLanding = 2 + End Enum + + Private bmStop As Bitmap + Private bmxRot As Bitmap + Private bmyRot As Bitmap + Private bmBack As Bitmap 'background bitmap + + Private oRand As New Random(Now.Ticks Mod 100) + Private FRollLoop As Integer + + Private h As Integer = 144 + Private w As Integer = 144 + + Private diexPos As Integer + Private dieyPos As Integer + Private diexDir As Integer '-8 to 8 + Private dieyDir As Integer '-8 to 8, indicates direction moving + + Private FStatus As DieStatus = DieStatus.dsLanding + Private FPanel As PaintPanel + + Public Sub New(ByVal pn As PaintPanel) + MyBase.New() + + FPanel = pn + bmBack = New Bitmap(FPanel.Width, FPanel.Height) + + Dim a As Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + bmxRot = New Bitmap(a.GetManifestResourceStream("GuessTheDieRoll2.dicexrot.bmp")) + bmyRot = New Bitmap(a.GetManifestResourceStream("GuessTheDieRoll2.diceyrot.bmp")) + bmStop = New Bitmap(a.GetManifestResourceStream("GuessTheDieRoll2.dicedone.bmp")) + End Sub + + + Private FFrame As Integer + Property Frame() As Integer + Get + Return FFrame + End Get + Set(ByVal Value As Integer) + FFrame = Value + + If FFrame < 0 Then FFrame += 36 + If FFrame > 35 Then FFrame -= 36 + End Set + End Property + + Private FResult As Integer 'result of the die, 1-6 + Property Result() As Integer + Get + Return FResult + End Get + Set(ByVal Value As Integer) + If Value < 1 Or Value > 6 Then + Throw New Exception("Invalid Die Value") + Else + FResult = Value + End If + End Set + End Property + + Public Sub InitializeLocation() + diexPos = oRand.Next(0, FPanel.Width - w) + dieyPos = oRand.Next(0, FPanel.Height - h) + End Sub + + Public Sub UpdateDiePosition() + + Select Case FStatus + Case DieStatus.dsLanding + 'if landing reduce the frame by 1, regardless of direction + Frame -= 1 + Case DieStatus.dsRolling + 'frame goes up or down based on x direction + Frame += (1 * Sign(dieyDir)) + End Select + + 'update the position + diexPos += diexDir + + 'bounce for x + If diexPos < 0 Then + diexPos = 0 + diexDir = -diexDir + Call WavPlayer.PlayWav("GuessTheDieRoll2.DIE1.WAV") + End If + If diexPos > FPanel.Width - w Then + diexPos = FPanel.Width - w + diexDir = -diexDir + Call WavPlayer.PlayWav("GuessTheDieRoll2.DIE1.WAV") + End If + + dieyPos += dieyDir + 'bounce for y + If dieyPos < 0 Then + dieyPos = 0 + dieyDir = -dieyDir + Call WavPlayer.PlayWav("GuessTheDieRoll2.DIE2.WAV") + End If + If dieyPos > FPanel.Height - h Then + dieyPos = FPanel.Height - h + dieyDir = -dieyDir + Call WavPlayer.PlayWav("GuessTheDieRoll2.DIE2.WAV") + End If + + FRollLoop += 1 + + Select Case FStatus + Case DieStatus.dsRolling + 'after 100 frames, check for a small chance that the die will stop rolling + If FRollLoop > 100 And oRand.Next(1, 100) < 10 Then + FStatus = DieStatus.dsLanding + FRollLoop = 0 + + Frame = Result * 6 + End If + + Case DieStatus.dsLanding + 'die lands for 6 frames and stops + If FRollLoop > 5 Then + FStatus = DieStatus.dsStopped + End If + End Select + + End Sub + + Public Sub InitializeRoll() + + Do + diexDir = oRand.Next(-8, 9) 'initialize the directions, 0/1 no good + Loop Until Abs(diexDir) > 3 + Do + dieyDir = oRand.Next(-8, 9) + Loop Until Abs(dieyDir) > 3 + Result = oRand.Next(1, 7) 'decide what the result will be + + FRollLoop = 0 + FStatus = DieStatus.dsRolling + + End Sub + + Public Sub DrawDie() + + Dim gr As Graphics + Dim b As Bitmap + + Dim x As Integer = (Frame Mod 6) * w + Dim y As Integer = (Frame \ 6) * h + Dim r As New System.Drawing.Rectangle(x, y, w, h) + + 'select the correct bitmap based on what the die is doing, and what direction it's going + If FStatus = DieStatus.dsRolling Then + 'check quandrant rolling towards based on sign of xdir*ydir + If (diexDir * dieyDir) > 0 Then + b = bmyRot + Else + b = bmxRot + End If + Else + b = bmStop + End If + + gr = Graphics.FromImage(bmBack) + Try + gr.Clear(Color.Black) + gr.DrawImage(b, diexPos, dieyPos, r, GraphicsUnit.Pixel) + Finally + gr.Dispose() + End Try + + End Sub + + ReadOnly Property IsNotRolling() As Boolean + Get + Return FStatus = DieStatus.dsStopped + End Get + End Property + + ReadOnly Property BackgroundPic() As Bitmap + Get + Return bmBack + End Get + End Property + +End Class diff --git a/Files/GuessTheDieRoll2/Form1.resx b/Files/GuessTheDieRoll2/Form1.resx new file mode 100644 index 0000000..4365e15 --- /dev/null +++ b/Files/GuessTheDieRoll2/Form1.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + fGuess + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/GuessTheDieRoll2/Form1.vb b/Files/GuessTheDieRoll2/Form1.vb new file mode 100644 index 0000000..5c3bbf7 --- /dev/null +++ b/Files/GuessTheDieRoll2/Form1.vb @@ -0,0 +1,277 @@ + +Public Class fGuess + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents lbOne As System.Windows.Forms.Label + Friend WithEvents lbTwo As System.Windows.Forms.Label + Friend WithEvents lbThree As System.Windows.Forms.Label + Friend WithEvents lbSix As System.Windows.Forms.Label + Friend WithEvents lbFive As System.Windows.Forms.Label + Friend WithEvents lbFour As System.Windows.Forms.Label + Friend WithEvents lbResult As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.lbOne = New System.Windows.Forms.Label + Me.lbTwo = New System.Windows.Forms.Label + Me.lbThree = New System.Windows.Forms.Label + Me.lbSix = New System.Windows.Forms.Label + Me.lbFive = New System.Windows.Forms.Label + Me.lbFour = New System.Windows.Forms.Label + Me.lbResult = New System.Windows.Forms.Label + Me.SuspendLayout() + ' + 'lbOne + ' + Me.lbOne.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbOne.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbOne.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbOne.Location = New System.Drawing.Point(30, 24) + Me.lbOne.Name = "lbOne" + Me.lbOne.Size = New System.Drawing.Size(56, 48) + Me.lbOne.TabIndex = 7 + Me.lbOne.Tag = "Yes" + Me.lbOne.Text = "1" + Me.lbOne.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbTwo + ' + Me.lbTwo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbTwo.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbTwo.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbTwo.Location = New System.Drawing.Point(98, 24) + Me.lbTwo.Name = "lbTwo" + Me.lbTwo.Size = New System.Drawing.Size(56, 48) + Me.lbTwo.TabIndex = 8 + Me.lbTwo.Tag = "Yes" + Me.lbTwo.Text = "2" + Me.lbTwo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbThree + ' + Me.lbThree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbThree.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbThree.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbThree.Location = New System.Drawing.Point(166, 24) + Me.lbThree.Name = "lbThree" + Me.lbThree.Size = New System.Drawing.Size(56, 48) + Me.lbThree.TabIndex = 9 + Me.lbThree.Tag = "Yes" + Me.lbThree.Text = "3" + Me.lbThree.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbSix + ' + Me.lbSix.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbSix.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbSix.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbSix.Location = New System.Drawing.Point(370, 24) + Me.lbSix.Name = "lbSix" + Me.lbSix.Size = New System.Drawing.Size(56, 48) + Me.lbSix.TabIndex = 12 + Me.lbSix.Tag = "Yes" + Me.lbSix.Text = "6" + Me.lbSix.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbFive + ' + Me.lbFive.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbFive.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbFive.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbFive.Location = New System.Drawing.Point(302, 24) + Me.lbFive.Name = "lbFive" + Me.lbFive.Size = New System.Drawing.Size(56, 48) + Me.lbFive.TabIndex = 11 + Me.lbFive.Tag = "Yes" + Me.lbFive.Text = "5" + Me.lbFive.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbFour + ' + Me.lbFour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbFour.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbFour.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbFour.Location = New System.Drawing.Point(234, 24) + Me.lbFour.Name = "lbFour" + Me.lbFour.Size = New System.Drawing.Size(56, 48) + Me.lbFour.TabIndex = 10 + Me.lbFour.Tag = "Yes" + Me.lbFour.Text = "4" + Me.lbFour.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbResult + ' + Me.lbResult.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbResult.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lbResult.Location = New System.Drawing.Point(136, 80) + Me.lbResult.Name = "lbResult" + Me.lbResult.Size = New System.Drawing.Size(184, 16) + Me.lbResult.TabIndex = 13 + Me.lbResult.Text = "Correct!" + Me.lbResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'fGuess + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(450, 549) + Me.Controls.Add(Me.lbResult) + Me.Controls.Add(Me.lbSix) + Me.Controls.Add(Me.lbFive) + Me.Controls.Add(Me.lbFour) + Me.Controls.Add(Me.lbThree) + Me.Controls.Add(Me.lbTwo) + Me.Controls.Add(Me.lbOne) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.MinimumSize = New System.Drawing.Size(458, 558) + Me.Name = "fGuess" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Guess the Die Roll" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private pnLower As PaintPanel + + Private FBackColor As Color = Color.Blue + Private FForeColor As Color = Color.White + + Dim d As Die + + Property Guess() As Integer + Get + Dim c As Control + + For Each c In Me.Controls + If TypeOf c Is Label Then + With CType(c, Label) + If .BackColor.Equals(FBackColor) Then + Return CInt(.Text) + End If + End With + End If + Next + End Get + + Set(ByVal Value As Integer) + + Dim c As Control + Dim bFound As Boolean = False + + For Each c In Me.Controls + If TypeOf c Is Label Then + With c + If .Tag = "Yes" AndAlso CInt(.Text) = Value Then + .BackColor = FBackColor + .ForeColor = FForeColor + bFound = True + Else + .BackColor = Color.FromKnownColor(KnownColor.Control) + .ForeColor = Color.Black + End If + End With + End If + Next + + If Not bFound Then + Throw New Exception("Guess must be a number from 1 to 6") + End If + End Set + End Property + + + Private Sub fGuess_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + pnLower = New PaintPanel() + pnLower.BackColor = Color.Black + pnLower.Dock = DockStyle.Bottom + pnLower.Visible = True + + AddHandler pnLower.Paint, AddressOf pnLower_Paint + Me.Controls.Add(pnLower) + pnLower.Height = Me.Height - lbResult.Height - lbResult.Top - 48 + + Guess = 1 + + 'start the die on whatever the initial guess is + d = New Die(pnLower) + d.Frame = (Guess - 1) * 6 + + 'initialize the location of the die + d.InitializeLocation() + d.DrawDie() + + lbResult.Text = "" + End Sub + + Private Sub cbButtonClick(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles lbOne.Click, _ + lbTwo.Click, lbThree.Click, lbFour.Click, lbFive.Click, lbSix.Click + + Guess = CInt(CType(sender, Label).Text) + Call RollTheDie() + + End Sub + + Private Sub pnLower_Paint(ByVal sender As System.Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) + + e.Graphics.DrawImage(d.BackgroundPic, 0, 0) + End Sub + + + Private Sub RollTheDie() + + Dim iLoop As Integer = 0 + + lbResult.Text = "" + + Application.DoEvents() + Me.Cursor = Cursors.WaitCursor + + d.InitializeRoll() + Do + d.UpdateDiePosition() + d.DrawDie() + pnLower.Invalidate() + Application.DoEvents() + Loop Until d.IsNotRolling + + If d.Result = Guess Then + lbResult.Text = "Correct!" + Else + lbResult.Text = "Try Again" + End If + Me.Cursor = Cursors.Default + + End Sub + +End Class diff --git a/Files/GuessTheDieRoll2/GuessTheDieRoll2.sln b/Files/GuessTheDieRoll2/GuessTheDieRoll2.sln new file mode 100644 index 0000000..21bf3a8 --- /dev/null +++ b/Files/GuessTheDieRoll2/GuessTheDieRoll2.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GuessTheDieRoll2", "GuessTheDieRoll2.vbproj", "{28527AC5-BFDA-40CD-99F9-3399875C42D3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.ActiveCfg = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.Build.0 = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.ActiveCfg = Release|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GuessTheDieRoll2/GuessTheDieRoll2.sln.old b/Files/GuessTheDieRoll2/GuessTheDieRoll2.sln.old new file mode 100644 index 0000000..93b2b7b --- /dev/null +++ b/Files/GuessTheDieRoll2/GuessTheDieRoll2.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GuessTheDieRoll2", "GuessTheDieRoll2.vbproj", "{28527AC5-BFDA-40CD-99F9-3399875C42D3}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.ActiveCfg = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.Build.0 = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.ActiveCfg = Release|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GuessTheDieRoll2/GuessTheDieRoll2.suo b/Files/GuessTheDieRoll2/GuessTheDieRoll2.suo new file mode 100644 index 0000000..db57b76 Binary files /dev/null and b/Files/GuessTheDieRoll2/GuessTheDieRoll2.suo differ diff --git a/Files/GuessTheDieRoll2/GuessTheDieRoll2.vbproj b/Files/GuessTheDieRoll2/GuessTheDieRoll2.vbproj new file mode 100644 index 0000000..f166736 --- /dev/null +++ b/Files/GuessTheDieRoll2/GuessTheDieRoll2.vbproj @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/GuessTheDieRoll2/GuessTheDieRoll2.vbproj.user b/Files/GuessTheDieRoll2/GuessTheDieRoll2.vbproj.user new file mode 100644 index 0000000..2864829 --- /dev/null +++ b/Files/GuessTheDieRoll2/GuessTheDieRoll2.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/GuessTheDieRoll2/WavPlayer.vb b/Files/GuessTheDieRoll2/WavPlayer.vb new file mode 100644 index 0000000..34e3ef8 --- /dev/null +++ b/Files/GuessTheDieRoll2/WavPlayer.vb @@ -0,0 +1,32 @@ + +Public Class WavPlayer + + Private Declare Function sndPlaySound Lib "winmm.dll" _ + Alias "sndPlaySoundA" (ByVal szSound As Byte(), ByVal UFlags As Int32) As Int32 + + Private Const SND_ASYNC As Integer = 1 + Private Const SND_MEMORY As Integer = 4 + + Public Shared Sub PlayWav(ByVal cResName As String) + + Dim a As System.Reflection.Assembly + Dim oS As System.IO.Stream + + a = System.Reflection.Assembly.GetExecutingAssembly + oS = a.GetManifestResourceStream(cResName) + + 'couldn't find the sound + If a Is Nothing Then Exit Sub + Dim bstr(oS.Length) As Byte + + Try + oS.Read(bstr, 0, Int(oS.Length)) + sndPlaySound(bstr, SND_ASYNC Or SND_MEMORY) + Finally + bstr = Nothing + oS = Nothing + End Try + + End Sub + +End Class diff --git a/Files/GuessTheDieRoll2/bin/GuessTheDieRoll2.exe b/Files/GuessTheDieRoll2/bin/GuessTheDieRoll2.exe new file mode 100644 index 0000000..ffbad79 Binary files /dev/null and b/Files/GuessTheDieRoll2/bin/GuessTheDieRoll2.exe differ diff --git a/Files/GuessTheDieRoll2/bin/GuessTheDieRoll2.pdb b/Files/GuessTheDieRoll2/bin/GuessTheDieRoll2.pdb new file mode 100644 index 0000000..3a0b1ef Binary files /dev/null and b/Files/GuessTheDieRoll2/bin/GuessTheDieRoll2.pdb differ diff --git a/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.PaintPanel.resources b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.PaintPanel.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.PaintPanel.resources differ diff --git a/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.exe b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.exe new file mode 100644 index 0000000..ffbad79 Binary files /dev/null and b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.exe differ diff --git a/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.fGuess.resources b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.fGuess.resources new file mode 100644 index 0000000..26e9b16 Binary files /dev/null and b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.fGuess.resources differ diff --git a/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.pdb b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.pdb new file mode 100644 index 0000000..3a0b1ef Binary files /dev/null and b/Files/GuessTheDieRoll2/obj/Debug/GuessTheDieRoll2.pdb differ diff --git a/Files/GuessTheDieRoll3/AssemblyInfo.vb b/Files/GuessTheDieRoll3/AssemblyInfo.vb new file mode 100644 index 0000000..558021e --- /dev/null +++ b/Files/GuessTheDieRoll3/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/GuessTheDieRoll3/Form1.resx b/Files/GuessTheDieRoll3/Form1.resx new file mode 100644 index 0000000..dd1c926 --- /dev/null +++ b/Files/GuessTheDieRoll3/Form1.resx @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + True + + + False + + + Assembly + + + Assembly + + + 8, 8 + + + False + + + (Default) + + + False + + + False + + + fGuess + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/GuessTheDieRoll3/Form1.vb b/Files/GuessTheDieRoll3/Form1.vb new file mode 100644 index 0000000..766ca72 --- /dev/null +++ b/Files/GuessTheDieRoll3/Form1.vb @@ -0,0 +1,341 @@ +Imports System.Math +Imports System.Threading + +Public Class fGuess + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Dim oRand As New Random() + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents lbTwo As System.Windows.Forms.Label + Friend WithEvents lbThree As System.Windows.Forms.Label + Friend WithEvents lbSix As System.Windows.Forms.Label + Friend WithEvents lbFive As System.Windows.Forms.Label + Friend WithEvents lbFour As System.Windows.Forms.Label + Friend WithEvents lbResult As System.Windows.Forms.Label + Friend WithEvents lbTwelve As System.Windows.Forms.Label + Friend WithEvents lbEleven As System.Windows.Forms.Label + Friend WithEvents lbTen As System.Windows.Forms.Label + Friend WithEvents lbNine As System.Windows.Forms.Label + Friend WithEvents lbEight As System.Windows.Forms.Label + Friend WithEvents lbSeven As System.Windows.Forms.Label + Friend WithEvents DicePanel1 As DicePanel.DicePanel.DicePanel + Private Sub InitializeComponent() + Me.lbTwo = New System.Windows.Forms.Label + Me.lbThree = New System.Windows.Forms.Label + Me.lbSix = New System.Windows.Forms.Label + Me.lbFive = New System.Windows.Forms.Label + Me.lbFour = New System.Windows.Forms.Label + Me.lbResult = New System.Windows.Forms.Label + Me.lbTwelve = New System.Windows.Forms.Label + Me.lbEleven = New System.Windows.Forms.Label + Me.lbTen = New System.Windows.Forms.Label + Me.lbNine = New System.Windows.Forms.Label + Me.lbEight = New System.Windows.Forms.Label + Me.lbSeven = New System.Windows.Forms.Label + Me.DicePanel1 = New DicePanel.DicePanel.DicePanel + Me.SuspendLayout() + ' + 'lbTwo + ' + Me.lbTwo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbTwo.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbTwo.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbTwo.Location = New System.Drawing.Point(56, 8) + Me.lbTwo.Name = "lbTwo" + Me.lbTwo.Size = New System.Drawing.Size(56, 48) + Me.lbTwo.TabIndex = 8 + Me.lbTwo.Tag = "Yes" + Me.lbTwo.Text = "2" + Me.lbTwo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbThree + ' + Me.lbThree.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbThree.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbThree.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbThree.Location = New System.Drawing.Point(124, 8) + Me.lbThree.Name = "lbThree" + Me.lbThree.Size = New System.Drawing.Size(56, 48) + Me.lbThree.TabIndex = 9 + Me.lbThree.Tag = "Yes" + Me.lbThree.Text = "3" + Me.lbThree.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbSix + ' + Me.lbSix.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbSix.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbSix.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbSix.Location = New System.Drawing.Point(328, 8) + Me.lbSix.Name = "lbSix" + Me.lbSix.Size = New System.Drawing.Size(56, 48) + Me.lbSix.TabIndex = 12 + Me.lbSix.Tag = "Yes" + Me.lbSix.Text = "6" + Me.lbSix.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbFive + ' + Me.lbFive.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbFive.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbFive.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbFive.Location = New System.Drawing.Point(260, 8) + Me.lbFive.Name = "lbFive" + Me.lbFive.Size = New System.Drawing.Size(56, 48) + Me.lbFive.TabIndex = 11 + Me.lbFive.Tag = "Yes" + Me.lbFive.Text = "5" + Me.lbFive.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbFour + ' + Me.lbFour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbFour.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbFour.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbFour.Location = New System.Drawing.Point(192, 8) + Me.lbFour.Name = "lbFour" + Me.lbFour.Size = New System.Drawing.Size(56, 48) + Me.lbFour.TabIndex = 10 + Me.lbFour.Tag = "Yes" + Me.lbFour.Text = "4" + Me.lbFour.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbResult + ' + Me.lbResult.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbResult.Font = New System.Drawing.Font("Tahoma", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lbResult.Location = New System.Drawing.Point(136, 128) + Me.lbResult.Name = "lbResult" + Me.lbResult.Size = New System.Drawing.Size(184, 16) + Me.lbResult.TabIndex = 13 + Me.lbResult.Text = "Correct!" + Me.lbResult.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbTwelve + ' + Me.lbTwelve.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbTwelve.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbTwelve.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbTwelve.Location = New System.Drawing.Point(359, 64) + Me.lbTwelve.Name = "lbTwelve" + Me.lbTwelve.Size = New System.Drawing.Size(56, 48) + Me.lbTwelve.TabIndex = 19 + Me.lbTwelve.Tag = "Yes" + Me.lbTwelve.Text = "12" + Me.lbTwelve.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbEleven + ' + Me.lbEleven.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbEleven.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbEleven.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbEleven.Location = New System.Drawing.Point(292, 64) + Me.lbEleven.Name = "lbEleven" + Me.lbEleven.Size = New System.Drawing.Size(56, 48) + Me.lbEleven.TabIndex = 18 + Me.lbEleven.Tag = "Yes" + Me.lbEleven.Text = "11" + Me.lbEleven.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbTen + ' + Me.lbTen.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbTen.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbTen.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbTen.Location = New System.Drawing.Point(225, 64) + Me.lbTen.Name = "lbTen" + Me.lbTen.Size = New System.Drawing.Size(56, 48) + Me.lbTen.TabIndex = 17 + Me.lbTen.Tag = "Yes" + Me.lbTen.Text = "10" + Me.lbTen.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbNine + ' + Me.lbNine.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbNine.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbNine.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbNine.Location = New System.Drawing.Point(158, 64) + Me.lbNine.Name = "lbNine" + Me.lbNine.Size = New System.Drawing.Size(56, 48) + Me.lbNine.TabIndex = 16 + Me.lbNine.Tag = "Yes" + Me.lbNine.Text = "9" + Me.lbNine.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbEight + ' + Me.lbEight.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbEight.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbEight.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbEight.Location = New System.Drawing.Point(91, 64) + Me.lbEight.Name = "lbEight" + Me.lbEight.Size = New System.Drawing.Size(56, 48) + Me.lbEight.TabIndex = 15 + Me.lbEight.Tag = "Yes" + Me.lbEight.Text = "8" + Me.lbEight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbSeven + ' + Me.lbSeven.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.lbSeven.Cursor = System.Windows.Forms.Cursors.Hand + Me.lbSeven.Font = New System.Drawing.Font("Tahoma", 14.25!, System.Drawing.FontStyle.Bold) + Me.lbSeven.Location = New System.Drawing.Point(24, 64) + Me.lbSeven.Name = "lbSeven" + Me.lbSeven.Size = New System.Drawing.Size(56, 48) + Me.lbSeven.TabIndex = 14 + Me.lbSeven.Tag = "Yes" + Me.lbSeven.Text = "7" + Me.lbSeven.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'DicePanel1 + ' + Me.DicePanel1.BackColor = System.Drawing.Color.Black + Me.DicePanel1.Dock = System.Windows.Forms.DockStyle.Bottom + Me.DicePanel1.Location = New System.Drawing.Point(0, 165) + Me.DicePanel1.Name = "DicePanel1" + Me.DicePanel1.Size = New System.Drawing.Size(448, 216) + Me.DicePanel1.TabIndex = 20 + ' + 'fGuess + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(448, 381) + Me.Controls.Add(Me.DicePanel1) + Me.Controls.Add(Me.lbTwelve) + Me.Controls.Add(Me.lbEleven) + Me.Controls.Add(Me.lbTen) + Me.Controls.Add(Me.lbNine) + Me.Controls.Add(Me.lbEight) + Me.Controls.Add(Me.lbSeven) + Me.Controls.Add(Me.lbResult) + Me.Controls.Add(Me.lbSix) + Me.Controls.Add(Me.lbFive) + Me.Controls.Add(Me.lbFour) + Me.Controls.Add(Me.lbThree) + Me.Controls.Add(Me.lbTwo) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "fGuess" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Guess the Die Roll" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private FBackColor As Color = Color.Blue + Private FForeColor As Color = Color.White + + Property Guess() As Integer + Get + Dim c As Control + + For Each c In Me.Controls + If TypeOf c Is Label Then + With c + If .BackColor.Equals(FBackColor) Then + Return CInt(.Text) + End If + End With + End If + Next + End Get + + Set(ByVal Value As Integer) + + Dim c As Control + Dim bFound As Boolean = False + + For Each c In Me.Controls + If TypeOf c Is Label Then + With c + If .Tag = "Yes" AndAlso CInt(.Text) = Value Then + .BackColor = FBackColor + .ForeColor = FForeColor + bFound = True + Else + .BackColor = Color.FromKnownColor(KnownColor.Control) + .ForeColor = Color.Black + End If + End With + End If + Next + + If Not bFound Then + Throw New Exception("Guess must be a number from 2 to 12") + End If + End Set + End Property + + + Private Sub fGuess_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + Guess = 2 + lbResult.Text = "" + End Sub + + Private Sub cbButtonClick(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles lbTwo.Click, lbThree.Click, _ + lbFour.Click, lbFive.Click, lbSix.Click, lbSeven.Click, lbEight.Click, _ + lbNine.Click, lbTen.Click, lbEleven.Click, lbTwelve.Click + + Guess = CInt(CType(sender, Label).Text) + Call RollTheDie() + + End Sub + + Private Sub RollTheDie() + + lbResult.Text = "" + Application.DoEvents() + + Me.Cursor = Cursors.WaitCursor + DicePanel1.RollDice() + If DicePanel1.Result = Guess Then + lbResult.Text = "Correct!" + Else + lbResult.Text = "Try Again" + End If + Me.Cursor = Cursors.Default + + End Sub + + Private Sub DicePanel1_DieBounced() Handles DicePanel1.DieBounced + If oRand.Next(0, 99) Mod 2 = 0 Then + Call WavPlayer.PlayWav("GuessTheDieRoll3.DIE2.WAV") + Else + Call WavPlayer.PlayWav("GuessTheDieRoll3.DIE1.WAV") + End If + End Sub +End Class diff --git a/Files/GuessTheDieRoll3/GuessTheDieRoll3.sln b/Files/GuessTheDieRoll3/GuessTheDieRoll3.sln new file mode 100644 index 0000000..fdc0a57 --- /dev/null +++ b/Files/GuessTheDieRoll3/GuessTheDieRoll3.sln @@ -0,0 +1,29 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GuessTheDieRoll3", "GuessTheDieRoll3.vbproj", "{28527AC5-BFDA-40CD-99F9-3399875C42D3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DicePanel", "..\DicePanel\DicePanel.vbproj", "{3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.ActiveCfg = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.Build.0 = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.ActiveCfg = Release|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.Build.0 = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.ActiveCfg = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.Build.0 = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.ActiveCfg = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GuessTheDieRoll3/GuessTheDieRoll3.sln.old b/Files/GuessTheDieRoll3/GuessTheDieRoll3.sln.old new file mode 100644 index 0000000..035910c --- /dev/null +++ b/Files/GuessTheDieRoll3/GuessTheDieRoll3.sln.old @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GuessTheDieRoll3", "GuessTheDieRoll3.vbproj", "{28527AC5-BFDA-40CD-99F9-3399875C42D3}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DicePanel", "..\DicePanel\DicePanel.vbproj", "{3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.ActiveCfg = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Debug.Build.0 = Debug|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.ActiveCfg = Release|.NET + {28527AC5-BFDA-40CD-99F9-3399875C42D3}.Release.Build.0 = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.ActiveCfg = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.Build.0 = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.ActiveCfg = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/GuessTheDieRoll3/GuessTheDieRoll3.suo b/Files/GuessTheDieRoll3/GuessTheDieRoll3.suo new file mode 100644 index 0000000..8b6e9d3 Binary files /dev/null and b/Files/GuessTheDieRoll3/GuessTheDieRoll3.suo differ diff --git a/Files/GuessTheDieRoll3/GuessTheDieRoll3.vbproj b/Files/GuessTheDieRoll3/GuessTheDieRoll3.vbproj new file mode 100644 index 0000000..16e7e65 --- /dev/null +++ b/Files/GuessTheDieRoll3/GuessTheDieRoll3.vbproj @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/GuessTheDieRoll3/GuessTheDieRoll3.vbproj.user b/Files/GuessTheDieRoll3/GuessTheDieRoll3.vbproj.user new file mode 100644 index 0000000..7ff5d8a --- /dev/null +++ b/Files/GuessTheDieRoll3/GuessTheDieRoll3.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/GuessTheDieRoll3/WavPlayer.vb b/Files/GuessTheDieRoll3/WavPlayer.vb new file mode 100644 index 0000000..fcfce65 --- /dev/null +++ b/Files/GuessTheDieRoll3/WavPlayer.vb @@ -0,0 +1,30 @@ +Public Class WavPlayer + + Private Declare Function sndPlaySound Lib "winmm.dll" _ + Alias "sndPlaySoundA" (ByVal szSound As Byte(), ByVal UFlags As Int32) As Int32 + + Private Const SND_ASYNC As Integer = 1 + Private Const SND_MEMORY As Integer = 4 + + + Public Shared Sub PlayWav(ByVal cResName As String) + Dim a As System.IO.Stream + + a = System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(cResName) + + 'couldn't find the sound + If a Is Nothing Then Exit Sub + Dim bstr(a.Length) As Byte + + Try + a.Read(bstr, 0, Int(a.Length)) + sndPlaySound(bstr, SND_ASYNC Or SND_MEMORY) + Finally + bstr = Nothing + a = Nothing + End Try + + End Sub + + +End Class diff --git a/Files/GuessTheDieRoll3/bin/GuessTheDieRoll.exe b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll.exe new file mode 100644 index 0000000..e03ff4f Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll.exe differ diff --git a/Files/GuessTheDieRoll3/bin/GuessTheDieRoll.pdb b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll.pdb new file mode 100644 index 0000000..88e8e60 Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll.pdb differ diff --git a/Files/GuessTheDieRoll3/bin/GuessTheDieRoll2.exe b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll2.exe new file mode 100644 index 0000000..cdb73d6 Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll2.exe differ diff --git a/Files/GuessTheDieRoll3/bin/GuessTheDieRoll2.pdb b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll2.pdb new file mode 100644 index 0000000..73a7824 Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll2.pdb differ diff --git a/Files/GuessTheDieRoll3/bin/GuessTheDieRoll3.exe b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll3.exe new file mode 100644 index 0000000..67e508b Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll3.exe differ diff --git a/Files/GuessTheDieRoll3/bin/GuessTheDieRoll3.pdb b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll3.pdb new file mode 100644 index 0000000..26d796b Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/GuessTheDieRoll3.pdb differ diff --git a/Files/GuessTheDieRoll3/bin/dicepanel.dll b/Files/GuessTheDieRoll3/bin/dicepanel.dll new file mode 100644 index 0000000..5e4a3c7 Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/dicepanel.dll differ diff --git a/Files/GuessTheDieRoll3/bin/dicepanel.pdb b/Files/GuessTheDieRoll3/bin/dicepanel.pdb new file mode 100644 index 0000000..1712e0b Binary files /dev/null and b/Files/GuessTheDieRoll3/bin/dicepanel.pdb differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll.exe b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll.exe new file mode 100644 index 0000000..e03ff4f Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll.exe differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll.pdb b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll.pdb new file mode 100644 index 0000000..88e8e60 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll.pdb differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.PaintPanel.resources b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.PaintPanel.resources new file mode 100644 index 0000000..4e892e6 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.PaintPanel.resources differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.exe b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.exe new file mode 100644 index 0000000..cdb73d6 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.exe differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.fGuess.resources b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.fGuess.resources new file mode 100644 index 0000000..c695ae7 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.fGuess.resources differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.pdb b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.pdb new file mode 100644 index 0000000..73a7824 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll2.pdb differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.PaintPanel.resources b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.PaintPanel.resources new file mode 100644 index 0000000..4e892e6 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.PaintPanel.resources differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.exe b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.exe new file mode 100644 index 0000000..67e508b Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.exe differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.fGuess.resources b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.fGuess.resources new file mode 100644 index 0000000..2b04fe7 Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.fGuess.resources differ diff --git a/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.pdb b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.pdb new file mode 100644 index 0000000..26d796b Binary files /dev/null and b/Files/GuessTheDieRoll3/obj/Debug/GuessTheDieRoll3.pdb differ diff --git a/Files/InterfaceExample/AssemblyInfo.vb b/Files/InterfaceExample/AssemblyInfo.vb new file mode 100644 index 0000000..1283662 --- /dev/null +++ b/Files/InterfaceExample/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/InterfaceExample/InterfaceExample.sln b/Files/InterfaceExample/InterfaceExample.sln new file mode 100644 index 0000000..15a110c --- /dev/null +++ b/Files/InterfaceExample/InterfaceExample.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "InterfaceExample", "InterfaceExample.vbproj", "{E5B74D47-F0EB-42A1-B1D4-B8CDCA9EA744}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {E5B74D47-F0EB-42A1-B1D4-B8CDCA9EA744}.Debug.ActiveCfg = Debug|.NET + {E5B74D47-F0EB-42A1-B1D4-B8CDCA9EA744}.Debug.Build.0 = Debug|.NET + {E5B74D47-F0EB-42A1-B1D4-B8CDCA9EA744}.Release.ActiveCfg = Release|.NET + {E5B74D47-F0EB-42A1-B1D4-B8CDCA9EA744}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/InterfaceExample/InterfaceExample.suo b/Files/InterfaceExample/InterfaceExample.suo new file mode 100644 index 0000000..b7bf0ed Binary files /dev/null and b/Files/InterfaceExample/InterfaceExample.suo differ diff --git a/Files/InterfaceExample/InterfaceExample.vbproj b/Files/InterfaceExample/InterfaceExample.vbproj new file mode 100644 index 0000000..57e3e8c --- /dev/null +++ b/Files/InterfaceExample/InterfaceExample.vbproj @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/InterfaceExample/InterfaceExample.vbproj.user b/Files/InterfaceExample/InterfaceExample.vbproj.user new file mode 100644 index 0000000..8f26536 --- /dev/null +++ b/Files/InterfaceExample/InterfaceExample.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/InterfaceExample/Module1.vb b/Files/InterfaceExample/Module1.vb new file mode 100644 index 0000000..71d6375 --- /dev/null +++ b/Files/InterfaceExample/Module1.vb @@ -0,0 +1,69 @@ +Module ShowASequence + + Sub Main() + + Dim oInt As IIntegerSequencer + Dim oRand As New Random + Dim i As Integer + + If oRand.Next(0, 1000) Mod 2 = 0 Then + oInt = New IntegerCounter + Else + oInt = New FibonacciCounter + End If + + Console.WriteLine("couting started ") + Do + i = oInt.GetNext + Console.Write(i & ",") + Loop Until i > 100 + Console.ReadLine() + End Sub + +End Module + +Interface IIntegerSequencer + Function GetNext() As Integer +End Interface + +Public Class IntegerCounter + Implements IIntegerSequencer + + Private FLast As Integer = 1 + + Public Function GetNext() As Integer _ + Implements IIntegerSequencer.GetNext + + FLast += 1 + Return FLast + End Function +End Class + +Public Class FibonacciCounter + Implements IIntegerSequencer + + Dim iTurn As Integer = 0 + Private FLast1 As Integer = 1 + Private FLast2 As Integer = 1 + + Public Function GetNext() As Integer _ + Implements IIntegerSequencer.GetNext + + Dim iTemp As Integer + + iTurn += 1 + If iTurn < 3 Then + Return 1 + Else + + iTemp = FLast1 + FLast2 + + FLast1 = FLast2 + FLast2 = iTemp + Return iTemp + End If + End Function + +End Class + + diff --git a/Files/InterfaceExample/bin/InterfaceExample.exe b/Files/InterfaceExample/bin/InterfaceExample.exe new file mode 100644 index 0000000..f3c002a Binary files /dev/null and b/Files/InterfaceExample/bin/InterfaceExample.exe differ diff --git a/Files/InterfaceExample/bin/InterfaceExample.pdb b/Files/InterfaceExample/bin/InterfaceExample.pdb new file mode 100644 index 0000000..fb4f177 Binary files /dev/null and b/Files/InterfaceExample/bin/InterfaceExample.pdb differ diff --git a/Files/InterfaceExample/obj/Debug/InterfaceExample.exe b/Files/InterfaceExample/obj/Debug/InterfaceExample.exe new file mode 100644 index 0000000..f3c002a Binary files /dev/null and b/Files/InterfaceExample/obj/Debug/InterfaceExample.exe differ diff --git a/Files/InterfaceExample/obj/Debug/InterfaceExample.pdb b/Files/InterfaceExample/obj/Debug/InterfaceExample.pdb new file mode 100644 index 0000000..fb4f177 Binary files /dev/null and b/Files/InterfaceExample/obj/Debug/InterfaceExample.pdb differ diff --git a/Files/NetReversi/AssemblyInfo.vb b/Files/NetReversi/AssemblyInfo.vb new file mode 100644 index 0000000..0de43a9 --- /dev/null +++ b/Files/NetReversi/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/NetReversi/NetReversi.sln b/Files/NetReversi/NetReversi.sln new file mode 100644 index 0000000..3665ba4 --- /dev/null +++ b/Files/NetReversi/NetReversi.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NetReversi", "NetReversi.vbproj", "{DFA57DC7-D17C-41E5-9025-3AD1995A3F8B}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {DFA57DC7-D17C-41E5-9025-3AD1995A3F8B}.Debug.ActiveCfg = Debug|.NET + {DFA57DC7-D17C-41E5-9025-3AD1995A3F8B}.Debug.Build.0 = Debug|.NET + {DFA57DC7-D17C-41E5-9025-3AD1995A3F8B}.Release.ActiveCfg = Release|.NET + {DFA57DC7-D17C-41E5-9025-3AD1995A3F8B}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/NetReversi/NetReversi.suo b/Files/NetReversi/NetReversi.suo new file mode 100644 index 0000000..df99ac2 Binary files /dev/null and b/Files/NetReversi/NetReversi.suo differ diff --git a/Files/NetReversi/NetReversi.vbproj b/Files/NetReversi/NetReversi.vbproj new file mode 100644 index 0000000..53acef3 --- /dev/null +++ b/Files/NetReversi/NetReversi.vbproj @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/NetReversi/NetReversi.vbproj.user b/Files/NetReversi/NetReversi.vbproj.user new file mode 100644 index 0000000..77f7b49 --- /dev/null +++ b/Files/NetReversi/NetReversi.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/NetReversi/Player.vb b/Files/NetReversi/Player.vb new file mode 100644 index 0000000..04af294 --- /dev/null +++ b/Files/NetReversi/Player.vb @@ -0,0 +1,187 @@ +Imports System.Net.Sockets +Imports System.IO +Imports System.Xml +Imports System.Xml.Serialization + +Public Delegate Sub MoveToLocationDef(ByVal sender As ReversiPlayer, _ + ByVal x As Integer, ByVal y As Integer) + +Public Delegate Sub MakeBestMoveDef(ByVal sender As ReversiPlayer) + +Public MustInherit Class ReversiPlayer + + Private FName As String + Private FColor As Color + Private FScore As Integer + Private FMyTurn As Boolean + + Public Event IsMyTurn(ByVal oPlayer As ReversiPlayer) + + Sub New(ByVal cNm As String, ByVal cClr As Color) + MyBase.New() + + FName = cNm + + 'only two colors allowed + Debug.Assert(cClr.Equals(Color.Red) Or cClr.Equals(Color.Blue)) + FColor = cClr +End Sub + +ReadOnly Property Name() As String + Get + Return FName + End Get +End Property + +ReadOnly Property Color() As Color + Get + Return FColor + End Get +End Property + +ReadOnly Property OpponentColor() As Color + Get + Return IIf(FColor.Equals(Color.Red), Color.Blue, Color.Red) + End Get +End Property + +Overridable Property MyTurn() As Boolean + Get + Return FMyTurn + End Get + Set(ByVal Value As Boolean) + FMyTurn = Value + If Value Then + RaiseEvent IsMyTurn(Me) + End If + End Set +End Property + +Property Score() As Integer + Get + Return FScore + End Get + Set(ByVal Value As Integer) + FScore = Value + End Set +End Property + +End Class + +Public Class HumanReversiPlayer + Inherits ReversiPlayer + + Private FForm As Form + Public Event MyMoveLoc As MoveToLocationDef + + Sub New(ByVal cNm As String, ByVal cClr As Color, ByVal f As Form) + MyBase.New(cNm, cClr) + FForm = f + End Sub + + Overrides Property MyTurn() As Boolean + Get + Return MyBase.MyTurn + End Get + Set(ByVal Value As Boolean) + If Value Then + AddHandler FForm.MouseDown, AddressOf OnMouseDown + Else + RemoveHandler FForm.MouseDown, AddressOf OnMouseDown + End If + + MyBase.MyTurn = Value + End Set + End Property + + Private Sub OnMouseDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.MouseEventArgs) + + If Not MyTurn Then Exit Sub + If Not e.Button = MouseButtons.Left Then Exit Sub + + RaiseEvent MyMoveLoc(Me, e.X, e.Y) + End Sub +End Class + +Public Class ComputerReversiPlayer + Inherits ReversiPlayer + + Public Event MyMakeBestMove As MakeBestMoveDef + + Sub New(ByVal cNm As String, ByVal cClr As Color) + MyBase.New(cNm, cClr) + End Sub + + Overrides Property MyTurn() As Boolean + Get + Return MyBase.MyTurn + End Get + Set(ByVal Value As Boolean) + + MyBase.MyTurn = Value + If Value Then + RaiseEvent MyMakeBestMove(Me) + End If + End Set + End Property + +End Class + +Public Class NetworkReversiPlayer + Inherits ReversiPlayer + + Private FStream As NetworkStream + Public Event MyMoveLoc As MoveToLocationDef + + Sub New(ByVal cNm As String, ByVal cClr As Color, ByVal oStream As NetworkStream) + MyBase.New(cNm, cClr) + FStream = oStream + End Sub + + Public Sub LookForTurn() + + Do + If FStream.DataAvailable Then + + Dim cPiece As String + Dim oPiece As New ReversiPiece + Dim oSer As New XmlSerializer(oPiece.GetType) + Dim oRead As StreamReader + + oRead = New StreamReader(FStream) + cPiece = oRead.ReadLine + oPiece = oSer.Deserialize(New StringReader(cPiece)) + + RaiseEvent MyMoveLoc(Me, oPiece.Location.X, oPiece.Location.Y) + End If + System.Threading.Thread.Sleep(250) + Loop Until False + + End Sub + + Public Sub SendMyTurnToOpponent(ByVal aP As ReversiPiece) + + Dim oSer As New XmlSerializer(aP.GetType) + Dim oSW As New StringWriter + Dim oWriter As New XmlTextWriter(oSW) + Dim oByte() As Byte + Dim cSend As String + + oSer.Serialize(oSW, aP) + oWriter.Close() + cSend = oSW.ToString + cSend = cSend.Replace(Chr(10), "") + cSend = cSend.Replace(Chr(13), "") + cSend &= Microsoft.VisualBasic.vbCrLf 'add crlf so READLINE works + Try + oByte = System.Text.Encoding.ASCII.GetBytes(cSend.ToCharArray()) + FStream.Write(oByte, 0, oByte.Length) + Catch oEX As SocketException + MsgBox(oEX.Message) + End Try + + End Sub + +End Class + diff --git a/Files/NetReversi/Reversi.vb b/Files/NetReversi/Reversi.vb new file mode 100644 index 0000000..5ff8ebd --- /dev/null +++ b/Files/NetReversi/Reversi.vb @@ -0,0 +1,546 @@ +Imports System.Drawing.Drawing2D + +'same basic code as the pcopponent version with the interface removed. +'we're moving the focus away from a game that has a computer opponent +'to that of a game that can be played by 1 or 2 players +'integer Value replaced with a color type +Public Class ReversiPiece + + Public Sub Draw(ByVal g As System.Drawing.Graphics) + + Dim r As New Rectangle(Location, Size) + Dim p As New PointF(Location.X, Location.Y) + Dim b As Brush + + r.Inflate(-2, -2) + + If Me.Value.Equals(Color.Empty) Then + b = New LinearGradientBrush(r, Color.White, Color.DarkGray, LinearGradientMode.Vertical) + Else + b = New SolidBrush(Value) + End If + + g.FillRectangle(b, r) + g.DrawRectangle(Pens.White, r) + + End Sub + + Private FLocation As Point + Public Property Location() As System.Drawing.Point + Get + Return FLocation + End Get + Set(ByVal Value As System.Drawing.Point) + FLocation = Value + End Set + End Property + + Private FSize As Size + Public Property Size() As System.Drawing.Size + Get + Return FSize + End Get + Set(ByVal Value As System.Drawing.Size) + FSize = Value + End Set + End Property + + Public Function MouseIn(ByVal x As Integer, _ + ByVal y As Integer) As Boolean + + Dim r As New Rectangle(Location, Size) + Return r.Contains(x, y) + + End Function + + Private FValue As Color = Color.Empty + + Public Property Value() As Color + Get + Return FValue + End Get + Set(ByVal i As Color) + FValue = i + End Set + End Property + + 'true if no color on this piece yet + Public Function UnOccupied() As Boolean + Return Me.Value.Equals(Color.Empty) + End Function + + ReadOnly Property xElt() As Integer + Get + Return Location.X \ Size.Width + End Get + End Property + + ReadOnly Property yElt() As Integer + Get + Return Location.Y \ Size.Height + End Get + End Property + + Private FSaveValue As Color + + 'store prior value + Public Sub PushValue() + FSaveValue = Value + End Sub + + Public Sub PopValue() + Value = FSaveValue + End Sub + + Public Function IsEdge() As Boolean + Return xElt = 0 OrElse yElt = 0 OrElse xElt = 7 OrElse yElt = 7 + End Function + + Public Function IsCorner() As Boolean + + Return (xElt = 0 And yElt = 0) OrElse _ + (xElt = 0 And yElt = 7) OrElse _ + (xElt = 7 And yElt = 0) OrElse _ + (xElt = 7 And yElt = 7) + + End Function +End Class + +Public Class ReversiGame + + Const PIECESIZE As Integer = 48 + + Private aPieces(7, 7) As ReversiPiece + + Private FPlayer1 As ReversiPlayer + Private FPlayer2 As ReversiPlayer + + Public Event BadMove() + Public Event PlayerWon(ByVal oPlayer As ReversiPlayer) + Public Event TieGame() + Public Event RepeatingTurn(ByVal oPlayer As ReversiPlayer) + Public Event UpdateScore(ByVal oPlayer1 As ReversiPlayer, ByVal oPlayer2 As ReversiPlayer) + + Public Sub New(ByVal f As System.Windows.Forms.Form, _ + ByVal p1 As ReversiPlayer, ByVal p2 As ReversiPlayer) + + MyBase.New() + pForm = f + + FPlayer1 = p1 + FPlayer2 = p2 + + If TypeOf FPlayer1 Is HumanReversiPlayer Then + AddHandler CType(FPlayer1, HumanReversiPlayer).MyMoveLoc, _ + AddressOf MoveToLocation + + ElseIf TypeOf FPlayer1 Is NetworkReversiPlayer Then + AddHandler CType(FPlayer1, NetworkReversiPlayer).MyMoveLoc, _ + AddressOf MoveToLocation + + ElseIf TypeOf FPlayer1 Is ComputerReversiPlayer Then + AddHandler CType(FPlayer1, ComputerReversiPlayer).MyMakeBestMove, _ + AddressOf MakeBestMove + + End If + + If TypeOf FPlayer2 Is HumanReversiPlayer Then + AddHandler CType(FPlayer2, HumanReversiPlayer).MyMoveLoc, _ + AddressOf MoveToLocation + + ElseIf TypeOf FPlayer2 Is NetworkReversiPlayer Then + AddHandler CType(FPlayer2, NetworkReversiPlayer).MyMoveLoc, _ + AddressOf MoveToLocation + + ElseIf TypeOf FPlayer2 Is ComputerReversiPlayer Then + AddHandler CType(FPlayer2, ComputerReversiPlayer).MyMakeBestMove, _ + AddressOf MakeBestMove + + End If + + StartGame() + End Sub + + 'the main "move a piece' sub. Called via event by human player. called by PC player after + 'determining best move to make. + 'this version simply calls the overloaded one after resolving the coordinates to a piece + Private Overloads Sub MoveToLocation(ByVal oPlayer As ReversiPlayer, _ + ByVal x As Integer, ByVal y As Integer) + + Dim aP As ReversiPiece + + aP = PieceLandedOn(x, y) + If aP Is Nothing Then Exit Sub 'didn't land on a square + + MoveToLocation(oPlayer, aP) + End Sub + + 'the main "move a piece' sub. Called via event by human player. called by PC player after + 'determining best move to make. Determines whose turn is next + Private Overloads Sub MoveToLocation(ByVal oPlayer As ReversiPlayer, ByVal aP As ReversiPiece) + + If aP.UnOccupied Then + + If CanMoveHere(aP, oPlayer) Then + MoveHere(aP, oPlayer) + + If TypeOf OtherPlayer(oPlayer) Is NetworkReversiPlayer Then + CType(OtherPlayer(oPlayer), NetworkReversiPlayer).SendMyTurnToOpponent(aP) + End If + + pForm.Invalidate() + Application.DoEvents() + Call CalcScores() + Else + RaiseEvent BadMove() + Exit Sub + End If + + If Not CheckIfGameOver() Then + If PlayerCantMoveAnywhere(OtherPlayer(oPlayer)) Then + RaiseEvent RepeatingTurn(oPlayer) + oPlayer.MyTurn = True 're-fires event + Else + oPlayer.MyTurn = False + OtherPlayer(oPlayer).MyTurn = True + End If + Else + oPlayer.MyTurn = False + OtherPlayer(oPlayer).MyTurn = False + End If + + Else + RaiseEvent BadMove() + End If + + End Sub + + Public Sub DrawBoard(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) + + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias + e.Graphics.FillRectangle(Brushes.Black, pForm.ClientRectangle) + + Dim aP As ReversiPiece + + For Each aP In aPieces + aP.Draw(e.Graphics) + Next + Application.DoEvents() + + End Sub + + Private Function CheckIfGameOver() As Boolean + + Dim bWon As Boolean + Dim bTie As Boolean + Dim oWinner As ReversiPlayer + + If (FPlayer1.Score + FPlayer2.Score) = 64 Then 'all squares filled + Select Case FPlayer2.Score.CompareTo(FPlayer1.Score) + Case 1 + bWon = True + oWinner = FPlayer2 + Case -1 + bWon = True + oWinner = FPlayer1 + Case 0 + bTie = True + End Select + + ElseIf FPlayer2.Score = 0 Then + bWon = True + oWinner = FPlayer1 + + ElseIf FPlayer1.Score = 0 Then + bWon = True + oWinner = FPlayer2 + + ElseIf PlayerCantMoveAnywhere(FPlayer2) And PlayerCantMoveAnywhere(FPlayer1) Then + Select Case FPlayer2.Score.CompareTo(FPlayer1.Score) + Case 1 + bWon = True + oWinner = FPlayer2 + Case -1 + bWon = True + oWinner = FPlayer1 + Case 0 + bTie = True + End Select + End If + + If bWon Then + RaiseEvent PlayerWon(oWinner) + FPlayer1.MyTurn = False 'nobody else can play + FPlayer2.MyTurn = False + Return True + ElseIf bTie Then + RaiseEvent TieGame() + FPlayer1.MyTurn = False 'nobody else can play + FPlayer2.MyTurn = False + Return True + End If + + End Function + + Private Function PlayerCantMoveAnywhere(ByVal oPlayer As ReversiPlayer) As Boolean + Dim aP As ReversiPiece + + For Each aP In aPieces + If aP.UnOccupied Then + If CanMoveHere(aP, oPlayer) Then + Return False + End If + End If + Next + + Return True + End Function + + Private Sub MakeBestMove(ByVal oPlayer As ReversiPlayer) + + Dim aP As ReversiPiece + + Dim iScore As Integer + Dim iHigh As Integer = -1 + Dim aPHigh As ReversiPiece + + PushBoard() + + For Each aP In aPieces + If aP.UnOccupied Then + If CanMoveHere(aP, oPlayer) Then + MoveHere(aP, oPlayer) + iScore = BoardValue(oPlayer) + If iScore > iHigh Then + iHigh = iScore + aPHigh = aP + End If + PopBoard() + End If + End If + Next + + System.Threading.Thread.Sleep(1000) 'wait a sec + + 'I'm pretty sure a move will ALWAYS be available, or this would never get called + If iHigh > 1 Then + MoveToLocation(oPlayer, aPHigh) + End If + End Sub + + Private Function BoardValue(ByVal oPlayer As ReversiPlayer) As Integer + + Dim aP As ReversiPiece + Dim r As Integer + + For Each aP In aPieces + If aP.Value.Equals(oPlayer.Color) Then + If aP.IsCorner Then + r += 20 + ElseIf aP.IsEdge Then + r += 5 + Else + r += 1 + End If + End If + Next + Return r + + End Function + + Private Function CanMoveOnThisLine(ByVal aP As ReversiPiece, _ + ByVal oPlayer As ReversiPlayer, ByVal iX As Integer, ByVal iY As Integer) As Boolean + + Dim x, y As Integer + Dim bDone As Boolean + Dim bFound As Boolean = False + + 'travel 1 piece away in the proper direction + x = aP.xElt + iX + y = aP.yElt + iY + + 'if off board, exit + If x < 0 Or x > 7 Then Exit Function + If y < 0 Or y > 7 Then Exit Function + + 'make sure piece one away is opposite color + If Not aPieces(x, y).Value.Equals(oPlayer.OpponentColor) Then Exit Function + + 'now, start looping. Looking for one of our pieces before the edge of the board or a blank + x += iX + y += iY + bDone = (x < 0 Or x > 7 Or y < 0 Or y > 7) + Do While Not (bDone Or bFound) + If aPieces(x, y).Value.Equals(oPlayer.Color) Then + bFound = True + ElseIf aPieces(x, y).UnOccupied Then + bDone = True + Else + x += iX + y += iY + bDone = (x < 0 Or x > 7 Or y < 0 Or y > 7) + End If + Loop + + Return bFound + End Function + + Private Function CanMoveHere(ByVal aP As ReversiPiece, ByVal oPlayer As ReversiPlayer) As Boolean + + Dim x, y As Integer + + For x = -1 To 1 + For y = -1 To 1 + If Not (x = 0 And y = 0) Then + If CanMoveOnThisLine(aP, oPlayer, x, y) Then Return True + End If + Next + Next + + Return False + + End Function + + Private Sub MoveHere(ByVal aP As ReversiPiece, ByVal oPlayer As ReversiPlayer) + + Dim x, y As Integer + + aP.Value = oPlayer.Color + + For x = -1 To 1 + For y = -1 To 1 + If Not (x = 0 And y = 0) Then + If CanMoveOnThisLine(aP, oPlayer, x, y) Then + MoveGuysOnThisLine(aP, oPlayer, x, y) + End If + End If + Next + Next + + End Sub + + Private Sub CalcScores() + + Dim aP As ReversiPiece + + FPlayer2.Score = 0 + FPlayer1.Score = 0 + For Each aP In aPieces + If aP.Value.Equals(FPlayer1.Color) Then FPlayer1.Score += 1 + If aP.Value.Equals(FPlayer2.Color) Then FPlayer2.Score += 1 + Next + RaiseEvent UpdateScore(FPlayer1, FPlayer2) + + End Sub + + Private Sub MoveGuysOnThisLine(ByVal aP As ReversiPiece, _ + ByVal oPlayer As ReversiPlayer, ByVal iX As Integer, ByVal iY As Integer) + + Dim x, y As Integer + Dim bDone As Boolean + + 'travel 1 piece away in the proper direction + 'don't have to check that piece is right color or off board, already determined + x = aP.xElt + iX + y = aP.yElt + iY + + bDone = False + Do While Not bDone + If aPieces(x, y).Value.Equals(oPlayer.Color) Then + bDone = True + ElseIf aPieces(x, y).UnOccupied Then + bDone = True + Else + aPieces(x, y).Value = oPlayer.Color + x += iX + y += iY + bDone = (x < 0 Or x > 7 Or y < 0 Or y > 7) + End If + Loop + + End Sub + + Private Function PieceLandedOn(ByVal x As Integer, ByVal y As Integer) As ReversiPiece + + Dim aP As ReversiPiece + + For Each aP In aPieces + If aP.MouseIn(x, y) Then + Return aP + End If + Next + Return Nothing + + End Function + + Private FForm As System.Windows.Forms.Form + Public Property pForm() As System.Windows.Forms.Form + Get + Return FForm + End Get + Set(ByVal Value As System.Windows.Forms.Form) + FForm = Value + AddHandler FForm.Paint, AddressOf DrawBoard + + FForm.Width = 394 + 'FForm.Height = 456 + FForm.Height = (PIECESIZE * 8) + SystemInformation.MenuHeight + SystemInformation.CaptionHeight + 34 + + End Set + End Property + + + Private Sub StartGame() + + Dim x, y As Integer + Dim oSiz As New Size(PIECESIZE, PIECESIZE) + + For x = 0 To 7 + For y = 0 To 7 + + aPieces(x, y) = New ReversiPiece + With aPieces(x, y) + .Location = New Point(x * PIECESIZE, y * PIECESIZE) + .Size = oSiz + + Select Case (y * 8) + x + Case 27, 36 + .Value = Color.Red + Case 28, 35 + .Value = Color.Blue + Case Else + .Value = Color.Empty + End Select + End With + Next + Next + + Call CalcScores() + + End Sub + + Private Function OtherPlayer(ByVal oPlayer As ReversiPlayer) As ReversiPlayer + Return IIf(oPlayer Is FPlayer1, FPlayer2, FPlayer1) + End Function + + Private Sub PushBoard() + + Dim aP As ReversiPiece + + For Each aP In aPieces + aP.PushValue() + Next + + End Sub + + Private Sub PopBoard() + + Dim aP As ReversiPiece + + For Each aP In aPieces + aP.PopValue() + Next + + End Sub +End Class \ No newline at end of file diff --git a/Files/NetReversi/bin/NetReversi.exe b/Files/NetReversi/bin/NetReversi.exe new file mode 100644 index 0000000..ac8f858 Binary files /dev/null and b/Files/NetReversi/bin/NetReversi.exe differ diff --git a/Files/NetReversi/bin/NetReversi.pdb b/Files/NetReversi/bin/NetReversi.pdb new file mode 100644 index 0000000..4dffe31 Binary files /dev/null and b/Files/NetReversi/bin/NetReversi.pdb differ diff --git a/Files/NetReversi/fClientConnect.resx b/Files/NetReversi/fClientConnect.resx new file mode 100644 index 0000000..d3cecea --- /dev/null +++ b/Files/NetReversi/fClientConnect.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + fClientConnect + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/NetReversi/fClientConnect.vb b/Files/NetReversi/fClientConnect.vb new file mode 100644 index 0000000..02a82aa --- /dev/null +++ b/Files/NetReversi/fClientConnect.vb @@ -0,0 +1,164 @@ +Imports System.Threading +Imports System.Net.Sockets +Imports System.Net +Imports System.IO + +Public Class fClientConnect + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents cbCancel As System.Windows.Forms.Button + Friend WithEvents lbOut As System.Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.lbOut = New System.Windows.Forms.Label + Me.cbCancel = New System.Windows.Forms.Button + Me.Label1 = New System.Windows.Forms.Label + Me.SuspendLayout() + ' + 'lbOut + ' + Me.lbOut.Location = New System.Drawing.Point(24, 32) + Me.lbOut.Name = "lbOut" + Me.lbOut.Size = New System.Drawing.Size(160, 23) + Me.lbOut.TabIndex = 3 + Me.lbOut.Text = "Hit Cancel to Stop Waiting" + ' + 'cbCancel + ' + Me.cbCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.cbCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.cbCancel.Location = New System.Drawing.Point(189, 61) + Me.cbCancel.Name = "cbCancel" + Me.cbCancel.TabIndex = 2 + Me.cbCancel.Text = "Cancel" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(24, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(160, 23) + Me.Label1.TabIndex = 4 + Me.Label1.Text = "Looking for Server" + ' + 'fClientConnect + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(278, 99) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.lbOut) + Me.Controls.Add(Me.cbCancel) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Name = "fClientConnect" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Waiting to Connect..." + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private THEPORT As Integer = 8878 + + Private FPlayerName As String + Private FServerName As String + Private FOpponentName As String + + Private FThread As Thread + Private FClient As TcpClient + + Sub New(ByVal cName As String, ByVal cServer As String) + + InitializeComponent() + + FPlayerName = cName + FServerName = cServer + + FThread = New Thread(AddressOf LookForIt) + FThread.Start() + End Sub + + Private Sub LookForIt() + + Dim oStream As NetworkStream + Dim oRead As StreamReader + Dim oByte() As Byte + Dim cSend As String + + FClient = New TcpClient(FServerName, THEPORT) + + lbOut.Text = "Connecting..." + Application.DoEvents() + + Me.Cursor = Cursors.WaitCursor + Try + + 'open the stream, Send your name to the server. read his name back + 'this is the opposite order of the server + oStream = FClient.GetStream + + cSend = FPlayerName & Microsoft.VisualBasic.vbCrLf 'add crlf so READLINE works + oByte = System.Text.Encoding.ASCII.GetBytes(cSend.ToCharArray()) + oStream.Write(oByte, 0, oByte.Length) + + FThread.Sleep(500) + + oRead = New StreamReader(oStream) + FOpponentName = oRead.ReadLine + + Finally + Me.Cursor = Cursors.Default + Me.DialogResult = DialogResult.OK + Me.Close() + End Try + End Sub + + Private Sub cbCancel_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbCancel.Click + + FThread.Abort() + + End Sub + + ReadOnly Property pOpponentName() As String + Get + Return FOpponentName + End Get + End Property + + ReadOnly Property pClient() As TcpClient + Get + Return FClient + End Get + End Property +End Class + diff --git a/Files/NetReversi/fMain.resx b/Files/NetReversi/fMain.resx new file mode 100644 index 0000000..ffcb50b --- /dev/null +++ b/Files/NetReversi/fMain.resx @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 25 + + + True + + + fMain + + + Assembly + + \ No newline at end of file diff --git a/Files/NetReversi/fMain.vb b/Files/NetReversi/fMain.vb new file mode 100644 index 0000000..8d37b82 --- /dev/null +++ b/Files/NetReversi/fMain.vb @@ -0,0 +1,263 @@ + +Imports System.Threading +Imports System.net.sockets + +Public Class fMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents oMenu As System.Windows.Forms.MainMenu + Friend WithEvents mFile As System.Windows.Forms.MenuItem + Friend WithEvents mNew As System.Windows.Forms.MenuItem + Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem + Friend WithEvents mExit As System.Windows.Forms.MenuItem + Friend WithEvents sbLower As System.Windows.Forms.StatusBar + Friend WithEvents sb0 As System.Windows.Forms.StatusBarPanel + Friend WithEvents sb1 As System.Windows.Forms.StatusBarPanel + Private Sub InitializeComponent() + Me.oMenu = New System.Windows.Forms.MainMenu + Me.mFile = New System.Windows.Forms.MenuItem + Me.mNew = New System.Windows.Forms.MenuItem + Me.MenuItem3 = New System.Windows.Forms.MenuItem + Me.mExit = New System.Windows.Forms.MenuItem + Me.sbLower = New System.Windows.Forms.StatusBar + Me.sb0 = New System.Windows.Forms.StatusBarPanel + Me.sb1 = New System.Windows.Forms.StatusBarPanel + CType(Me.sb0, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.sb1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'oMenu + ' + Me.oMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mFile}) + ' + 'mFile + ' + Me.mFile.Index = 0 + Me.mFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mNew, Me.MenuItem3, Me.mExit}) + Me.mFile.Text = "&File" + ' + 'mNew + ' + Me.mNew.Index = 0 + Me.mNew.Text = "&New" + ' + 'MenuItem3 + ' + Me.MenuItem3.Index = 1 + Me.MenuItem3.Text = "-" + ' + 'mExit + ' + Me.mExit.Index = 2 + Me.mExit.Text = "E&xit" + ' + 'sbLower + ' + Me.sbLower.Location = New System.Drawing.Point(0, 339) + Me.sbLower.Name = "sbLower" + Me.sbLower.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.sb0, Me.sb1}) + Me.sbLower.ShowPanels = True + Me.sbLower.Size = New System.Drawing.Size(400, 22) + Me.sbLower.TabIndex = 0 + ' + 'sb0 + ' + Me.sb0.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring + Me.sb0.Width = 192 + ' + 'sb1 + ' + Me.sb1.Width = 192 + ' + 'fMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(400, 361) + Me.Controls.Add(Me.sbLower) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Menu = Me.oMenu + Me.Name = "fMain" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Network Reversi" + CType(Me.sb0, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.sb1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Dim Player1 As ReversiPlayer + Dim Player2 As ReversiPlayer + Dim Game As ReversiGame + + Dim oThread As Threading.Thread + Dim oClient As TCPClient + + Private Sub mNew_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles mNew.Click + + ShutStuffDown() 'shut down old stuff if second game + + Dim f As New fNewGame + If f.ShowDialog <> DialogResult.Cancel Then + + Dim bGameOn As Boolean = True + + If f.rbComputer.Checked Then + Player1 = New HumanReversiPlayer(f.tbPlayerName.Text, Color.Red, Me) + Player2 = New ComputerReversiPlayer("BorgBlue", Color.Blue) + ElseIf f.rbHuman.Checked Then + Player1 = New HumanReversiPlayer(f.tbPlayerName.Text, Color.Red, Me) + Player2 = New HumanReversiPlayer(f.tbPlayer2Name.Text, Color.Blue, Me) + Else 'network game + If f.rbSrv0.Checked Then + + Dim fSrv As New fServerConnect(f.tbPlayerName.Text) + If fSrv.ShowDialog = DialogResult.OK Then + + oClient = fSrv.pClient 'save the client so we can close it + + Player1 = New HumanReversiPlayer(f.tbPlayerName.Text, Color.Red, Me) + Player2 = New NetworkReversiPlayer(fSrv.pOpponentName, _ + Color.Blue, oClient.GetStream) + + oThread = New Thread(New ThreadStart( _ + AddressOf CType(Player2, NetworkReversiPlayer).LookForTurn)) + oThread.Start() + + Else + bGameOn = False + End If + + Else + Dim fCl As New fClientConnect(f.tbPlayerName.Text, f.tbIPAddress.Text) + If fCl.ShowDialog = DialogResult.OK Then + + oClient = fCl.pClient 'save the client so we can close it + + Player1 = New NetworkReversiPlayer(fCl.pOpponentName, _ + Color.Red, oClient.GetStream) + + oThread = New Thread(New ThreadStart( _ + AddressOf CType(Player1, NetworkReversiPlayer).LookForTurn)) + oThread.Start() + + Player2 = New HumanReversiPlayer(f.tbPlayerName.Text, Color.Blue, Me) + + End If + End If + + End If + + If bGameOn Then + AddHandler Player1.IsMyTurn, AddressOf TurnNotify + AddHandler Player2.IsMyTurn, AddressOf TurnNotify + + Game = New ReversiGame(Me, Player1, Player2) + AddHandler Game.BadMove, AddressOf BadMoveNotify + AddHandler Game.PlayerWon, AddressOf PlayerWonNotify + AddHandler Game.TieGame, AddressOf TieGameNotify + AddHandler Game.RepeatingTurn, AddressOf RepeatTurnNotify + AddHandler Game.UpdateScore, AddressOf ScoreUpdateNotify + + Player1.MyTurn = True + Me.Invalidate() + Else + sb0.Text = "game cancelled" + End If + End If + + End Sub + + Private Sub ShutStuffDown() + If Not (oThread Is Nothing) Then + Try + oThread.Abort() + Catch + 'don't care + End Try + End If + If Not (oClient Is Nothing) Then + Try + oClient.Close() + Catch + 'don't care + End Try + End If + End Sub + + Private Sub TurnNotify(ByVal oPlayer As ReversiPlayer) + sb0.Text = oPlayer.Name & "'s turn (" & oPlayer.Color.ToString & ")" + End Sub + + Private Sub BadMoveNotify() + sb0.Text = "Illegal move, try again" + End Sub + + Private Sub PlayerWonNotify(ByVal oPlayer As ReversiPlayer) + sb0.Text = oPlayer.Name & " won the game!" + End Sub + + Private Sub TieGameNotify() + sb0.Text = "this game ends in a tie" + End Sub + + Private Sub RepeatTurnNotify(ByVal oPlayer As ReversiPlayer) + sb0.Text = oPlayer.Name & " gets to move again" + End Sub + + Private Sub ScoreUpdateNotify(ByVal oPlayer1 As ReversiPlayer, ByVal oPlayer2 As ReversiPlayer) + sb1.Text = oPlayer1.Name & ": " & oPlayer1.Score & ", " _ + & oPlayer2.Name & ": " & oPlayer2.Score + End Sub + + Private Sub fMain_Closing(ByVal sender As Object, _ + ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing + + ShutStuffDown() + End Sub + + Private Sub fMain_Load(ByVal sender As Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + End Sub + + Private Sub mExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mExit.Click + If MsgBox("End Game?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, "Quit") = MsgBoxResult.Yes Then + Me.Close() + End If + End Sub +End Class diff --git a/Files/NetReversi/fNewGame.resx b/Files/NetReversi/fNewGame.resx new file mode 100644 index 0000000..2681c2d --- /dev/null +++ b/Files/NetReversi/fNewGame.resx @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 8, 8 + + + True + + + False + + + True + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + 8, 8 + + + True + + + False + + + True + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + + fNewGame + + \ No newline at end of file diff --git a/Files/NetReversi/fNewGame.vb b/Files/NetReversi/fNewGame.vb new file mode 100644 index 0000000..479096e --- /dev/null +++ b/Files/NetReversi/fNewGame.vb @@ -0,0 +1,250 @@ +Public Class fNewGame + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents gbNetwork As System.Windows.Forms.GroupBox + Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox + Friend WithEvents lbPlayer1 As System.Windows.Forms.Label + Friend WithEvents cbOk As System.Windows.Forms.Button + Friend WithEvents cbCancel As System.Windows.Forms.Button + Friend WithEvents rbSrv0 As System.Windows.Forms.RadioButton + Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton + Friend WithEvents tbIPAddress As System.Windows.Forms.TextBox + Friend WithEvents lbAddr As System.Windows.Forms.Label + Friend WithEvents lbOpp As System.Windows.Forms.Label + Friend WithEvents tbPlayerName As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents tbPlayer2Name As System.Windows.Forms.TextBox + Friend WithEvents rbNetwork As System.Windows.Forms.RadioButton + Friend WithEvents rbHuman As System.Windows.Forms.RadioButton + Friend WithEvents rbComputer As System.Windows.Forms.RadioButton + Private Sub InitializeComponent() + Me.gbNetwork = New System.Windows.Forms.GroupBox + Me.tbIPAddress = New System.Windows.Forms.TextBox + Me.RadioButton2 = New System.Windows.Forms.RadioButton + Me.rbSrv0 = New System.Windows.Forms.RadioButton + Me.lbAddr = New System.Windows.Forms.Label + Me.GroupBox2 = New System.Windows.Forms.GroupBox + Me.tbPlayer2Name = New System.Windows.Forms.TextBox + Me.rbNetwork = New System.Windows.Forms.RadioButton + Me.rbHuman = New System.Windows.Forms.RadioButton + Me.rbComputer = New System.Windows.Forms.RadioButton + Me.tbPlayerName = New System.Windows.Forms.TextBox + Me.lbPlayer1 = New System.Windows.Forms.Label + Me.lbOpp = New System.Windows.Forms.Label + Me.Label1 = New System.Windows.Forms.Label + Me.cbOk = New System.Windows.Forms.Button + Me.cbCancel = New System.Windows.Forms.Button + Me.gbNetwork.SuspendLayout() + Me.GroupBox2.SuspendLayout() + Me.SuspendLayout() + ' + 'gbNetwork + ' + Me.gbNetwork.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.gbNetwork.Controls.Add(Me.tbIPAddress) + Me.gbNetwork.Controls.Add(Me.RadioButton2) + Me.gbNetwork.Controls.Add(Me.rbSrv0) + Me.gbNetwork.Controls.Add(Me.lbAddr) + Me.gbNetwork.Enabled = False + Me.gbNetwork.Location = New System.Drawing.Point(8, 192) + Me.gbNetwork.Name = "gbNetwork" + Me.gbNetwork.Size = New System.Drawing.Size(264, 128) + Me.gbNetwork.TabIndex = 2 + Me.gbNetwork.TabStop = False + Me.gbNetwork.Text = "Connection Info" + ' + 'tbIPAddress + ' + Me.tbIPAddress.Location = New System.Drawing.Point(120, 88) + Me.tbIPAddress.Name = "tbIPAddress" + Me.tbIPAddress.TabIndex = 2 + Me.tbIPAddress.Text = "127.0.0.1" + ' + 'RadioButton2 + ' + Me.RadioButton2.Location = New System.Drawing.Point(16, 56) + Me.RadioButton2.Name = "RadioButton2" + Me.RadioButton2.Size = New System.Drawing.Size(192, 24) + Me.RadioButton2.TabIndex = 1 + Me.RadioButton2.Text = "Connect to Someone else" + ' + 'rbSrv0 + ' + Me.rbSrv0.Checked = True + Me.rbSrv0.Location = New System.Drawing.Point(16, 24) + Me.rbSrv0.Name = "rbSrv0" + Me.rbSrv0.Size = New System.Drawing.Size(208, 24) + Me.rbSrv0.TabIndex = 0 + Me.rbSrv0.TabStop = True + Me.rbSrv0.Text = "Wait for Someone to connect to me" + ' + 'lbAddr + ' + Me.lbAddr.Location = New System.Drawing.Point(56, 88) + Me.lbAddr.Name = "lbAddr" + Me.lbAddr.TabIndex = 3 + Me.lbAddr.Text = "IP Address" + ' + 'GroupBox2 + ' + Me.GroupBox2.Controls.Add(Me.tbPlayer2Name) + Me.GroupBox2.Controls.Add(Me.rbNetwork) + Me.GroupBox2.Controls.Add(Me.rbHuman) + Me.GroupBox2.Controls.Add(Me.rbComputer) + Me.GroupBox2.Controls.Add(Me.tbPlayerName) + Me.GroupBox2.Controls.Add(Me.lbPlayer1) + Me.GroupBox2.Controls.Add(Me.lbOpp) + Me.GroupBox2.Controls.Add(Me.Label1) + Me.GroupBox2.Location = New System.Drawing.Point(8, 8) + Me.GroupBox2.Name = "GroupBox2" + Me.GroupBox2.Size = New System.Drawing.Size(264, 168) + Me.GroupBox2.TabIndex = 4 + Me.GroupBox2.TabStop = False + Me.GroupBox2.Text = "My Info" + ' + 'tbPlayer2Name + ' + Me.tbPlayer2Name.Location = New System.Drawing.Point(128, 104) + Me.tbPlayer2Name.Name = "tbPlayer2Name" + Me.tbPlayer2Name.Size = New System.Drawing.Size(104, 21) + Me.tbPlayer2Name.TabIndex = 10 + Me.tbPlayer2Name.Text = "Player2" + ' + 'rbNetwork + ' + Me.rbNetwork.Location = New System.Drawing.Point(80, 136) + Me.rbNetwork.Name = "rbNetwork" + Me.rbNetwork.Size = New System.Drawing.Size(176, 24) + Me.rbNetwork.TabIndex = 8 + Me.rbNetwork.Text = "other player, different PC" + ' + 'rbHuman + ' + Me.rbHuman.Location = New System.Drawing.Point(82, 80) + Me.rbHuman.Name = "rbHuman" + Me.rbHuman.Size = New System.Drawing.Size(176, 24) + Me.rbHuman.TabIndex = 7 + Me.rbHuman.Text = "other player, using same PC" + ' + 'rbComputer + ' + Me.rbComputer.Checked = True + Me.rbComputer.Location = New System.Drawing.Point(82, 56) + Me.rbComputer.Name = "rbComputer" + Me.rbComputer.TabIndex = 6 + Me.rbComputer.TabStop = True + Me.rbComputer.Text = "the computer" + ' + 'tbPlayerName + ' + Me.tbPlayerName.Location = New System.Drawing.Point(72, 24) + Me.tbPlayerName.Name = "tbPlayerName" + Me.tbPlayerName.Size = New System.Drawing.Size(104, 21) + Me.tbPlayerName.TabIndex = 4 + Me.tbPlayerName.Text = "Player1" + ' + 'lbPlayer1 + ' + Me.lbPlayer1.Location = New System.Drawing.Point(16, 24) + Me.lbPlayer1.Name = "lbPlayer1" + Me.lbPlayer1.TabIndex = 5 + Me.lbPlayer1.Text = "Name:" + ' + 'lbOpp + ' + Me.lbOpp.Location = New System.Drawing.Point(16, 80) + Me.lbOpp.Name = "lbOpp" + Me.lbOpp.TabIndex = 9 + Me.lbOpp.Text = "Opponent" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(88, 104) + Me.Label1.Name = "Label1" + Me.Label1.TabIndex = 11 + Me.Label1.Text = "Name:" + ' + 'cbOk + ' + Me.cbOk.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.cbOk.DialogResult = System.Windows.Forms.DialogResult.OK + Me.cbOk.Location = New System.Drawing.Point(280, 264) + Me.cbOk.Name = "cbOk" + Me.cbOk.TabIndex = 5 + Me.cbOk.Text = "Ok" + ' + 'cbCancel + ' + Me.cbCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.cbCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.cbCancel.Location = New System.Drawing.Point(280, 296) + Me.cbCancel.Name = "cbCancel" + Me.cbCancel.TabIndex = 6 + Me.cbCancel.Text = "Cancel" + ' + 'fNewGame + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(360, 333) + Me.Controls.Add(Me.cbCancel) + Me.Controls.Add(Me.cbOk) + Me.Controls.Add(Me.GroupBox2) + Me.Controls.Add(Me.gbNetwork) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.Name = "fNewGame" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Start New Game" + Me.gbNetwork.ResumeLayout(False) + Me.GroupBox2.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub tbPlayer_GotFocus(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles tbPlayerName.GotFocus, tbPlayer2Name.GotFocus + + Dim tb As TextBox = sender + + tb.SelectAll() + End Sub + + Private Sub rbOpp2_CheckedChanged(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles rbNetwork.CheckedChanged, _ + rbHuman.CheckedChanged, rbComputer.CheckedChanged + + gbNetwork.Enabled = rbNetwork.Checked + End Sub + +End Class diff --git a/Files/NetReversi/fServerConnect.resx b/Files/NetReversi/fServerConnect.resx new file mode 100644 index 0000000..cfee94e --- /dev/null +++ b/Files/NetReversi/fServerConnect.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + + fServerConnect + + \ No newline at end of file diff --git a/Files/NetReversi/fServerConnect.vb b/Files/NetReversi/fServerConnect.vb new file mode 100644 index 0000000..ea17ab8 --- /dev/null +++ b/Files/NetReversi/fServerConnect.vb @@ -0,0 +1,172 @@ +Imports System.Threading +Imports System.Net.Sockets +Imports System.Net +Imports System.IO + +Public Class fServerConnect + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents cbCancel As System.Windows.Forms.Button + Friend WithEvents lbOut As System.Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.cbCancel = New System.Windows.Forms.Button + Me.lbOut = New System.Windows.Forms.Label + Me.Label1 = New System.Windows.Forms.Label + Me.SuspendLayout() + ' + 'cbCancel + ' + Me.cbCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.cbCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.cbCancel.Location = New System.Drawing.Point(190, 62) + Me.cbCancel.Name = "cbCancel" + Me.cbCancel.TabIndex = 0 + Me.cbCancel.Text = "Cancel" + ' + 'lbOut + ' + Me.lbOut.Location = New System.Drawing.Point(24, 32) + Me.lbOut.Name = "lbOut" + Me.lbOut.Size = New System.Drawing.Size(160, 23) + Me.lbOut.TabIndex = 1 + Me.lbOut.Text = "Hit Cancel to Stop Waiting" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(24, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(160, 23) + Me.Label1.TabIndex = 2 + Me.Label1.Text = "Waiting for Client to Connect" + ' + 'fServerConnect + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(278, 99) + Me.Controls.Add(Me.cbCancel) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.lbOut) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Name = "fServerConnect" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Waiting" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private THEPORT As Integer = 8878 + Private FPlayerName As String + Private FOpponentName As String + + Private FThread As Thread + Private FListen As TcpListener + Private FClient As TcpClient + + Sub New(ByVal cName As String) + InitializeComponent() 'note - had to copy from normal constructor + + FPlayerName = cName + + Dim oIPA As IPAddress = Dns.Resolve("localhost").AddressList(0) + + Try + FListen = New TcpListener(oIPA, THEPORT) + FListen.Start() + Catch oEx As Exception + MsgBox(oEx.ToString) + End Try + + FThread = New Thread(AddressOf LookForIt) + FThread.Start() + + End Sub + + Private Sub LookForIt() + + Dim oStream As NetworkStream + Dim oRead As StreamReader + Dim oByte() As Byte + Dim cSend As String + + FClient = FListen.AcceptTcpClient + + lbOut.Text = "Connecting..." + Application.DoEvents() + + Me.Cursor = Cursors.WaitCursor + Try + + 'open the stream, read the name of the opponent. Send your name back + oStream = FClient.GetStream + oRead = New StreamReader(oStream) + + FOpponentName = oRead.ReadLine + FThread.Sleep(500) + + cSend = FPlayerName & Microsoft.VisualBasic.vbCrLf 'add crlf so READLINE works + oByte = System.Text.Encoding.ASCII.GetBytes(cSend.ToCharArray()) + oStream.Write(oByte, 0, oByte.Length) + + FListen.Stop() + + Finally + Me.Cursor = Cursors.Default + Me.DialogResult = DialogResult.OK + Me.Close() + End Try + End Sub + + Private Sub cbCancel_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbCancel.Click + + FThread.Abort() + FListen.Stop() + + End Sub + + ReadOnly Property pOpponentName() As String + Get + Return FOpponentName + End Get + End Property + + ReadOnly Property pClient() As TcpClient + Get + Return FClient + End Get + End Property + +End Class diff --git a/Files/NetReversi/obj/Debug/NetReversi.exe b/Files/NetReversi/obj/Debug/NetReversi.exe new file mode 100644 index 0000000..ac8f858 Binary files /dev/null and b/Files/NetReversi/obj/Debug/NetReversi.exe differ diff --git a/Files/NetReversi/obj/Debug/NetReversi.fClientConnect.resources b/Files/NetReversi/obj/Debug/NetReversi.fClientConnect.resources new file mode 100644 index 0000000..e64d9a9 Binary files /dev/null and b/Files/NetReversi/obj/Debug/NetReversi.fClientConnect.resources differ diff --git a/Files/NetReversi/obj/Debug/NetReversi.fMain.resources b/Files/NetReversi/obj/Debug/NetReversi.fMain.resources new file mode 100644 index 0000000..910ff38 Binary files /dev/null and b/Files/NetReversi/obj/Debug/NetReversi.fMain.resources differ diff --git a/Files/NetReversi/obj/Debug/NetReversi.fNewGame.resources b/Files/NetReversi/obj/Debug/NetReversi.fNewGame.resources new file mode 100644 index 0000000..a65b392 Binary files /dev/null and b/Files/NetReversi/obj/Debug/NetReversi.fNewGame.resources differ diff --git a/Files/NetReversi/obj/Debug/NetReversi.fServerConnect.resources b/Files/NetReversi/obj/Debug/NetReversi.fServerConnect.resources new file mode 100644 index 0000000..7aee5fb Binary files /dev/null and b/Files/NetReversi/obj/Debug/NetReversi.fServerConnect.resources differ diff --git a/Files/NetReversi/obj/Debug/NetReversi.pdb b/Files/NetReversi/obj/Debug/NetReversi.pdb new file mode 100644 index 0000000..4dffe31 Binary files /dev/null and b/Files/NetReversi/obj/Debug/NetReversi.pdb differ diff --git a/Files/NineTiles/AssemblyInfo.vb b/Files/NineTiles/AssemblyInfo.vb new file mode 100644 index 0000000..0f371b8 --- /dev/null +++ b/Files/NineTiles/AssemblyInfo.vb @@ -0,0 +1,31 @@ +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/NineTiles/NineTiles.sln b/Files/NineTiles/NineTiles.sln new file mode 100644 index 0000000..5e6aeb7 --- /dev/null +++ b/Files/NineTiles/NineTiles.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NineTiles", "NineTiles.vbproj", "{ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Debug.ActiveCfg = Debug|.NET + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Debug.Build.0 = Debug|.NET + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Release.ActiveCfg = Release|.NET + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/NineTiles/NineTiles.sln.old b/Files/NineTiles/NineTiles.sln.old new file mode 100644 index 0000000..5b3b81e --- /dev/null +++ b/Files/NineTiles/NineTiles.sln.old @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NineTiles", "NineTiles.vbproj", "{ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Debug.ActiveCfg = Debug|.NET + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Debug.Build.0 = Debug|.NET + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Release.ActiveCfg = Release|.NET + {ED1295D4-FDA9-4C0B-A756-77C5214A3EAE}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/NineTiles/NineTiles.suo b/Files/NineTiles/NineTiles.suo new file mode 100644 index 0000000..05b32b6 Binary files /dev/null and b/Files/NineTiles/NineTiles.suo differ diff --git a/Files/NineTiles/NineTiles.vbproj b/Files/NineTiles/NineTiles.vbproj new file mode 100644 index 0000000..23ed6d9 --- /dev/null +++ b/Files/NineTiles/NineTiles.vbproj @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/NineTiles/NineTiles.vbproj.user b/Files/NineTiles/NineTiles.vbproj.user new file mode 100644 index 0000000..d743a76 --- /dev/null +++ b/Files/NineTiles/NineTiles.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/NineTiles/NumberPanel.vb b/Files/NineTiles/NumberPanel.vb new file mode 100644 index 0000000..b81406b --- /dev/null +++ b/Files/NineTiles/NumberPanel.vb @@ -0,0 +1,382 @@ +Imports System.Windows.Forms +Imports System.Drawing.Imaging +Imports System.Math + +Public Class NumberPanel + Inherits Panel + + Private Const IRAD As Integer = 112 + + Private fbNum As Bitmap + Private bBack As Bitmap + Private FInAnimation As Boolean + + Private oTiles As ArrayList + + Public Event TileMoving(ByVal FBackwards As Boolean) + + Public Sub New() + MyBase.New() + + Me.SetStyle(ControlStyles.UserPaint, True) + Me.SetStyle(ControlStyles.DoubleBuffer, True) + Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True) + + Dim a As Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + fbNum = New Bitmap(a.GetManifestResourceStream("NineTiles.numbertiles.bmp")) + + Call CreateTiles() + + Me.Height = IRAD * 3 + Me.Width = IRAD * 3 + + End Sub + + Public Overloads Sub Dispose() + fbNum.Dispose() + MyBase.Dispose() + End Sub + + Private Sub CreateTiles() + + Dim i As Integer + Dim t As TileData + + oTiles = New ArrayList() + For i = 1 To 9 + t = New TileData(Me, i) + oTiles.Add(t) + Next + + End Sub + + Protected Sub OnTileMoving(ByVal FBackwards As Boolean) + RaiseEvent TileMoving(FBackwards) + End Sub + + Protected Overrides Sub OnResize(ByVal eventargs As System.EventArgs) + MyBase.OnResize(EventArgs) + Call SetupBackground() + End Sub + + Private Sub SetupBackground() + If Not bBack Is Nothing Then bBack.Dispose() + 'bBack = New Bitmap(Me.Width, Me.Height, PixelFormat.Format32bppPArgb) + bBack = New Bitmap(Me.Width, Me.Height) + End Sub + + Public Function TilesVisible() As Boolean + + Dim aTile As TileData + Dim i As Integer = 0 + + For Each aTile In oTiles + If aTile.pVisible Then + i += 1 + End If + Next + Return i + + End Function + + ReadOnly Property bInAnimation() + Get + Return FInAnimation + End Get + End Property + + ReadOnly Property Result() As Integer + Get + Dim aTile As TileData + Dim i As Integer = 0 + + For Each aTile In oTiles + If aTile.pVisible And aTile.pBackwards Then + i += aTile.pTileNum + End If + Next + Return i + End Get + End Property + + Public Sub HideBackward() + Dim aTile As TileData + + For Each aTile In oTiles + If aTile.pVisible And aTile.pBackwards Then + aTile.pVisible = False + End If + Next + Me.Invalidate() + Application.DoEvents() + End Sub + + 'checks all combinations of 1, 2, 3, and 4 visible tiles + Public Function ResultAvailable(ByVal iDesired As Integer) As Boolean + + Dim i, j, k, l As Integer + Dim aTilei, aTilej, aTilek, aTilel As TileData + + 'one-bangers + For i = 0 To oTiles.Count - 1 + aTilei = oTiles(i) + If aTilei.pVisible Then + If aTilei.pTileNum = iDesired Then + Return True + End If + End If + Next + + '2-bangers + For i = 0 To oTiles.Count - 2 + For j = i + 1 To oTiles.Count - 1 + aTilei = oTiles(i) + aTilej = oTiles(j) + If aTilei.pVisible And _ + aTilej.pVisible Then + + If aTilei.pTileNum + aTilej.pTileNum = iDesired Then + Return True + End If + + End If + Next + Next + + '3-bangers + For i = 0 To oTiles.Count - 3 + For j = i + 1 To oTiles.Count - 2 + For k = j + 1 To oTiles.Count - 1 + aTilei = oTiles(i) + aTilej = oTiles(j) + aTilek = oTiles(k) + If aTilei.pVisible And _ + aTilej.pVisible And _ + aTilek.pVisible Then + + If aTilei.pTileNum + aTilej.pTileNum + aTilek.pTileNum = iDesired Then + Return True + End If + + End If + Next + Next + Next + + '4-bangers + For i = 0 To oTiles.Count - 4 + For j = i + 1 To oTiles.Count - 3 + For k = j + 1 To oTiles.Count - 2 + For l = k + 1 To oTiles.Count - 1 + + aTilei = oTiles(i) + aTilej = oTiles(j) + aTilek = oTiles(k) + aTilel = oTiles(l) + If aTilei.pVisible And _ + aTilej.pVisible And _ + aTilek.pVisible And _ + aTilel.pVisible Then + + If aTilei.pTileNum + _ + aTilej.pTileNum + _ + aTilek.pTileNum + _ + aTilel.pTileNum = iDesired Then + Return True + End If + End If + Next + Next + Next + Next + + End Function + + Public Sub ResetTiles() + + Dim t As TileData + + For Each t In oTiles + t.Reset() + Next + + Me.Invalidate() + Application.DoEvents() + + End Sub + + Private Function TileFromPoint(ByVal x As Long, ByVal y As Long) As Integer + TileFromPoint = ((y \ IRAD) * 3) + (x \ IRAD) + End Function + + Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) + + MyBase.OnMouseDown(e) + + If e.Button = MouseButtons.Left Then + If Not FInAnimation Then + FInAnimation = True + + Try + Dim aTile As TileData + Dim iTile As Integer = TileFromPoint(e.X, e.Y) + + aTile = oTiles(iTile) + aTile.ToggleFacing() + Catch oEX As Exception + Throw oEX + Finally + FInAnimation = False + End Try + + End If + End If + End Sub + + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + + 'happens in design mode + If bBack Is Nothing Then + Call SetupBackground() + End If + e.Graphics.DrawImageUnscaled(bBack, 0, 0) + End Sub + + Private Class TileData + + Private FPanel As NumberPanel + + 'don't need separate height/width, sprite is square + Private Const IRAD As Integer = 112 + + 'tiles are always drawn in the same place on the panel + Private FxPos, FyPos As Integer + Private FySrc As Integer + + Public Sub New(ByVal oPanel As NumberPanel, ByVal iTileNum As Integer) + MyBase.New() + + Dim iTilePos As Integer + + FPanel = oPanel + FTileNum = iTileNum + + iTilePos = iTileNum - 1 '0-8, one less than tile number + + 'coordinates to draw tile on panel is fixed + FxPos = (iTilePos Mod 3) * IRAD + FyPos = (iTilePos \ 3) * IRAD + + 'y coord in source bitmap fixed (see bitmap) + FySrc = iTilePos * IRAD + End Sub + + Private FTileNum As Integer + ReadOnly Property pTileNum() As Integer + Get + Return FTileNum + End Get + End Property + + Private FVisible As Boolean = True + Property pVisible() As Boolean + Get + Return FVisible + End Get + + Set(ByVal Value As Boolean) + FVisible = Value + Me.Draw() + End Set + End Property + + Private FBackwards As Boolean = False + + Property pBackwards() As Boolean + Get + Return FBackwards + End Get + Set(ByVal Value As Boolean) + FBackwards = Value + pFrame = IIf(Value, 9, 0) + End Set + End Property + + Private FFrame As Integer = 0 + Private Property pFrame() As Integer + Get + Return FFrame + End Get + Set(ByVal Value As Integer) + + If FFrame < 0 Or FFrame > 9 Then + Throw New Exception("Frame out of range") + End If + + FFrame = Value + + End Set + End Property + + Public Sub Reset() + pBackwards = False + pVisible = True + End Sub + + Private Sub Draw() + + Dim gr As Graphics + Dim r As System.Drawing.Rectangle + Dim xSrc As Integer + + Dim bDest As Bitmap = FPanel.bBack + + gr = Graphics.FromImage(bDest) + Try + If FVisible Then + xSrc = FFrame * IRAD + r = New System.Drawing.Rectangle(xSrc, FySrc, IRAD + 1, IRAD + 1) + gr.DrawImage(FPanel.fbNum, FxPos, FyPos, r, GraphicsUnit.Pixel) + Else + 'draw a black square + r = New System.Drawing.Rectangle(FxPos, FyPos, IRAD, IRAD) + gr.FillRectangle(New SolidBrush(Color.Black), r) + End If + Finally + gr.Dispose() + End Try + + End Sub + + 'animates backward or forward + Public Sub ToggleFacing() + + Dim iStart, iEnd As Integer + Dim iDir, iLoop As Integer + If Not FVisible Then Exit Sub + + If pBackwards Then + iStart = 9 + iEnd = 0 + iDir = -1 + Else + iStart = 0 + iEnd = 9 + iDir = 1 + End If + + FPanel.OnTileMoving(pBackwards) + For iLoop = iStart To iEnd Step iDir + pFrame = iLoop + Me.Draw() + FPanel.Invalidate() + Application.DoEvents() + Next + pBackwards = Not pBackwards + + End Sub + End Class + +End Class diff --git a/Files/NineTiles/bin/DicePanel.dll b/Files/NineTiles/bin/DicePanel.dll new file mode 100644 index 0000000..5e4a3c7 Binary files /dev/null and b/Files/NineTiles/bin/DicePanel.dll differ diff --git a/Files/NineTiles/bin/DicePanel.pdb b/Files/NineTiles/bin/DicePanel.pdb new file mode 100644 index 0000000..1712e0b Binary files /dev/null and b/Files/NineTiles/bin/DicePanel.pdb differ diff --git a/Files/NineTiles/bin/NineTiles.exe b/Files/NineTiles/bin/NineTiles.exe new file mode 100644 index 0000000..9c25d5e Binary files /dev/null and b/Files/NineTiles/bin/NineTiles.exe differ diff --git a/Files/NineTiles/bin/NineTiles.pdb b/Files/NineTiles/bin/NineTiles.pdb new file mode 100644 index 0000000..0e86fc3 Binary files /dev/null and b/Files/NineTiles/bin/NineTiles.pdb differ diff --git a/Files/NineTiles/fMain.resx b/Files/NineTiles/fMain.resx new file mode 100644 index 0000000..61e31e9 --- /dev/null +++ b/Files/NineTiles/fMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + True + + + False + + + Assembly + + + Assembly + + + 8, 8 + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + fMain + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/NineTiles/fMain.vb b/Files/NineTiles/fMain.vb new file mode 100644 index 0000000..5ee05b8 --- /dev/null +++ b/Files/NineTiles/fMain.vb @@ -0,0 +1,179 @@ +Public Class fMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents oDice As DicePanel.DicePanel.DicePanel + Friend WithEvents lbHelp As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.oDice = New DicePanel.DicePanel.DicePanel + Me.lbHelp = New System.Windows.Forms.Label + Me.SuspendLayout() + ' + 'oDice + ' + Me.oDice.BackColor = System.Drawing.Color.Black + Me.oDice.Dock = System.Windows.Forms.DockStyle.Bottom + Me.oDice.Location = New System.Drawing.Point(0, 362) + Me.oDice.Name = "oDice" + Me.oDice.Size = New System.Drawing.Size(334, 176) + Me.oDice.TabIndex = 0 + ' + 'lbHelp + ' + Me.lbHelp.Dock = System.Windows.Forms.DockStyle.Bottom + Me.lbHelp.Location = New System.Drawing.Point(0, 330) + Me.lbHelp.Name = "lbHelp" + Me.lbHelp.Size = New System.Drawing.Size(334, 32) + Me.lbHelp.TabIndex = 1 + Me.lbHelp.Text = "click on tiles until they equal the number on the dice, then right click to take " & _ + "away tiles" + Me.lbHelp.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'fMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(334, 538) + Me.Controls.Add(Me.lbHelp) + Me.Controls.Add(Me.oDice) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Name = "fMain" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "NineTiles" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private oNumPanel As NumberPanel + Private oRand As Random + Private oWav As WavLibrary + + Private Sub fMain_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + oNumPanel = New NumberPanel + oNumPanel.Dock = DockStyle.Top + AddHandler oNumPanel.MouseDown, AddressOf NumPanelMouseDown + AddHandler oNumPanel.TileMoving, AddressOf NumPanelTileMoving + Me.Controls.Add(oNumPanel) + + SetupWavLibrary() + oRand = New Random + + End Sub + + Private Sub SetupWavLibrary() + + oWav = New WavLibrary + oWav.LoadFromResource("NineTiles.die1.wav", "die1") + oWav.LoadFromResource("NineTiles.die2.wav", "die2") + oWav.LoadFromResource("NineTiles.squeak1.wav", "squeak1") + oWav.LoadFromResource("NineTiles.squeak2.wav", "squeak2") + oWav.LoadFromResource("NineTiles.thud.wav", "thud") + oWav.LoadFromResource("NineTiles.applause.wav", "applause") + oWav.LoadFromResource("NineTiles.laughs.wav", "laughs") + oWav.LoadFromResource("NineTiles.dischord.wav", "dischord") + + End Sub + + + Private Sub fMain_Activated(ByVal sender As Object, _ + ByVal e As System.EventArgs) Handles MyBase.Activated + + Static bDoneOnce As Boolean = False + + If Not bDoneOnce Then + bDoneOnce = True + StartGame() + End If + + End Sub + + Private Sub StartGame() + oNumPanel.ResetTiles() + oDice.RollDice() + End Sub + + Private Sub NumPanelMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) + + If oNumPanel.bInAnimation Then Exit Sub + + If e.Button = MouseButtons.Right Then + If oDice.Result = oNumPanel.Result Then + + lbHelp.Visible = False + + oNumPanel.HideBackward() + oWav.Play("thud", 400) + + If oNumPanel.TilesVisible = 0 Then + oWav.Play("applause", bSync:=True) + StartGame() + Else + oDice.RollDice() + If Not oNumPanel.ResultAvailable(oDice.Result) Then + oWav.Play("laughs", bSync:=True) + StartGame() + End If + End If + Else + oWav.Play("dischord") + End If + End If + + End Sub + + Private Sub NumPanelTileMoving(ByVal bMovingBackward As Boolean) + + Dim cWav As String + If bMovingBackward Then + cWav = "squeak1" + Else + cWav = "squeak2" + End If + oWav.Play(cWav) + + End Sub + + Private Sub oDice_DieBounced() Handles oDice.DieBounced + + Dim cWav As String + If oRand.Next(0, 1000) Mod 2 = 0 Then + cWav = "die1" + Else + cWav = "die2" + End If + oWav.Play(cWav) + + End Sub + +End Class diff --git a/Files/NineTiles/obj/Debug/NineTiles.exe b/Files/NineTiles/obj/Debug/NineTiles.exe new file mode 100644 index 0000000..9c25d5e Binary files /dev/null and b/Files/NineTiles/obj/Debug/NineTiles.exe differ diff --git a/Files/NineTiles/obj/Debug/NineTiles.fMain.resources b/Files/NineTiles/obj/Debug/NineTiles.fMain.resources new file mode 100644 index 0000000..c8bec58 Binary files /dev/null and b/Files/NineTiles/obj/Debug/NineTiles.fMain.resources differ diff --git a/Files/NineTiles/obj/Debug/NineTiles.pdb b/Files/NineTiles/obj/Debug/NineTiles.pdb new file mode 100644 index 0000000..0e86fc3 Binary files /dev/null and b/Files/NineTiles/obj/Debug/NineTiles.pdb differ diff --git a/Files/PCOpponent/AssemblyInfo.vb b/Files/PCOpponent/AssemblyInfo.vb new file mode 100644 index 0000000..3a66430 --- /dev/null +++ b/Files/PCOpponent/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/PCOpponent/PCOpponent.sln b/Files/PCOpponent/PCOpponent.sln new file mode 100644 index 0000000..4319056 --- /dev/null +++ b/Files/PCOpponent/PCOpponent.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "PCOpponent", "PCOpponent.vbproj", "{31E4CCED-4D9A-4B94-9725-C4D2C2E9E293}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {31E4CCED-4D9A-4B94-9725-C4D2C2E9E293}.Debug.ActiveCfg = Debug|.NET + {31E4CCED-4D9A-4B94-9725-C4D2C2E9E293}.Debug.Build.0 = Debug|.NET + {31E4CCED-4D9A-4B94-9725-C4D2C2E9E293}.Release.ActiveCfg = Release|.NET + {31E4CCED-4D9A-4B94-9725-C4D2C2E9E293}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/PCOpponent/PCOpponent.suo b/Files/PCOpponent/PCOpponent.suo new file mode 100644 index 0000000..740d0db Binary files /dev/null and b/Files/PCOpponent/PCOpponent.suo differ diff --git a/Files/PCOpponent/PCOpponent.vb b/Files/PCOpponent/PCOpponent.vb new file mode 100644 index 0000000..ac3cccc --- /dev/null +++ b/Files/PCOpponent/PCOpponent.vb @@ -0,0 +1,28 @@ + +Public Interface IPCOpponentGamePiece + + Property Value() As Integer + Property Location() As Point + Property Size() As Size + Function MouseIn(ByVal x As Integer, ByVal y As Integer) As Boolean + Sub Draw(ByVal g As Graphics) + +End Interface + +Public Interface IPCOpponentGame + + Property pForm() As Form + + Event BadMove() + Event PlayerWon() + Event ComputerWon() + Event NobodyWon() + Event CurrentScore(ByVal iPlayer As Integer, ByVal iComputer As Integer) + + Sub StartGame() + Sub DrawBoard(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) + Sub OnMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) + Sub MakeMove() + +End Interface + diff --git a/Files/PCOpponent/PCOpponent.vbproj b/Files/PCOpponent/PCOpponent.vbproj new file mode 100644 index 0000000..9240198 --- /dev/null +++ b/Files/PCOpponent/PCOpponent.vbproj @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/PCOpponent/PCOpponent.vbproj.user b/Files/PCOpponent/PCOpponent.vbproj.user new file mode 100644 index 0000000..2864829 --- /dev/null +++ b/Files/PCOpponent/PCOpponent.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/PCOpponent/Reversi.vb b/Files/PCOpponent/Reversi.vb new file mode 100644 index 0000000..145bb50 --- /dev/null +++ b/Files/PCOpponent/Reversi.vb @@ -0,0 +1,494 @@ +Imports System.Drawing.Drawing2D + + +Public Class ReversiPiece + Implements IPCOpponentGamePiece + + Public Sub Draw(ByVal g As System.Drawing.Graphics) Implements IPCOpponentGamePiece.Draw + + Dim r As New Rectangle(Location, Size) + Dim p As New PointF(Location.X, Location.Y) + Dim b As Brush + + r.Inflate(-2, -2) + + Select Case Value + Case 0 + b = New LinearGradientBrush(r, Color.White, Color.DarkGray, LinearGradientMode.Vertical) + Case -1 + b = Brushes.Blue + Case 1 + b = Brushes.Red + End Select + + g.FillRectangle(b, r) + g.DrawRectangle(Pens.White, r) + + End Sub + + Private FLocation As Point + Public Property Location() As System.Drawing.Point Implements IPCOpponentGamePiece.Location + Get + Return FLocation + End Get + Set(ByVal Value As System.Drawing.Point) + FLocation = Value + End Set + End Property + + Private FSize As Size + Public Property Size() As System.Drawing.Size Implements IPCOpponentGamePiece.Size + Get + Return FSize + End Get + Set(ByVal Value As System.Drawing.Size) + FSize = Value + End Set + End Property + + Public Function MouseIn(ByVal x As Integer, _ + ByVal y As Integer) As Boolean Implements IPCOpponentGamePiece.MouseIn + + Dim r As New Rectangle(Location, Size) + Return r.Contains(x, y) + + End Function + + Private FValue As Integer + Public Property Value() As Integer Implements IPCOpponentGamePiece.Value + Get + Return FValue + End Get + Set(ByVal i As Integer) + If i < -1 Or i > 1 Then + Throw New Exception("Invalid Piece Value") + Else + FValue = i + End If + End Set + End Property + + ReadOnly Property xElt() As Integer + Get + Return Location.X \ Size.Width + End Get + End Property + + ReadOnly Property yElt() As Integer + Get + Return Location.Y \ Size.Height + End Get + End Property + + Private FSaveValue As Integer + + 'store prior value + Public Sub PushValue() + FSaveValue = Value + End Sub + + Public Sub PopValue() + Value = FSaveValue + End Sub + + Public Function IsEdge() As Boolean + Return xElt = 0 OrElse yElt = 0 OrElse xElt = 7 OrElse yElt = 7 + End Function + + Public Function IsCorner() As Boolean + + Return (xElt = 0 And yElt = 0) OrElse _ + (xElt = 0 And yElt = 7) OrElse _ + (xElt = 7 And yElt = 0) OrElse _ + (xElt = 7 And yElt = 7) + + End Function +End Class + +Public Class ReversiGame + Implements IPCOpponentGame + + Private aPieces(7, 7) As ReversiPiece + Private FPlayer, FComputer As Integer + + Public Event NobodyWon() Implements IPCOpponentGame.NobodyWon + Public Event PlayerWon() Implements IPCOpponentGame.PlayerWon + Public Event BadMove() Implements IPCOpponentGame.BadMove + Public Event ComputerWon() Implements IPCOpponentGame.ComputerWon + Public Event CurrentScore(ByVal iPlayer As Integer, ByVal iComputer As Integer) _ + Implements IPCOpponentGame.CurrentScore + + Public Sub New(ByVal f As System.Windows.Forms.Form) + MyBase.New() + pForm = f + End Sub + + Public Sub DrawBoard(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) Implements IPCOpponentGame.DrawBoard + + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias + e.Graphics.FillRectangle(Brushes.Black, pForm.ClientRectangle) + + Dim aP As ReversiPiece + + For Each aP In aPieces + aP.Draw(e.Graphics) + Next + + End Sub + + Private Function HasComputerWon() As Boolean + + If (FComputer + FPlayer) = 64 Then + Return FComputer > FPlayer + ElseIf FPlayer = 0 Then + Return True + ElseIf PlayerCantMoveAnywhere(-1) And PlayerCantMoveAnywhere(1) Then + Return FComputer > FPlayer + End If + End Function + + Private Function HasPlayerWon() As Boolean + + If (FComputer + FPlayer) = 64 Then + Return FComputer < FPlayer + ElseIf FComputer = 0 Then + Return True + ElseIf PlayerCantMoveAnywhere(-1) And PlayerCantMoveAnywhere(1) Then + Return FComputer < FPlayer + End If + + End Function + + Private Function PlayerCantMoveAnywhere(ByVal Player As Integer) As Boolean + Dim aP As ReversiPiece + + For Each aP In aPieces + If aP.Value = 0 Then + If CanMoveHere(aP, Player) Then + Return False + End If + End If + Next + + Return True + End Function + + Public Sub MakeMove() Implements IPCOpponentGame.MakeMove + + Dim aP As ReversiPiece + + Dim iScore As Integer + Dim iHigh As Integer = -1 + Dim aPHigh As ReversiPiece + + PushBoard() + + For Each aP In aPieces + If aP.Value = 0 Then + If CanMoveHere(aP, -1) Then + MoveHere(aP, -1) + iScore = BoardScore(-1) + If iScore > iHigh Then + iHigh = iScore + aPHigh = aP + End If + PopBoard() + End If + End If + Next + + If iHigh > 1 Then + MoveHere(aPHigh, -1) + pForm.Invalidate() + Else + MsgBox("computer has to pass") + End If + End Sub + + Private Function BoardScore(ByVal Player As Integer) As Integer + + Dim aP As ReversiPiece + Dim r As Integer + + For Each aP In aPieces + If aP.Value = Player Then + If aP.IsCorner Then + r += 20 + ElseIf aP.IsEdge Then + r += 5 + Else + r += 1 + End If + End If + Next + Return r + + End Function + + Private Function CanMoveOnThisLine(ByVal aP As ReversiPiece, _ + ByVal Player As Integer, ByVal iX As Integer, ByVal iY As Integer) As Boolean + + Dim x, y As Integer + Dim bDone As Boolean + Dim bFound As Boolean = False + + 'travel 1 piece away in the proper direction + x = aP.xElt + iX + y = aP.yElt + iY + + 'if off board, exit + If x < 0 Or x > 7 Then Exit Function + If y < 0 Or y > 7 Then Exit Function + + 'make sure piece one away is opposite color + If aPieces(x, y).Value <> -Player Then Exit Function + + 'now, start looping. Looking for one of our pieces before the edge of the board or a blank + x += iX + y += iY + bDone = (x < 0 Or x > 7 Or y < 0 Or y > 7) + Do While Not (bDone Or bFound) + If aPieces(x, y).Value = Player Then + bFound = True + ElseIf aPieces(x, y).Value = 0 Then + bDone = True + Else + x += iX + y += iY + bDone = (x < 0 Or x > 7 Or y < 0 Or y > 7) + End If + Loop + + Return bFound + End Function + + Private Function CanMoveHere(ByVal aP As ReversiPiece, ByVal Player As Integer) As Boolean + + Dim x, y As Integer + + For x = -1 To 1 + For y = -1 To 1 + If Not (x = 0 And y = 0) Then + If CanMoveOnThisLine(aP, Player, x, y) Then Return True + End If + Next + Next + + Return False + + End Function + + Private Sub MoveHere(ByVal aP As ReversiPiece, ByVal Player As Integer) + + Dim x, y As Integer + + aP.Value = Player + + For x = -1 To 1 + For y = -1 To 1 + If Not (x = 0 And y = 0) Then + If CanMoveOnThisLine(aP, Player, x, y) Then + MoveGuysOnThisLine(aP, Player, x, y) + End If + End If + Next + Next + + Call CalcScores() + + End Sub + + Private Sub CalcScores() + + + Dim aP As ReversiPiece + + FComputer = 0 + FPlayer = 0 + For Each aP In aPieces + Select Case aP.Value + Case 1 + FPlayer += 1 + Case -1 + FComputer += 1 + End Select + Next + + RaiseEvent CurrentScore(FPlayer, FComputer) + + End Sub + Private Sub MoveGuysOnThisLine(ByVal aP As ReversiPiece, _ + ByVal Player As Integer, ByVal iX As Integer, ByVal iY As Integer) + + Dim x, y As Integer + Dim bDone As Boolean + + 'travel 1 piece away in the proper direction + 'don't have to check that piece is right color or off board, already determined + x = aP.xElt + iX + y = aP.yElt + iY + + bDone = False + Do While Not bDone + If aPieces(x, y).Value = Player Then + bDone = True + ElseIf aPieces(x, y).Value = 0 Then + bDone = True + Else + aPieces(x, y).Value = Player + x += iX + y += iY + bDone = (x < 0 Or x > 7 Or y < 0 Or y > 7) + End If + Loop + + End Sub + + Public Sub OnMouseDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.MouseEventArgs) Implements IPCOpponentGame.onMouseDown + + Dim aP As ReversiPiece + Dim bDone As Boolean + + Try + 'don't let him click again + RemoveHandler FForm.MouseDown, AddressOf OnMouseDown + + For Each aP In aPieces + If aP.MouseIn(e.X, e.Y) Then + + If aP.Value = 0 Then + + If CanMoveHere(aP, 1) Then + MoveHere(aP, 1) + pForm.Invalidate() + + FForm.Cursor = Cursors.WaitCursor + Application.DoEvents() + System.Threading.Thread.Sleep(1000) + FForm.Cursor = Cursors.Default + Else + RaiseEvent BadMove() + Exit For + End If + + If HasPlayerWon() Then + RaiseEvent PlayerWon() + Exit For + ElseIf HasComputerWon() Then + RaiseEvent ComputerWon() + Exit For + Else + If FPlayer + FComputer = 64 Then + RaiseEvent NobodyWon() + Exit For + Else + + Do + MakeMove() + pForm.Invalidate() + + If HasComputerWon() Then + RaiseEvent ComputerWon() + Exit For + ElseIf HasPlayerWon() Then + RaiseEvent PlayerWon() + Exit For + ElseIf FPlayer + FComputer = 64 Then + RaiseEvent NobodyWon() + Exit For + End If + + If PlayerCantMoveAnywhere(1) Then + MsgBox("you have to pass") + Else + bdone = True + End If + Loop Until bDone + + Exit For + + End If + + End If + + Else + RaiseEvent BadMove() + Exit For + End If + End If + Next + + Finally + AddHandler FForm.MouseDown, AddressOf OnMouseDown + End Try + + End Sub + + Private FForm As System.Windows.Forms.Form + Public Property pForm() As System.Windows.Forms.Form Implements IPCOpponentGame.pForm + Get + Return FForm + End Get + Set(ByVal Value As System.Windows.Forms.Form) + FForm = Value + AddHandler FForm.Paint, AddressOf DrawBoard + AddHandler FForm.MouseDown, AddressOf OnMouseDown + + FForm.Width = 268 + FForm.Height = 328 + FForm.Height = (32 * 8) + SystemInformation.MenuHeight + SystemInformation.CaptionHeight + 34 + + End Set + End Property + + + Public Sub StartGame() Implements IPCOpponentGame.StartGame + + Dim x, y As Integer + + For x = 0 To 7 + For y = 0 To 7 + + aPieces(x, y) = New ReversiPiece + With aPieces(x, y) + .Location = New Point(x * 32, y * 32) + .Size = New Size(32, 32) + + Select Case (y * 8) + x + Case 27, 36 + .Value = 1 + Case 28, 35 + .Value = -1 + Case Else + .Value = 0 + End Select + End With + Next + Next + + Call CalcScores() + + End Sub + + Private Sub PushBoard() + + Dim aP As ReversiPiece + + For Each aP In aPieces + aP.PushValue() + Next + + End Sub + + Private Sub PopBoard() + + Dim aP As ReversiPiece + + For Each aP In aPieces + aP.PopValue() + Next + + End Sub +End Class \ No newline at end of file diff --git a/Files/PCOpponent/TicTacToe.vb b/Files/PCOpponent/TicTacToe.vb new file mode 100644 index 0000000..2163b21 --- /dev/null +++ b/Files/PCOpponent/TicTacToe.vb @@ -0,0 +1,316 @@ +Imports System.Drawing.Drawing2D + +Public Class TicTacToePiece + Implements IPCOpponentGamePiece + + Public Sub Draw(ByVal g As System.Drawing.Graphics) _ + Implements IPCOpponentGamePiece.Draw + + Dim r As New Rectangle(Location, Size) + Dim p As New PointF(Location.X, Location.Y) + Dim f As New Font("Tahoma", 36, FontStyle.Bold) + + r.Inflate(-2, -2) + g.DrawRectangle(Pens.White, r) + + p.X += 28 + p.Y += 20 + + Select Case Value + Case -1 + g.DrawString("O", f, Brushes.Blue, p) + Case 1 + g.DrawString("X", f, Brushes.Red, p) + Case Else + Exit Sub + End Select + + End Sub + + Private FLocation As Point + Public Property Location() As System.Drawing.Point _ + Implements IPCOpponentGamePiece.Location + + Get + Return FLocation + End Get + Set(ByVal Value As System.Drawing.Point) + FLocation = Value + End Set + End Property + + Private FSize As Size + Public Property Size() As System.Drawing.Size _ + Implements IPCOpponentGamePiece.Size + + Get + Return FSize + End Get + Set(ByVal Value As System.Drawing.Size) + FSize = Value + End Set + End Property + + Public Function MouseIn(ByVal x As Integer, _ + ByVal y As Integer) As Boolean _ + Implements IPCOpponentGamePiece.MouseIn + + Dim r As New Rectangle(Location, Size) + Return r.Contains(x, y) + + End Function + + Private FValue As Integer + Public Property Value() As Integer _ + Implements IPCOpponentGamePiece.Value + + Get + Return FValue + End Get + Set(ByVal i As Integer) + If i < -1 Or i > 1 Then + Throw New Exception("Invalid Piece Value") + Else + FValue = i + End If + End Set + End Property +End Class + +Public Class TicTacToeGame + Implements IPCOpponentGame + + Const WID As Integer = 104 + + Private aPieces As ArrayList + Private FComputerWon As Integer + Private FPlayerWon As Integer + + Public Event BadMove() Implements IPCOpponentGame.BadMove + Public Event PlayerWon() Implements IPCOpponentGame.PlayerWon + Public Event ComputerWon() Implements IPCOpponentGame.ComputerWon + Public Event NobodyWon() Implements IPCOpponentGame.NobodyWon + Public Event CurrentScore(ByVal iPlayer As Integer, _ + ByVal iComputer As Integer) _ + Implements IPCOpponentGame.CurrentScore + + Public Sub New(ByVal f As System.Windows.Forms.Form) + MyBase.New() + pForm = f + End Sub + + Public Sub DrawBoard(ByVal sender As Object, _ + ByVal e As System.windows.forms.PaintEventArgs) _ + Implements IPCOpponentGame.DrawBoard + + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias + e.Graphics.FillRectangle(Brushes.Black, pForm.ClientRectangle) + + Dim aP As TicTacToePiece + + For Each aP In aPieces + aP.Draw(e.Graphics) + Next + + End Sub + + + Public Sub OnMouseDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.MouseEventArgs) _ + Implements IPCOpponentGame.OnMouseDown + + Dim aP As TicTacToePiece + + Try + 'don't let him click again + RemoveHandler fForm.MouseDown, AddressOf OnMouseDown + + For Each aP In aPieces + If aP.MouseIn(e.X, e.Y) Then + + If aP.Value = 0 Then + + aP.Value = 1 + pForm.Invalidate() + + If HasPlayerWon() Then + FPlayerWon += 1 + RaiseEvent PlayerWon() + RaiseEvent CurrentScore(FPlayerWon, FComputerWon) + Exit For + Else + If EmptySpots() = 0 Then + RaiseEvent NobodyWon() + RaiseEvent CurrentScore(FPlayerWon, FComputerWon) + Exit For + Else + + MakeMove() + pForm.Invalidate() + If HasComputerWon() Then + FComputerWon += 1 + RaiseEvent ComputerWon() + RaiseEvent CurrentScore(FPlayerWon, FComputerWon) + End If + Exit For + End If + End If + + Else + RaiseEvent BadMove() + Exit For + End If + + End If + Next + + Finally + AddHandler fForm.MouseDown, AddressOf OnMouseDown + End Try + + End Sub + + Private Function HasPlayerWon() As Boolean + Return RowScoreExists(3) + End Function + + Private Function HasComputerWon() As Boolean + Return RowScoreExists(-3) + End Function + + Private Function EmptySpots() As Integer + + Dim aP As TicTacToePiece + Dim r As Integer = 0 + + For Each aP In aPieces + If aP.Value = 0 Then + r += 1 + End If + Next + + Return r + End Function + + 'short circut eval + Public Function RowScoreExists(ByVal iScore) As Boolean + + Return RowScore(0, 1, 2) = iScore OrElse _ + RowScore(3, 4, 5) = iScore OrElse _ + RowScore(6, 7, 8) = iScore OrElse _ + RowScore(0, 3, 6) = iScore OrElse _ + RowScore(1, 4, 7) = iScore OrElse _ + RowScore(2, 5, 8) = iScore OrElse _ + RowScore(0, 4, 8) = iScore OrElse _ + RowScore(2, 4, 6) = iScore + + End Function + + Public Sub MakeMove() Implements IPCOpponentGame.MakeMove + + Dim i As Integer + Dim aP As TicTacToePiece + + 'try every blank spot with me. See if I would win there + For Each aP In aPieces + If aP.Value = 0 Then + aP.Value = -1 + If HasComputerWon() Then 'i win + Exit Sub + End If + aP.Value = 0 + End If + Next + + 'try every blank spot with him. See if HE would win there + For Each aP In aPieces + If aP.Value = 0 Then + aP.Value = 1 + If HasPlayerWon() Then 'player would win here. move there + aP.Value = -1 + Exit Sub + End If + aP.Value = 0 + End If + Next + + 'try every blank spot with him. See if he would win there in 2 moves + 'try the center first (spot 4), though + + For i = 4 To aPieces.Count - 1 + aP = aPieces.Item(i) + If aP.Value = 0 Then + aP.Value = 1 + If RowScoreExists(2) Then 'player wins in 2 moves. move there + aP.Value = -1 + Exit Sub + End If + aP.Value = 0 + End If + Next + + For i = 0 To 3 + aP = aPieces.Item(i) + If aP.Value = 0 Then + aP.Value = 1 + If RowScoreExists(2) Then 'player wins in 2 moves. move there + aP.Value = -1 + Exit Sub + End If + aP.Value = 0 + End If + Next + + Debug.Assert(False, "Beep") + + End Sub + + Private Function RowScore(ByVal i As Integer, _ + ByVal j As Integer, ByVal k As Integer) As Integer + + Dim aPi, aPj, aPk As TicTacToePiece + + aPi = aPieces.Item(i) + aPj = aPieces.Item(j) + aPk = aPieces.Item(k) + + Return aPi.Value + aPj.Value + aPk.Value + End Function + + Public Sub StartGame() Implements IPCOpponentGame.StartGame + + Dim i As Integer + Dim aP As TicTacToePiece + + aPieces = New ArrayList + + For i = 0 To 8 + aP = New TicTacToePiece + aP.Location = New Point((i Mod 3) * WID, (i \ 3) * WID) + aP.Size = New Size(WID, WID) + aP.Value = 0 + aPieces.Add(aP) + Next + + End Sub + + Private fForm As Form + Property pForm() As Form _ + Implements IPCOpponentGame.pForm + + Get + Return fForm + End Get + Set(ByVal Value As Form) + + fForm = Value + fForm.Width = 324 + fForm.Height = (WID * 3) + SystemInformation.MenuHeight + SystemInformation.CaptionHeight + 34 + AddHandler fForm.Paint, AddressOf DrawBoard + AddHandler fForm.MouseDown, AddressOf OnMouseDown + + End Set + End Property + + +End Class \ No newline at end of file diff --git a/Files/PCOpponent/bin/PCOpponent.exe b/Files/PCOpponent/bin/PCOpponent.exe new file mode 100644 index 0000000..53f2a37 Binary files /dev/null and b/Files/PCOpponent/bin/PCOpponent.exe differ diff --git a/Files/PCOpponent/bin/PCOpponent.pdb b/Files/PCOpponent/bin/PCOpponent.pdb new file mode 100644 index 0000000..fb4dd3b Binary files /dev/null and b/Files/PCOpponent/bin/PCOpponent.pdb differ diff --git a/Files/PCOpponent/fMain.resx b/Files/PCOpponent/fMain.resx new file mode 100644 index 0000000..f878f0d --- /dev/null +++ b/Files/PCOpponent/fMain.resx @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + fMain + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/PCOpponent/fMain.vb b/Files/PCOpponent/fMain.vb new file mode 100644 index 0000000..6eb0d04 --- /dev/null +++ b/Files/PCOpponent/fMain.vb @@ -0,0 +1,206 @@ +Imports System.Reflection + +Public Class fMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents oMenu As System.Windows.Forms.MainMenu + Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem + Friend WithEvents mNew As System.Windows.Forms.MenuItem + Friend WithEvents mTic As System.Windows.Forms.MenuItem + Friend WithEvents mReversi As System.Windows.Forms.MenuItem + Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem + Friend WithEvents mExit As System.Windows.Forms.MenuItem + Friend WithEvents sbMain As System.Windows.Forms.StatusBar + Friend WithEvents sb1 As System.Windows.Forms.StatusBarPanel + Friend WithEvents sb2 As System.Windows.Forms.StatusBarPanel + Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem + Private Sub InitializeComponent() + Me.oMenu = New System.Windows.Forms.MainMenu + Me.MenuItem1 = New System.Windows.Forms.MenuItem + Me.mNew = New System.Windows.Forms.MenuItem + Me.mTic = New System.Windows.Forms.MenuItem + Me.mReversi = New System.Windows.Forms.MenuItem + Me.MenuItem6 = New System.Windows.Forms.MenuItem + Me.mExit = New System.Windows.Forms.MenuItem + Me.MenuItem2 = New System.Windows.Forms.MenuItem + Me.sbMain = New System.Windows.Forms.StatusBar + Me.sb1 = New System.Windows.Forms.StatusBarPanel + Me.sb2 = New System.Windows.Forms.StatusBarPanel + CType(Me.sb1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.sb2, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'oMenu + ' + Me.oMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem2}) + ' + 'MenuItem1 + ' + Me.MenuItem1.Index = 0 + Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mNew, Me.MenuItem6, Me.mExit}) + Me.MenuItem1.Text = "&File" + ' + 'mNew + ' + Me.mNew.Index = 0 + Me.mNew.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mTic, Me.mReversi}) + Me.mNew.Text = "&New" + ' + 'mTic + ' + Me.mTic.Index = 0 + Me.mTic.Text = "Tic Tac Toe" + ' + 'mReversi + ' + Me.mReversi.Index = 1 + Me.mReversi.Text = "Reversi" + ' + 'MenuItem6 + ' + Me.MenuItem6.Index = 1 + Me.MenuItem6.Text = "-" + ' + 'mExit + ' + Me.mExit.Index = 2 + Me.mExit.Text = "E&xit" + ' + 'MenuItem2 + ' + Me.MenuItem2.Index = 1 + Me.MenuItem2.Text = "" + ' + 'sbMain + ' + Me.sbMain.Location = New System.Drawing.Point(0, 251) + Me.sbMain.Name = "sbMain" + Me.sbMain.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.sb1, Me.sb2}) + Me.sbMain.ShowPanels = True + Me.sbMain.Size = New System.Drawing.Size(292, 22) + Me.sbMain.SizingGrip = False + Me.sbMain.TabIndex = 0 + ' + 'sb1 + ' + Me.sb1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring + Me.sb1.Width = 228 + ' + 'sb2 + ' + Me.sb2.Width = 64 + ' + 'fMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.BackColor = System.Drawing.Color.Black + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.Controls.Add(Me.sbMain) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Menu = Me.oMenu + Me.Name = "fMain" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "PC Opponents" + CType(Me.sb1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.sb2, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private aGame As IPCOpponentGame + + Private Sub mTic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mTic.Click + aGame = New TicTacToeGame(Me) + SetupGame() + End Sub + Private Sub SetupGame() + + With aGame + AddHandler .PlayerWon, AddressOf PlayerWon + AddHandler .ComputerWon, AddressOf ComputerWon + AddHandler .NobodyWon, AddressOf NobodyWon + AddHandler .BadMove, AddressOf BadMove + AddHandler .CurrentScore, AddressOf UpdateScores + + .StartGame() + End With + Me.Invalidate() + + End Sub + + Private Sub PlayerWon() + AskToPlayAgain("You Win") + End Sub + + Private Sub ComputerWon() + AskToPlayAgain("I Win") + End Sub + + Private Sub NobodyWon() + AskToPlayAgain("It's a Draw") + End Sub + + Private Sub AskToPlayAgain(ByVal cMsg As String) + + If MsgBox(cMsg & ", Play Again?", _ + MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Continue") = MsgBoxResult.Yes Then + + aGame.StartGame() + Me.Invalidate() + + Else + Me.Close() + End If + + End Sub + + Private Sub BadMove() + MsgBox("Can't move there", MsgBoxStyle.Critical Or MsgBoxStyle.OKOnly, "Error") + End Sub + + Private Sub UpdateScores(ByVal iPlayer As Integer, ByVal iComputer As Integer) + sb1.Text = "Player: " & iPlayer & ", PC:" & iComputer + End Sub + + Private Sub mReversi_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles mReversi.Click + + aGame = New ReversiGame(Me) + SetupGame() + End Sub + + Private Sub mExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mExit.Click + Me.Close() + End Sub +End Class diff --git a/Files/PCOpponent/obj/Debug/PCOpponent.exe b/Files/PCOpponent/obj/Debug/PCOpponent.exe new file mode 100644 index 0000000..53f2a37 Binary files /dev/null and b/Files/PCOpponent/obj/Debug/PCOpponent.exe differ diff --git a/Files/PCOpponent/obj/Debug/PCOpponent.fMain.resources b/Files/PCOpponent/obj/Debug/PCOpponent.fMain.resources new file mode 100644 index 0000000..28b3a1e Binary files /dev/null and b/Files/PCOpponent/obj/Debug/PCOpponent.fMain.resources differ diff --git a/Files/PCOpponent/obj/Debug/PCOpponent.pdb b/Files/PCOpponent/obj/Debug/PCOpponent.pdb new file mode 100644 index 0000000..fb4dd3b Binary files /dev/null and b/Files/PCOpponent/obj/Debug/PCOpponent.pdb differ diff --git a/Files/PolymorphismExample/AssemblyInfo.vb b/Files/PolymorphismExample/AssemblyInfo.vb new file mode 100644 index 0000000..20a4d8f --- /dev/null +++ b/Files/PolymorphismExample/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/PolymorphismExample/Form1.resx b/Files/PolymorphismExample/Form1.resx new file mode 100644 index 0000000..17025ef --- /dev/null +++ b/Files/PolymorphismExample/Form1.resx @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Files/PolymorphismExample/Form1.vb b/Files/PolymorphismExample/Form1.vb new file mode 100644 index 0000000..e904dbe --- /dev/null +++ b/Files/PolymorphismExample/Form1.vb @@ -0,0 +1,105 @@ +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Button1 As System.Windows.Forms.Button + Friend WithEvents TextBox1 As System.Windows.Forms.TextBox + Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox + Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label + Me.Button1 = New System.Windows.Forms.Button + Me.TextBox1 = New System.Windows.Forms.TextBox + Me.CheckBox1 = New System.Windows.Forms.CheckBox + Me.RadioButton1 = New System.Windows.Forms.RadioButton + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(32, 64) + Me.Label1.Name = "Label1" + Me.Label1.TabIndex = 0 + Me.Label1.Text = "Label1" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(32, 24) + Me.Button1.Name = "Button1" + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Button1" + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(32, 112) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.TabIndex = 2 + Me.TextBox1.Text = "TextBox1" + ' + 'CheckBox1 + ' + Me.CheckBox1.Location = New System.Drawing.Point(32, 144) + Me.CheckBox1.Name = "CheckBox1" + Me.CheckBox1.TabIndex = 3 + Me.CheckBox1.Text = "CheckBox1" + ' + 'RadioButton1 + ' + Me.RadioButton1.Location = New System.Drawing.Point(32, 176) + Me.RadioButton1.Name = "RadioButton1" + Me.RadioButton1.TabIndex = 4 + Me.RadioButton1.Text = "RadioButton1" + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.Controls.Add(Me.RadioButton1) + Me.Controls.Add(Me.CheckBox1) + Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.Label1) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Form1" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub SomethingClick(ByVal sender As Object, _ + ByVal e As System.EventArgs) Handles RadioButton1.Click, _ + Button1.Click, CheckBox1.Click, Label1.Click, TextBox1.Click + + Debug.WriteLine(sender.ToString) + End Sub +End Class diff --git a/Files/PolymorphismExample/PolymorphismExample.sln b/Files/PolymorphismExample/PolymorphismExample.sln new file mode 100644 index 0000000..0213bfb --- /dev/null +++ b/Files/PolymorphismExample/PolymorphismExample.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "PolymorphismExample", "PolymorphismExample.vbproj", "{3703A8EF-87DD-490D-A9D2-744EBF46F18E}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {3703A8EF-87DD-490D-A9D2-744EBF46F18E}.Debug.ActiveCfg = Debug|.NET + {3703A8EF-87DD-490D-A9D2-744EBF46F18E}.Debug.Build.0 = Debug|.NET + {3703A8EF-87DD-490D-A9D2-744EBF46F18E}.Release.ActiveCfg = Release|.NET + {3703A8EF-87DD-490D-A9D2-744EBF46F18E}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/PolymorphismExample/PolymorphismExample.suo b/Files/PolymorphismExample/PolymorphismExample.suo new file mode 100644 index 0000000..e5ba6f2 Binary files /dev/null and b/Files/PolymorphismExample/PolymorphismExample.suo differ diff --git a/Files/PolymorphismExample/PolymorphismExample.vbproj b/Files/PolymorphismExample/PolymorphismExample.vbproj new file mode 100644 index 0000000..55ed957 --- /dev/null +++ b/Files/PolymorphismExample/PolymorphismExample.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/PolymorphismExample/PolymorphismExample.vbproj.user b/Files/PolymorphismExample/PolymorphismExample.vbproj.user new file mode 100644 index 0000000..8f26536 --- /dev/null +++ b/Files/PolymorphismExample/PolymorphismExample.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/PolymorphismExample/bin/PolymorphismExample.exe b/Files/PolymorphismExample/bin/PolymorphismExample.exe new file mode 100644 index 0000000..f0c1dec Binary files /dev/null and b/Files/PolymorphismExample/bin/PolymorphismExample.exe differ diff --git a/Files/PolymorphismExample/bin/PolymorphismExample.pdb b/Files/PolymorphismExample/bin/PolymorphismExample.pdb new file mode 100644 index 0000000..2858b8d Binary files /dev/null and b/Files/PolymorphismExample/bin/PolymorphismExample.pdb differ diff --git a/Files/PolymorphismExample/obj/Debug/PolymorphismExample.Form1.resources b/Files/PolymorphismExample/obj/Debug/PolymorphismExample.Form1.resources new file mode 100644 index 0000000..96a24a8 Binary files /dev/null and b/Files/PolymorphismExample/obj/Debug/PolymorphismExample.Form1.resources differ diff --git a/Files/PolymorphismExample/obj/Debug/PolymorphismExample.exe b/Files/PolymorphismExample/obj/Debug/PolymorphismExample.exe new file mode 100644 index 0000000..f0c1dec Binary files /dev/null and b/Files/PolymorphismExample/obj/Debug/PolymorphismExample.exe differ diff --git a/Files/PolymorphismExample/obj/Debug/PolymorphismExample.pdb b/Files/PolymorphismExample/obj/Debug/PolymorphismExample.pdb new file mode 100644 index 0000000..2858b8d Binary files /dev/null and b/Files/PolymorphismExample/obj/Debug/PolymorphismExample.pdb differ diff --git a/Files/Reference.txt b/Files/Reference.txt new file mode 100644 index 0000000..5f5d4d1 --- /dev/null +++ b/Files/Reference.txt @@ -0,0 +1,26 @@ +Art graphics/sounds used througout the book +BMPStitch Appendix +CellularAutomata Ch. 5 +CellularAutomataWithSave Chapter 9 +Common modules/classes used by multiple projects +DicePanel Ch. 2 +DicePanelNew bonus, used by Yhatzee game +DirectXDemo Ch. 8 +FirstApplication Appendix A +GarbageDemoOne Chapter 9 +GarbageDemoTwo Chapter 9 +GuessTheDieRoll Ch. 1 +GuessTheDieRoll2 Ch. 2 +GuessTheDieRoll3 Ch. 2 +InterfaceExample Ch. 6 +NetReversi Ch. 7 +NineTiles Ch. 3 +PCOpponent Ch. 6 +PolymorphismExample Ch. 5 +ShapeTileGames Ch. 4 +SpaceRocks Ch. 7 +ThreadParametersOne Chapter 9 +ThreadParametersThree Chapter 9 +ThreadParametersTwo (broken) Chapter 9 +Yhatzee bonus game. + diff --git a/Files/ShapeTileGames/AssemblyInfo.vb b/Files/ShapeTileGames/AssemblyInfo.vb new file mode 100644 index 0000000..e17d82c --- /dev/null +++ b/Files/ShapeTileGames/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/ShapeTileGames/DeductileReasoning.vb b/Files/ShapeTileGames/DeductileReasoning.vb new file mode 100644 index 0000000..0c7dfd3 --- /dev/null +++ b/Files/ShapeTileGames/DeductileReasoning.vb @@ -0,0 +1,881 @@ +Imports ShapeTileGames.NewTile + +Namespace DeductileReasoning + + Public Class PuzzleGenerator + + Private oPL As TileComboPossiblesList + Private FClueClassNames As ArrayList + Private FClues As ArrayList + Private FAsm As Reflection.Assembly + + Public Sub New() + MyBase.New() + + oPL = New TileComboPossiblesList + GetClueClasses() + GenerateClues() + End Sub + + 'use reflection to find all the clue subclasses and load them up + Private Sub GetClueClasses() + + FAsm = System.Reflection.Assembly.GetExecutingAssembly() + Dim t As Type + + FClueClassNames = New ArrayList + + 'GetType used when not instantiating (can't instantiate b/c of MustInherit) + Dim tParent As Type = GetType(TileComboClue) + + For Each t In FAsm.GetTypes + If t.IsSubclassOf(tParent) Then + FClueClassNames.Add(t) + End If + Next + + End Sub + + Private Sub GenerateClues() + + Dim c As TileComboClue + Dim oTyp As Type + + Dim oRand As New Random + Dim oArgs() As Object = {oPL.Solution} + + Debug.WriteLine("-------------------------------------------") + Debug.WriteLine(oPL.Solution.ToString) + Debug.WriteLine("-------------------------------------------") + + FClues = New ArrayList + Do + oTyp = FClueClassNames.Item(oRand.Next(0, FClueClassNames.Count)) + c = Activator.CreateInstance(oTyp, oArgs) + If oPL.NumberClueWouldEliminate(c) > 0 Then + oPL.EliminateBasedOnClue(c) + FClues.Add(c) + 'Debug.WriteLine(c.ClueText & " (" & oPL.SolutionsLeft & ")") + End If + + Loop Until oPL.AllNonSolutionsEliminated + End Sub + + Public Sub PopulateListBox(ByVal lb As ListBox) + + Dim c As TileComboClue + + lb.Items.Clear() + For Each c In FClues + lb.Items.Add(c.ClueText) + Next + End Sub + + Public Function IsSolution(ByVal a As ColoredShape, _ + ByVal b As ColoredShape, ByVal c As ColoredShape, _ + ByVal d As ColoredShape) As Boolean + + Dim t As New TileCombo(a, b, c, d) + + Return t.Equals(oPL.Solution) + + End Function + + End Class + + 'holds 4 ColoredShapes + Public Class TileCombo + Private Fcs As ArrayList 'holds array of 4 ColoredShapes + + Public Sub New(ByVal a As ColoredShape, ByVal b As ColoredShape, _ + ByVal c As ColoredShape, ByVal d As ColoredShape) + + Fcs = New ArrayList + Fcs.Add(a) + Fcs.Add(b) + Fcs.Add(c) + Fcs.Add(d) + End Sub + + Public Overloads Function Equals(ByVal t As TileCombo) As Boolean + + Dim oMe As ColoredShape + Dim oHim As ColoredShape + Dim i As Integer + Dim r As Boolean + + r = True + For i = 0 To Fcs.Count - 1 + oMe = Me.ColoredShape(i) + oHim = t.ColoredShape(i) + If Not oMe.Equals(oHim) Then + r = False + End If + Next + + Return r + + End Function + + ReadOnly Property ColoredShape(ByVal i As Integer) As ColoredShape + Get + Return Fcs.Item(i) + End Get + End Property + + 'has this combo been eliminated using the available clues + Private FEliminated As Boolean = False + Property Eliminated() As Boolean + Get + Return FEliminated + End Get + Set(ByVal Value As Boolean) + FEliminated = Value + End Set + End Property + + Public Overrides Function ToString() As String + + Dim o As ColoredShape + Dim s As String + + For Each o In Fcs + s &= o.ToString & ";" + Next + + Return s.Substring(0, s.Length - 1) + End Function + + End Class + + Public Class TileComboPossiblesList + + Private FPossibles As ArrayList + Private iSolution As Integer + + Public Sub New() + GeneratePossibles() + SelectSolution() + End Sub + + Public Function Item(ByVal i As Integer) As TileCombo + Return FPossibles.Item(i) + End Function + + Public Function Solution() As TileCombo + Return FPossibles.Item(iSolution) + End Function + + Private Sub GeneratePossibles() + + Dim FTuples As ArrayList + Dim i, j As Integer + + Dim oTi, oTj As FourTuple + + 'these are the 24 ordered possibilities for integers 0,1,2,3 + FTuples = New ArrayList + With FTuples + .Add(New FourTuple(0, 1, 2, 3)) + .Add(New FourTuple(0, 1, 3, 2)) + .Add(New FourTuple(0, 2, 1, 3)) + .Add(New FourTuple(0, 2, 3, 1)) + .Add(New FourTuple(0, 3, 2, 1)) + .Add(New FourTuple(0, 3, 1, 2)) + .Add(New FourTuple(1, 0, 2, 3)) + .Add(New FourTuple(1, 0, 3, 2)) + .Add(New FourTuple(2, 0, 1, 3)) + .Add(New FourTuple(2, 0, 3, 1)) + .Add(New FourTuple(3, 0, 1, 2)) + .Add(New FourTuple(3, 0, 2, 1)) + .Add(New FourTuple(1, 2, 0, 3)) + .Add(New FourTuple(1, 3, 0, 2)) + .Add(New FourTuple(2, 1, 0, 3)) + .Add(New FourTuple(2, 3, 0, 1)) + .Add(New FourTuple(3, 2, 0, 1)) + .Add(New FourTuple(3, 1, 0, 2)) + .Add(New FourTuple(1, 2, 3, 0)) + .Add(New FourTuple(1, 3, 2, 0)) + .Add(New FourTuple(2, 3, 1, 0)) + .Add(New FourTuple(2, 1, 3, 0)) + .Add(New FourTuple(3, 2, 1, 0)) + .Add(New FourTuple(3, 1, 2, 0)) + End With + + 'we need every permuation of every permutation. this gives us 576 combinations + FPossibles = New ArrayList + For Each oTi In FTuples + For Each oTj In FTuples + FPossibles.Add(New TileCombo( _ + New ColoredShape(oTi.a, oTj.a), _ + New ColoredShape(oTi.b, oTj.b), _ + New ColoredShape(oTi.c, oTj.c), _ + New ColoredShape(oTi.d, oTj.d))) + + Next + Next + + End Sub + Private Sub SelectSolution() + 'FPossibles contains 576 possible combinations of tile color/shapes. pick one + + Dim oRand As New Random + iSolution = oRand.Next(0, FPossibles.Count) + End Sub + + Public Function SolutionsLeft() As Integer + + Dim t As TileCombo + Dim iCtr As Integer = 0 + + For Each t In FPossibles + If Not t.Eliminated Then + iCtr += 1 + End If + Next + + Return iCtr + End Function + + Public Function AllNonSolutionsEliminated() As Boolean + Return (SolutionsLeft() = 1) + End Function + + 'holds 4 integers in a class + Private Class FourTuple + Public a As Integer + Public b As Integer + Public c As Integer + Public d As Integer + + Public Sub New(ByVal ia As Integer, ByVal ib As Integer, _ + ByVal ic As Integer, ByVal id As Integer) + + a = ia + b = ib + c = ic + d = id + End Sub + End Class + + Public Function NumberClueWouldEliminate(ByVal c As TileComboClue) As Integer + + Dim t As TileCombo + Dim r As Integer + + r = 0 + For Each t In FPossibles + If Not c.CluePertainsTo(t) Then + If Not t.Eliminated Then + r += 1 + End If + End If + Next + + Return r + + End Function + + 'eliminates tiles that don't fit a clue + 'count NEWLY eliminated clues + Public Sub EliminateBasedOnClue(ByVal c As TileComboClue) + + Dim t As TileCombo + Dim iCount As Integer + + For Each t In FPossibles + If Not c.CluePertainsTo(t) Then + If Not t.Eliminated Then + iCount += 1 + t.Eliminated = True + End If + End If + Next + + Debug.Assert(iCount > 0) 'make sure it eliminated at least one remaining solution + End Sub + + Public Sub EnumerateRemaining() + + Dim t As TileCombo + + For Each t In FPossibles + If Not t.Eliminated Then + Debug.WriteLine(t.ToString) + End If + Next + + End Sub + End Class + + + Public MustInherit Class TileComboClue + + Protected FTC As TileCombo + Protected oRand As Random + + Public Sub New(ByVal t As TileCombo) + FTC = t + oRand = New Random + End Sub + + MustOverride Function ClueText() As String + MustOverride Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Function HalfTheTime() As Boolean + Return oRand.Next(0, Int16.MaxValue) Mod 2 = 0 + End Function + + Public Function PositionalText(ByVal iPos As Integer) As String + + Dim iRand As Integer + Dim s As String + + Select Case iPos + Case 0 + iRand = oRand.Next(0, Int16.MaxValue) Mod 3 + Select Case iRand + Case 0 + s &= "first" + Case 1 + s &= "in the first position" + Case 2 + s &= "in the top position" + End Select + + Case 1 + If HalfTheTime() Then + s &= "second" + Else + s &= "in the second position" + End If + + Case 2 + iRand = oRand.Next(0, Int16.MaxValue) Mod 3 + Select Case iRand + Case 0 + s &= "third" + Case 1 + s &= "in the third position" + Case 2 + s &= "in the second last position" + End Select + + Case 3 + iRand = oRand.Next(0, Int16.MaxValue) Mod 5 + Select Case iRand + Case 0 + s &= "last" + Case 1 + s &= "in the last position" + Case 2 + s &= "fourth" + Case 3 + s &= "in the fourth position" + Case 4 + s &= "in the bottom position" + End Select + End Select + Return s + + End Function + + End Class + + 'the s is c + 'the c tile is a s + Public Class ComboClueTheShapeIsColor + Inherits TileComboClue + + Private FTile As ColoredShape + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + + Dim oRand As New Random + FTile = t.ColoredShape(oRand.Next(0, 4)) + + End Sub + + Overrides Function ClueText() As String + If HalfTheTime() Then + Return "The " & FTile.ColorWord & " tile is a " & FTile.ShapeWord + Else + Return "The " & FTile.ShapeWord & " is " & FTile.ColorWord + End If + End Function + + 'return true if the + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + + For i = 0 To 3 + ocs = t.ColoredShape(i) + If ocs.Color.Equals(FTile.Color) Then + Return ocs.ShapeWord.Equals(FTile.ShapeWord) + End If + Next + + End Function + + End Class + + 'the s is not c + 'the c tile is not a s + Public Class ComboClueTheShapeIsNOTColor + Inherits TileComboClue + + Private FTileColor As ColoredShape 'contains the color to use + Private FTileShape As ColoredShape 'contains the shape to use (2 must be different) + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + + Dim oRand As New Random + Dim i, j As Integer + + i = oRand.Next(0, 4) + Do + j = oRand.Next(0, 4) + Loop Until i <> j + + FTileColor = t.ColoredShape(i) + FTileShape = t.ColoredShape(j) + End Sub + + Overrides Function ClueText() As String + If HalfTheTime() Then + Return "The " & FTileColor.ColorWord & " tile is not a " & FTileShape.ShapeWord + Else + Return "The " & FTileShape.ShapeWord & " is not " & FTileColor.ColorWord + End If + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + + For i = 0 To 3 + ocs = t.ColoredShape(i) + If ocs.Color.Equals(FTileColor.Color) Then + Return Not ocs.ShapeWord.Equals(FTileShape.ShapeWord) + End If + Next + + End Function + + End Class + + 'the s is neither c1 nor c2 + 'the c1 and c2 tiles are not a s + Public Class ComboClueTheShapeIsNeitherColor + Inherits TileComboClue + + Private FTileColorA As ColoredShape 'contains the first color to use + Private FTileColorB As ColoredShape 'contains the second color to use + Private FTileShape As ColoredShape 'contains the shape to use + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + Dim i, j, k As Integer + Dim oRand As New Random + + i = oRand.Next(0, 4) + Do + j = oRand.Next(0, 4) + Loop Until i <> j + + Do + k = oRand.Next(0, 4) + Loop Until k <> i And k <> j + + FTileColorA = t.ColoredShape(i) + FTileColorB = t.ColoredShape(j) + FTileShape = t.ColoredShape(k) + End Sub + + Overrides Function ClueText() As String + + Dim s As String + + If HalfTheTime() Then + s = "The " & FTileColorA.ColorWord + s &= " and " & FTileColorB.ColorWord & " tiles" + s &= " are not the " & FTileShape.ShapeWord + Else + s = "The " & FTileShape.ShapeWord & " is neither " + s &= FTileColorA.ColorWord & " nor " + s &= FTileColorB.ColorWord + End If + + Return s + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + + For i = 0 To 3 + ocs = t.ColoredShape(i) + + If ocs.ShapeWord.Equals(FTileShape.ShapeWord) Then + Return Not (ocs.Color.Equals(FTileColorA.Color) Or _ + ocs.Color.Equals(FTileColorB.Color)) + End If + Next + + End Function + + End Class + + 'the c tile is neither a s1 nor a s2 + 'the s1 and s2 tiles are not c + Public Class ComboClueTheColorIsNeitherShape + Inherits TileComboClue + + Private FTileShapeA As ColoredShape 'contains the first shape to use + Private FTileShapeB As ColoredShape 'contains the second shape to use + Private FTileColor As ColoredShape 'contains the color to use + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + Dim i, j, k As Integer + Dim oRand As New Random + + i = oRand.Next(0, 4) + Do + j = oRand.Next(0, 4) + Loop Until i <> j + + Do + k = oRand.Next(0, 4) + Loop Until k <> i And k <> j + + FTileShapeA = t.ColoredShape(i) + FTileShapeB = t.ColoredShape(j) + FTileColor = t.ColoredShape(k) + End Sub + + Overrides Function ClueText() As String + + Dim s As String + + If HalfTheTime() Then + s = "The " & FTileShapeA.ShapeWord + s &= " and " & FTileShapeB.ShapeWord & " tiles" + s &= " are not " & FTileColor.ColorWord + Else + s = "The " & FTileColor.ColorWord & " tile is neither a " + s &= FTileShapeA.ShapeWord & " nor a " + s &= FTileShapeB.ShapeWord + End If + + Return s + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + + For i = 0 To 3 + ocs = t.ColoredShape(i) + + If ocs.ColorWord.Equals(FTileColor.ColorWord) Then + Return Not (ocs.ShapeWord.Equals(FTileShapeA.ShapeWord) Or _ + ocs.ShapeWord.Equals(FTileShapeB.ShapeWord)) + End If + Next + + End Function + + End Class + + 'the x is above y + 'the y is below x + Public Class ComboClueXAboveY + Inherits TileComboClue + + Private FTileTop As ColoredShape + Private FTileBottom As ColoredShape + + Private FTopIsShape As Boolean + Private FBottomIsShape As Boolean + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + Dim i, j, tmp As Integer + Dim oRand As New Random + + i = oRand.Next(0, 4) + Do + j = oRand.Next(0, 4) + Loop Until i <> j + If j < i Then + tmp = i + i = j + j = tmp + End If + + FTileTop = t.ColoredShape(i) + FTileBottom = t.ColoredShape(j) + + FTopIsShape = HalfTheTime() + FBottomIsShape = HalfTheTime() + End Sub + + Overrides Function ClueText() As String + + Dim s As String + + If HalfTheTime() Then + s = "The " & IIf(FTopIsShape, FTileTop.ShapeWord, FTileTop.ColorWord & " tile") + s &= " is above the " + s &= IIf(FBottomIsShape, FTileBottom.ShapeWord, FTileBottom.ColorWord & " tile") + Else + s = "The " & IIf(FBottomIsShape, FTileBottom.ShapeWord, FTileBottom.ColorWord & " tile") + s &= " is below the " + s &= IIf(FTopIsShape, FTileTop.ShapeWord, FTileTop.ColorWord & " tile") + End If + + Return s + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + Dim iPos, jPos As Integer + + For i = 0 To 3 + ocs = t.ColoredShape(i) + If FTopIsShape Then + If ocs.ShapeWord.Equals(FTileTop.ShapeWord) Then iPos = i + Else + If ocs.ColorWord.Equals(FTileTop.ColorWord) Then iPos = i + End If + + If FBottomIsShape Then + If ocs.ShapeWord.Equals(FTileBottom.ShapeWord) Then jPos = i + Else + If ocs.ColorWord.Equals(FTileBottom.ColorWord) Then jPos = i + End If + Next + + Return iPos < jPos + End Function + + End Class + + 'the s/c is in the x position + Public Class ComboClueInAPosition + Inherits TileComboClue + + Private FTile As ColoredShape + Private FIndex As Integer + Private FIsShape As Boolean + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + Dim oRand As New Random + + FIsShape = HalfTheTime() + FIndex = oRand.Next(0, 4) + FTile = t.ColoredShape(FIndex) + + End Sub + + Overrides Function ClueText() As String + + Dim s As String + Dim iRand As Integer + + s = "The " + s &= IIf(FIsShape, FTile.ShapeWord, FTile.ColorWord & " tile") + s &= " is " & Me.PositionalText(FIndex) + + Return s + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + Dim iPos, jPos As Integer + Dim r As Boolean + + ocs = t.ColoredShape(FIndex) + If FIsShape Then + r = ocs.ShapeWord.Equals(FTile.ShapeWord) + Else + r = ocs.ColorWord.Equals(FTile.ColorWord) + End If + + Return r + End Function + + End Class + + 'the s/c is NOT in the x position + Public Class ComboClueNOTInAPosition + Inherits TileComboClue + + Private FTile As ColoredShape + Private FIndex As Integer + Private FIndexNot As Integer + Private FIsShape As Boolean + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + Dim oRand As New Random + + FIsShape = HalfTheTime() + FIndex = oRand.Next(0, 4) + Do + FIndexNot = oRand.Next(0, 4) + Loop Until FIndex <> FIndexNot + + FTile = t.ColoredShape(FIndex) + + End Sub + + Overrides Function ClueText() As String + + Dim s As String + + s = "The " + s &= IIf(FIsShape, FTile.ShapeWord, FTile.ColorWord & " tile") + s &= " is not " & PositionalText(FIndexNot) + + Return s + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + Dim iPos, jPos As Integer + Dim r As Boolean + + ocs = t.ColoredShape(FIndexNot) + If FIsShape Then + r = Not ocs.ShapeWord.Equals(FTile.ShapeWord) + Else + r = Not ocs.ColorWord.Equals(FTile.ColorWord) + End If + + Return r + End Function + + End Class + + 'the s/c has at least n tiles above/below + 'n = 1 or 2 + Public Class ComboClueTilesToTopBottom + Inherits TileComboClue + + Private FTile As ColoredShape + Private FIndex As Integer 'which tile to describe + Private FIsShape As Boolean 'select color or shape + Private FIsTop As Boolean 'top or bottom + Private FUseTwo As Boolean '1 or 2 + + Public Sub New(ByVal t As TileCombo) + MyBase.New(t) + Dim oRand As New Random + + FIsShape = HalfTheTime() + FIsTop = HalfTheTime() + + If FIsTop Then + FIndex = oRand.Next(1, 4) 'can't be leftmost + + Select Case FIndex + Case 1 + FUseTwo = False + Case 2, 3 + FUseTwo = HalfTheTime() + Case Else + Throw New ApplicationException("bad random index in " & Me.GetType.Name) + End Select + Else + + FIndex = oRand.Next(0, 3) 'can't be rightmost + + Select Case FIndex + Case 0, 1 + FUseTwo = HalfTheTime() + Case 2, 3 + FUseTwo = False + Case Else + Throw New ApplicationException("bad random index in " & Me.GetType.Name) + End Select + End If + + FTile = t.ColoredShape(FIndex) + End Sub + + Overrides Function ClueText() As String + + Dim s As String + Dim iRand As Integer + Dim iNumToUse As Integer + + s = "The " + s &= IIf(FIsShape, FTile.ShapeWord, FTile.ColorWord & " tile") + s &= " has at least " + s &= IIf(FUseTwo, "two tiles", "one tile") + s &= IIf(FIsTop, " above", " below") + s &= " it" + + Return s + + End Function + + Overrides Function CluePertainsTo(ByVal t As TileCombo) As Boolean + + Dim ocs As ColoredShape + Dim i As Integer + Dim iPos As Integer + Dim r As Boolean + + For i = 0 To 3 + ocs = t.ColoredShape(i) + If FIsShape Then + If ocs.ShapeWord.Equals(FTile.ShapeWord) Then iPos = i + Else + If ocs.ColorWord.Equals(FTile.ColorWord) Then iPos = i + End If + Next + + If FIsTop Then + Select Case iPos + Case 0 + r = False + Case 1 + r = Not FUseTwo + Case Else + r = True + End Select + Else + Select Case iPos + Case 3 + r = False + Case 2 + r = Not FUseTwo + Case Else + r = True + End Select + End If + + Return r + End Function + + End Class + +End Namespace + diff --git a/Files/ShapeTileGames/GameTimer.resx b/Files/ShapeTileGames/GameTimer.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/Files/ShapeTileGames/GameTimer.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/ShapeTileGames/GameTimer.vb b/Files/ShapeTileGames/GameTimer.vb new file mode 100644 index 0000000..628fff1 --- /dev/null +++ b/Files/ShapeTileGames/GameTimer.vb @@ -0,0 +1,108 @@ +Imports System.Drawing.Text + +Public Class GameTimer + Inherits Control + + Private FTimer As Timer + Private FStartTime As DateTime + Private FStartAt As TimeSpan = New TimeSpan(0, 5, 0) + Private FLastSeconds As Integer = -1 'used to raise event + + Public Event SecondsChanged(ByVal sender As Object, ByVal t As TimeSpan) + Public Event TimesUp(ByVal sender As Object) + + Property StartAt() As TimeSpan + Get + Return FStartAt + End Get + + Set(ByVal Value As TimeSpan) + FStartAt = Value + End Set + End Property + + Public Sub StartTimer() + + If FTimer Is Nothing Then + FTimer = New Timer + FTimer.Interval = 100 + AddHandler FTimer.Tick, AddressOf TimerTick + End If + + FStartTime = DateTime.Now + FTimer.Enabled = True + + End Sub + + Public Sub StopTimer() + If Not FTimer Is Nothing Then + FTimer.Enabled = False + End If + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias + + Dim t As TimeSpan + + Dim h As String + Dim m As String + Dim s As String + Dim cTime As String + + 'time since started + t = DateTime.Now.Subtract(FStartTime) + t = FStartAt.Subtract(t) 'time left + If t.Milliseconds < 0 Then + If FTimer.Enabled Then + StopTimer() + RaiseEvent TimesUp(Me) + End If + t = TimeSpan.Zero 'nothing left + End If + + h = t.Hours + h = h.PadLeft(2, "0") + + m = t.Minutes + m = m.PadLeft(2, "0") + + s = t.Seconds + s = s.PadLeft(2, "0") + + If h > 0 Then + cTime = h & ":" & m & ":" & s + Else + cTime = m & ":" & s + End If + + e.Graphics.DrawString(cTime, Me.Font, New SolidBrush(Me.ForeColor), 0, 0) + MyBase.OnPaint(e) + + If s <> FLastSeconds Then + RaiseEvent SecondsChanged(Me, t) + FLastSeconds = s + End If + + Application.DoEvents() + End Sub + + Private Sub TimerTick(ByVal sender As Object, ByVal e As System.EventArgs) + Me.Invalidate() + End Sub + + 'used to add or remove time on the clock + Public Sub AddTime(ByVal t As TimeSpan) + 'to add time, we actually subtract from the start time + + FStartAt = FStartAt.Add(t) + + End Sub + + 'hide ability to enable/disable through this property + Shadows ReadOnly Property Enabled() As Boolean + Get + Return FTimer.Enabled + End Get + End Property +End Class diff --git a/Files/ShapeTileGames/HighScoreRecorder.vb b/Files/ShapeTileGames/HighScoreRecorder.vb new file mode 100644 index 0000000..66cece9 --- /dev/null +++ b/Files/ShapeTileGames/HighScoreRecorder.vb @@ -0,0 +1,229 @@ +Imports Microsoft.Win32 + +'loads/saves/displays high score info +'uses the registry +Public Class HighScoreRecorder + + Private FScores As ArrayList 'array of HighScore objects + Private FGameKey As String + Private FLowerIsBetter As Boolean = False + Private FNumberOfScores As Integer = 8 + Private FChanged As Boolean = False + + Const GAMESUBKEY As String = "Software\Apress\DotNetGames" + Const NOKEY = "xxx" + + Public Sub New(ByVal cGameKey As String, ByVal bLowerIsBetter As Boolean) + MyBase.New() + + FGameKey = GAMESUBKEY & "\" & cGameKey + LowerIsBetter = bLowerIsBetter + + LoadScores() + End Sub + + Protected Overrides Sub Finalize() + Call SaveScores() + End Sub + + + Property NumberOfScores() As Integer + Get + Return FNumberOfScores + End Get + Set(ByVal Value As Integer) + FNumberOfScores = Value + End Set + End Property + + Property LowerIsBetter() As Boolean + Get + Return FLowerIsBetter + End Get + Set(ByVal Value As Boolean) + FLowerIsBetter = Value + End Set + End Property + + Private Sub LoadScores() + + Dim aKey As RegistryKey + Dim cValue As String + Dim iLoop As Integer = 0 + Dim bDone As Boolean + Dim aHS As HighScore + + FScores = New ArrayList + + aKey = Registry.CurrentUser + + 'create a subkey. trap any errors (security, etc) + Try + aKey = aKey.CreateSubKey(FGameKey) + + bDone = False + Do While Not bDone + cValue = aKey.GetValue("Score" & iLoop, NOKEY) + If cValue.Equals(NOKEY) Then + bDone = True + Else + aHS = New HighScore(Me) + If aHS.Parse(cValue) Then + FScores.Add(aHS) + End If + + iLoop += 1 + + '1- highscores max + If iLoop > NumberOfScores Then + bDone = True + End If + End If + Loop + + Finally + Call aKey.Close() + End Try + + End Sub + + Private Sub SaveScores() + + Dim aKey As RegistryKey + Dim hs As HighScore + Dim cKey As String + Dim iLoop As Integer = 0 + + aKey = Registry.CurrentUser + + 'create a subkey. trap any errors (security, etc) + Try + aKey = aKey.CreateSubKey(FGameKey) + + iLoop = 0 + For Each hs In FScores + cKey = "Score" & iLoop + aKey.SetValue(cKey, hs.Player & "|" & hs.Score) + iLoop += 1 + Next + + Finally + Call aKey.Close() + End Try + + End Sub + + Public Function ScoreWorthyOfList(ByVal iScore As Integer) As Boolean + + Dim hs As HighScore + + 'can always add if not to max slots yet + If FScores.Count < NumberOfScores Then + Return True + Else + hs = FScores.Item(FScores.Count - 1) + + If LowerIsBetter Then + Return hs.Score >= iScore + Else + Return hs.Score <= iScore + End If + End If + + End Function + + Public Function AddScoreToList(ByVal cUser As String, ByVal iScore As Integer) As Integer + + If Not ScoreWorthyOflist(iScore) Then Exit Function + + 'add new one, sort + FScores.Add(New HighScore(cUser, iScore, Me)) + FScores.Sort() + + 'drop last one if too many + If FScores.Count > FNumberOfScores Then + FScores.RemoveAt(FScores.Count - 1) + End If + + FChanged = True + + End Function + + + Private Class HighScore + Implements IComparable + + Public Sub New(ByVal Reader As HighScoreRecorder) + MyBase.New() + FReader = Reader + End Sub + + Public Sub New(ByVal cPlayer As String, ByVal iScore As Integer, ByVal Reader As HighScoreRecorder) + MyBase.New() + + Score = iScore + Player = cPlayer + FReader = Reader + End Sub + + Private FScore As Integer + Private FPlayer As String + Private FReader As HighScoreRecorder + + Property Score() As Integer + Get + Return FScore + End Get + Set(ByVal Value As Integer) + FScore = Value + End Set + End Property + + Property Player() As String + Get + Return FPlayer + End Get + Set(ByVal Value As String) + FPlayer = Value + End Set + End Property + + Public Function Parse(ByVal cScoreValue As String) As Boolean + + Dim iPos As Integer + + iPos = cScoreValue.IndexOf("|") + If iPos < 0 Then + Return False + Else + Try + FPlayer = cScoreValue.Substring(0, iPos) + FScore = CInt(cScoreValue.Substring(iPos + 1)) + Return True + Catch ex As Exception + Return False + End Try + End If + + End Function + + Public Overridable Function CompareTo(ByVal o As Object) As Integer _ + Implements IComparable.CompareTo + + If Not TypeOf o Is HighScore Then + Return -1 + Else + If FReader.FLowerIsBetter Then + Return Me.Score.CompareTo(CType(o, HighScore).Score) + Else + Return -Me.Score.CompareTo(CType(o, HighScore).Score) + End If + End If + + End Function + + End Class + + + +End Class diff --git a/Files/ShapeTileGames/LoseYourMind.vb b/Files/ShapeTileGames/LoseYourMind.vb new file mode 100644 index 0000000..e27a690 --- /dev/null +++ b/Files/ShapeTileGames/LoseYourMind.vb @@ -0,0 +1,239 @@ +Imports System.Drawing.Drawing2D +Imports ShapeTileGames.NewTile + +Namespace LoseYourMind + + Public Class TileCollection + Inherits System.Collections.CollectionBase + + Public Sub Add(ByVal o As ColoredShape) + Me.List.Add(o) + End Sub + + Public ReadOnly Property Item(ByVal iIndex As Integer) As ColoredShape + Get + Return Me.List(iIndex) + End Get + End Property + + Public Sub Remove(ByVal o As ColoredShape) + Me.List.Remove(o) + End Sub + + 'this is a shallow copy + Public Function Clone() As TileCollection + + Dim r As New TileCollection + + Dim o As ColoredShape + + For Each o In Me.List + r.Add(o) + Next + + Return r + End Function + + Public Overrides Function ToString() As String + + Dim s As String + Dim o As ColoredShape + + For Each o In Me.List + s &= o.ToString & ";" + Next + + Return s.Substring(0, s.Length - 1) + End Function + End Class + + 'represents one guess in the game. + 'includes the tiles and the comparison + Public Class TileCollectionGuess + Inherits TileCollection + + Private FNumShapeCorrect As Integer 'shapes in correct place + Private FNumColorCorrect As Integer 'colors in correct place + Private FNumShapeWrongSpot As Integer 'correct shapes in wrong place + Private FNumColorWrongSpot As Integer 'correct colors in wrong place + + ReadOnly Property NumShapeCorrect() As Integer + Get + Return FNumShapeCorrect + End Get + End Property + + ReadOnly Property NumShapeWrongSpot() As Integer + Get + Return FNumShapeWrongSpot + End Get + End Property + + ReadOnly Property NumColorCorrect() As Integer + Get + Return FNumColorCorrect + End Get + End Property + + ReadOnly Property NumColorWrongSpot() As Integer + Get + Return FNumColorWrongSpot + End Get + End Property + + + Public Sub CheckAgainst(ByVal oSolution As TileCollection) + CheckAgainstShape(oSolution) + CheckAgainstColor(oSolution) + End Sub + + Private Sub CheckAgainstShape(ByVal oSolution As TileCollection) + + Dim oSol As TileCollection = oSolution.Clone + Dim oMe As TileCollection = Me.Clone + Dim oCSMe As ColoredShape + Dim oCSSol As ColoredShape + Dim i As Integer = 0 + + 'first count those in same position, and remove as we go + 'can't use 'for each' since removing + Do While i < oMe.Count + If oMe.Item(i).ShapeWord.Equals(oSol.Item(i).ShapeWord) Then + oMe.Remove(oMe.Item(i)) + oSol.Remove(oSol.Item(i)) + FNumShapeCorrect += 1 + Else + i = i + 1 + End If + Loop + + 'now count in different position. remove only from solution + For Each oCSMe In oMe + For Each oCSSol In oSol + If oCSMe.ShapeWord.Equals(oCSSol.ShapeWord) Then + FNumShapeWrongSpot += 1 + oSol.Remove(oCSSol) 'only remove in solution + Exit For + End If + Next + Next + + End Sub + + Private Sub CheckAgainstColor(ByVal oSolution As TileCollection) + + Dim oSol As TileCollection = oSolution.Clone + Dim oMe As TileCollection = Me.Clone + Dim oCSMe As ColoredShape + Dim oCSSol As ColoredShape + Dim i As Integer = 0 + + 'first count those in same position, and remove as we go + 'can't use 'for each' since removing + Do While i < oMe.Count + If oMe.Item(i).Color.Equals(oSol.Item(i).Color) Then + oMe.Remove(oMe.Item(i)) + oSol.Remove(oSol.Item(i)) + FNumColorCorrect += 1 + Else + i = i + 1 + End If + Loop + + 'now count in different position. remove only from solution + For Each oCSMe In oMe + For Each oCSSol In oSol + If oCSMe.Color.Equals(oCSSol.Color) Then + FNumColorWrongSpot += 1 + oSol.Remove(oCSSol) 'only remove in solution + Exit For + End If + Next + Next + End Sub + + Public Overrides Function ToString() As String + + Dim s As String = MyBase.ToString + + s &= "(shape=" + s &= FNumShapeCorrect & ";" & FNumShapeWrongSpot & ") " + s &= "(color=" + s &= FNumColorCorrect & ";" & FNumColorWrongSpot & ")" + + Return s + + End Function + + Public Function Wins() As Boolean + Return FNumShapeCorrect = Me.List.Count And _ + FNumColorCorrect = Me.List.Count + End Function + End Class + + Public Class GuessHintRenderer + Inherits Control + + Private FTC As TileCollectionGuess + Public Sub New(ByVal oTC As TileCollectionGuess) + MyBase.new() + FTC = oTC + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias + Draw(e.Graphics) + End Sub + + Private Sub Draw(ByVal g As Graphics) + + Const CSIZE = 8 + + Dim iLeft As Integer + Dim iTop As Integer + Dim i As Integer + + Dim r As Rectangle + + r = Me.ClientRectangle + r.Inflate(-1, -1) + g.DrawRectangle(Pens.White, r) + g.FillRectangle(Brushes.LightGray, r) + + iTop = 6 + iLeft = 4 + For i = 0 To FTC.NumShapeCorrect - 1 + r = New Rectangle(iLeft, iTop, CSIZE, CSIZE) + g.DrawEllipse(Pens.Black, r) + g.FillEllipse(Brushes.Black, r) + iLeft += CSIZE + 4 + Next + + For i = 0 To FTC.NumShapeWrongSpot - 1 + r = New Rectangle(iLeft, iTop, CSIZE, CSIZE) + g.DrawEllipse(Pens.Black, r) + g.FillEllipse(Brushes.White, r) + iLeft += CSIZE + 4 + Next + + iTop += CSIZE + (CSIZE \ 2) + iLeft = 4 + For i = 0 To FTC.NumColorCorrect - 1 + r = New Rectangle(iLeft, iTop, CSIZE, CSIZE) + g.DrawEllipse(Pens.Black, r) + g.FillEllipse(Brushes.Black, r) + iLeft += CSIZE + 4 + Next + + For i = 0 To FTC.NumColorWrongSpot - 1 + r = New Rectangle(iLeft, iTop, CSIZE, CSIZE) + g.DrawEllipse(Pens.Black, r) + g.FillEllipse(Brushes.White, r) + iLeft += CSIZE + 4 + Next + + End Sub + + End Class +End Namespace + diff --git a/Files/ShapeTileGames/ShapeTile2.resx b/Files/ShapeTileGames/ShapeTile2.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/Files/ShapeTileGames/ShapeTile2.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/ShapeTileGames/ShapeTile2.vb b/Files/ShapeTileGames/ShapeTile2.vb new file mode 100644 index 0000000..b1e08b0 --- /dev/null +++ b/Files/ShapeTileGames/ShapeTile2.vb @@ -0,0 +1,336 @@ +Imports System.Drawing.Drawing2D + +'this was the first pass at creating the colored shape class. +'it uses inheritence to create the four different +'types of tiles. This scheme breaks down when you wish to +'add functionality to the base class via inheritence, +'as you would need to inherit all subclasses. It also does not +'work well for games where a tile has to change shape on the fly + +Namespace OldTile + + Public MustInherit Class ColoredShape + Inherits Control + Implements IComparable + + Public Shared Function CreateByIndex(ByVal iShape As Integer, _ + ByVal iColor As Integer) As ColoredShape + + Dim o As ColoredShape + Dim oClr As New Color + + Select Case iShape + Case 0 + o = New SquareColoredShape + Case 1 + o = New CircleColoredShape + Case 2 + o = New DiamondColoredShape + Case 3 + o = New TriangleColoredShape + Case Else + Throw New Exception("iShape index must be 0-3") + End Select + + 'odd, cannot do 'color.red' here + Select Case iColor + Case 0 + o.Color = oClr.Red + Case 1 + o.Color = oClr.Yellow + Case 2 + o.Color = oClr.Blue + Case 3 + o.Color = oClr.Green + Case Else + Throw New Exception("iColor index must be 0-3") + End Select + + Return o + End Function + + Private FBackwards As Boolean + Property Backwards() As Boolean + Get + Return FBackwards + End Get + Set(ByVal Value As Boolean) + FBackwards = Value + Invalidate() + End Set + End Property + + Private FBorder As Integer = 2 + Property Border() As Integer + Get + Return FBorder + End Get + Set(ByVal Value As Integer) + If Value < 0 Then + Throw New Exception("Illegal value") + Else + FBorder = Value + Invalidate() + End If + End Set + End Property + + Private FColor As Color = Color.Red + Property Color() As Color + Get + Return FColor + End Get + Set(ByVal Value As Color) + + Dim aC() As Color = {Color.Red, Color.Blue, Color.Green, Color.Yellow} + + If Array.IndexOf(aC, Value) = -1 Then + Throw New Exception("colors constrained to Red/Blue/Green/Yellow") + Else + FColor = Value + Invalidate() + End If + End Set + End Property + + ReadOnly Property ColorWord() As String + + Get + Dim s As String + + If Color.Equals(Color.Red) Then + s = "Red" + ElseIf Color.Equals(Color.Blue) Then + s = "Blue" + ElseIf Color.Equals(Color.Green) Then + s = "Green" + ElseIf Color.Equals(Color.Yellow) Then + s = "Yellow" + Else + 'won't happen, but just in case + s = Color.ToString + End If + + Return s + End Get + End Property + + MustOverride ReadOnly Property ShapeWord() As String + + Overrides Function ToString() As String + Return Me.ColorWord & " " & Me.ShapeWord + End Function + + 'this code draws the background. Override to draw the shape itself + Protected Overridable Sub Draw(ByVal g As Graphics) + + Dim b As LinearGradientBrush + + Dim iRad As Integer = Width - (Me.Border * 2) + Dim r As New Rectangle(Me.Border, Me.Border, iRad, iRad) + + b = New LinearGradientBrush(r, Color.White, Color.DarkGray, LinearGradientMode.Vertical) + g.FillRectangle(b, r) + + End Sub + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias + Draw(e.Graphics) + End Sub + + 'cover the real width and height to force the shape to be square + Shadows Property Width() As Integer + Get + Return MyBase.Width + End Get + + Set(ByVal Value As Integer) + MyBase.Width = Value + MyBase.Height = Value + End Set + End Property + + Shadows Property Height() As Integer + Get + Return MyBase.Height + End Get + Set(ByVal Value As Integer) + MyBase.Width = Value + MyBase.Height = Value + End Set + End Property + + Public Overloads Function Equals(ByVal s As ColoredShape) As Boolean + + 'two tiles equal if color and class equal + Return Me.Color.Equals(s.Color) _ + And s.GetType.Equals(Me.GetType) + + End Function + + 'there's only one compareto used here, used when sorting tiles by their position in Deductile Reasoning. + 'if we wanted different CompareTos, an inheritance scheme might be more usable, but causes + 'combinatorial class problems + 'example = try inheriting ColoredShape into OrderedColoredShape to implement the CompareTo, + 'you would have to inherit all the subclasses as well. + Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo + + Dim o As ColoredShape = CType(obj, ColoredShape) + + Return Me.Top.CompareTo(o.Top) + End Function + + End Class + + Public Class SquareColoredShape + Inherits ColoredShape + + Protected Overrides Sub Draw(ByVal g As Graphics) + + MyBase.Draw(g) 'draw the background + If Backwards Then Exit Sub + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + Dim r As New Rectangle(-iRad \ 2, -iRad \ 2, iRad, iRad) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .FillRectangle(b, r) + .DrawRectangle(Pens.Black, r) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Overrides ReadOnly Property ShapeWord() As String + Get + Return "Square" + End Get + End Property + + End Class + + Public Class CircleColoredShape + Inherits ColoredShape + + Protected Overrides Sub Draw(ByVal g As Graphics) + + MyBase.Draw(g) 'draw the background + If Backwards Then Exit Sub + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + Dim r As New Rectangle(-iRad \ 2, -iRad \ 2, iRad, iRad) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .FillEllipse(b, r) + .DrawEllipse(Pens.Black, r) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Overrides ReadOnly Property ShapeWord() As String + Get + Return "Circle" + End Get + End Property + + End Class + + Public Class DiamondColoredShape + Inherits ColoredShape + + Protected Overrides Sub Draw(ByVal g As Graphics) + + MyBase.Draw(g) 'draw the background + If Backwards Then Exit Sub + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + + Dim r As New Rectangle(-iRad \ 2, -iRad \ 2, iRad, iRad) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .RotateTransform(45) + .ScaleTransform(0.8, 0.8) + .FillRectangle(b, r) + .DrawRectangle(Pens.Black, r) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Overrides ReadOnly Property ShapeWord() As String + Get + Return "Diamond" + End Get + End Property + + End Class + + Public Class TriangleColoredShape + Inherits ColoredShape + + Protected Overrides Sub Draw(ByVal g As Graphics) + + MyBase.Draw(g) 'draw the background + If Backwards Then Exit Sub + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + + Dim pt(2) As Point + pt(0) = New Point(-iRad \ 2, iRad \ 2) + pt(1) = New Point(0, -iRad \ 2) + pt(2) = New Point(iRad \ 2, iRad \ 2) + Dim gp As New GraphicsPath + gp.AddPolygon(pt) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .FillPath(b, gp) + .DrawPath(Pens.Black, gp) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Overrides ReadOnly Property ShapeWord() As String + Get + Return "Triangle" + End Get + End Property + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/ShapeTileGames/ShapeTile3.resx b/Files/ShapeTileGames/ShapeTile3.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/Files/ShapeTileGames/ShapeTile3.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/Files/ShapeTileGames/ShapeTile3.vb b/Files/ShapeTileGames/ShapeTile3.vb new file mode 100644 index 0000000..db63d1a --- /dev/null +++ b/Files/ShapeTileGames/ShapeTile3.vb @@ -0,0 +1,347 @@ +Imports System.Drawing.Drawing2D + +Namespace NewTile + + Public Enum ShapeType + stSquare + stCircle + stDiamond + stTriangle + End Enum + + Public Class ColoredShape + Inherits Control + Implements IComparable + + Private FShape As ShapeType + Property Shape() As ShapeType + Get + Return FShape + End Get + Set(ByVal Value As ShapeType) + FShape = Value + Invalidate() + End Set + End Property + + Public Sub ToggleShape() + + Select Case Shape + Case ShapeType.stCircle + Shape = ShapeType.stDiamond + Case ShapeType.stDiamond + Shape = ShapeType.stSquare + Case ShapeType.stSquare + Shape = ShapeType.stTriangle + Case ShapeType.stTriangle + Shape = ShapeType.stCircle + End Select + End Sub + + Public Sub ToggleColor() + + 'can't use a case statement for colors + If Me.Color.Equals(Color.Red) Then + Me.Color = Color.Yellow + ElseIf Me.Color.Equals(Color.Yellow) Then + Me.Color = Color.Green + ElseIf Me.Color.Equals(Color.Green) Then + Me.Color = Color.Blue + ElseIf Me.Color.Equals(Color.Blue) Then + Me.Color = Color.Red + End If + + End Sub + + Public Sub CopyFrom(ByVal c As ColoredShape) + Me.Color = c.Color + Me.Shape = c.Shape + End Sub + + Public Sub New(ByVal iShape As Integer, ByVal iColor As Integer) + + MyBase.new() + Select Case iShape + Case 0 + Me.Shape = ShapeType.stSquare + Case 1 + Me.Shape = ShapeType.stCircle + Case 2 + Me.Shape = ShapeType.stDiamond + Case 3 + Me.Shape = ShapeType.stTriangle + Case Else + Throw New Exception("iShape index must be 0-3") + End Select + + 'odd, cannot do 'color.red' here + Select Case iColor + Case 0 + Me.Color = Color.Red + Case 1 + Me.Color = Color.Yellow + Case 2 + Me.Color = Color.Blue + Case 3 + Me.Color = Color.Green + Case Else + Throw New Exception("iColor index must be 0-3") + End Select + + End Sub + + Private FBackwards As Boolean + Property Backwards() As Boolean + Get + Return FBackwards + End Get + Set(ByVal Value As Boolean) + FBackwards = Value + Invalidate() + End Set + End Property + + Private FBorder As Integer = 2 + Property Border() As Integer + Get + Return FBorder + End Get + Set(ByVal Value As Integer) + If Value < 0 Then + Throw New Exception("Illegal value") + Else + FBorder = Value + Invalidate() + End If + End Set + End Property + + Private FColor As Color = Color.Red + Property Color() As Color + Get + Return FColor + End Get + Set(ByVal Value As Color) + + Dim aC() As Color = {Color.Red, Color.Blue, Color.Green, Color.Yellow} + + If Array.IndexOf(aC, Value) = -1 Then + Throw New Exception("colors constrained to Red/Blue/Green/Yellow") + Else + FColor = Value + Me.Invalidate() + End If + End Set + End Property + + ReadOnly Property ColorWord() As String + + Get + Dim s As String + + If Color.Equals(Color.Red) Then + s = "Red" + ElseIf Color.Equals(Color.Blue) Then + s = "Blue" + ElseIf Color.Equals(Color.Green) Then + s = "Green" + ElseIf Color.Equals(Color.Yellow) Then + s = "Yellow" + Else + 'won't happen, but just in case + s = Color.ToString + End If + + Return s + End Get + End Property + + ReadOnly Property ShapeWord() As String + Get + Dim s As String + + Select Case FShape + Case ShapeType.stCircle + s = "Circle" + Case ShapeType.stDiamond + s = "Diamond" + Case ShapeType.stSquare + s = "Square" + Case ShapeType.stTriangle + s = "Triangle" + End Select + Return s + End Get + End Property + + Overrides Function ToString() As String + Return Me.ColorWord & " " & Me.ShapeWord + End Function + + 'this code draws the tile. + Public Overridable Sub Draw(ByVal g As Graphics) + + Dim b As LinearGradientBrush + + Dim iRad As Integer = Width - (Me.Border * 2) + Dim r As New Rectangle(Me.Border, Me.Border, iRad, iRad) + + b = New LinearGradientBrush(r, Color.White, Color.DarkGray, LinearGradientMode.Vertical) + g.FillRectangle(b, r) + g.DrawRectangle(Pens.White, r) + If Backwards Then Exit Sub + + Select Case FShape + Case ShapeType.stCircle + DrawCircle(g) + Case ShapeType.stDiamond + DrawDiamond(g) + Case ShapeType.stSquare + DrawSquare(g) + Case ShapeType.stTriangle + DrawTriangle(g) + End Select + + End Sub + + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + MyBase.OnPaint(e) + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias + Draw(e.Graphics) + End Sub + + 'cover the real width and height to force the shape to be square + Shadows Property Width() As Integer + Get + Return MyBase.Width + End Get + + Set(ByVal Value As Integer) + MyBase.Width = Value + MyBase.Height = Value + End Set + End Property + + Shadows Property Height() As Integer + Get + Return MyBase.Height + End Get + Set(ByVal Value As Integer) + MyBase.Width = Value + MyBase.Height = Value + End Set + End Property + + Public Overloads Function Equals(ByVal s As ColoredShape) As Boolean + + 'two tiles equal if color and shape equal + Return Me.Color.Equals(s.Color) _ + And s.Shape.Equals(Me.Shape) + + End Function + + Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo + + Dim o As ColoredShape = CType(obj, ColoredShape) + + Return Me.Top.CompareTo(o.Top) + End Function + + Private Sub DrawSquare(ByVal g As Graphics) + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + Dim r As New Rectangle(-iRad \ 2, -iRad \ 2, iRad, iRad) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .FillRectangle(b, r) + .DrawRectangle(Pens.Black, r) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Private Sub DrawCircle(ByVal g As Graphics) + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + Dim r As New Rectangle(-iRad \ 2, -iRad \ 2, iRad, iRad) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .FillEllipse(b, r) + .DrawEllipse(Pens.Black, r) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + Private Sub DrawDiamond(ByVal g As Graphics) + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + + Dim r As New Rectangle(-iRad \ 2, -iRad \ 2, iRad, iRad) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .RotateTransform(45) + .ScaleTransform(0.8, 0.8) + .FillRectangle(b, r) + .DrawRectangle(Pens.Black, r) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + + Private Sub DrawTriangle(ByVal g As Graphics) + + Dim b As New SolidBrush(Me.Color) + Dim iRad As Integer = (Width - Me.Border) \ 2 + Dim ogc As GraphicsContainer + + Dim pt(2) As Point + pt(0) = New Point(-iRad \ 2, iRad \ 2) + pt(1) = New Point(0, -iRad \ 2) + pt(2) = New Point(iRad \ 2, iRad \ 2) + Dim gp As New GraphicsPath + gp.AddPolygon(pt) + + ogc = g.BeginContainer + Try + With g + .SmoothingMode = SmoothingMode.AntiAlias + .TranslateTransform(Width \ 2, Width \ 2) + .FillPath(b, gp) + .DrawPath(Pens.Black, gp) + End With + Finally + g.EndContainer(ogc) + End Try + + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/ShapeTileGames/ShapeTileGames.sln b/Files/ShapeTileGames/ShapeTileGames.sln new file mode 100644 index 0000000..03d7436 --- /dev/null +++ b/Files/ShapeTileGames/ShapeTileGames.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ShapeTileGames", "ShapeTileGames.vbproj", "{9FBE74F0-8027-4CFF-BFD7-DA0FDA4AD36A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {9FBE74F0-8027-4CFF-BFD7-DA0FDA4AD36A}.Debug.ActiveCfg = Debug|.NET + {9FBE74F0-8027-4CFF-BFD7-DA0FDA4AD36A}.Debug.Build.0 = Debug|.NET + {9FBE74F0-8027-4CFF-BFD7-DA0FDA4AD36A}.Release.ActiveCfg = Release|.NET + {9FBE74F0-8027-4CFF-BFD7-DA0FDA4AD36A}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/ShapeTileGames/ShapeTileGames.suo b/Files/ShapeTileGames/ShapeTileGames.suo new file mode 100644 index 0000000..43390c4 Binary files /dev/null and b/Files/ShapeTileGames/ShapeTileGames.suo differ diff --git a/Files/ShapeTileGames/ShapeTileGames.vbproj b/Files/ShapeTileGames/ShapeTileGames.vbproj new file mode 100644 index 0000000..9ba14b7 --- /dev/null +++ b/Files/ShapeTileGames/ShapeTileGames.vbproj @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/ShapeTileGames/ShapeTileGames.vbproj.user b/Files/ShapeTileGames/ShapeTileGames.vbproj.user new file mode 100644 index 0000000..8f26536 --- /dev/null +++ b/Files/ShapeTileGames/ShapeTileGames.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/ShapeTileGames/bin/ShapeTileGames.exe b/Files/ShapeTileGames/bin/ShapeTileGames.exe new file mode 100644 index 0000000..5a35b00 Binary files /dev/null and b/Files/ShapeTileGames/bin/ShapeTileGames.exe differ diff --git a/Files/ShapeTileGames/bin/ShapeTileGames.pdb b/Files/ShapeTileGames/bin/ShapeTileGames.pdb new file mode 100644 index 0000000..af6b4ef Binary files /dev/null and b/Files/ShapeTileGames/bin/ShapeTileGames.pdb differ diff --git a/Files/ShapeTileGames/fConcentration.resx b/Files/ShapeTileGames/fConcentration.resx new file mode 100644 index 0000000..22fca7f --- /dev/null +++ b/Files/ShapeTileGames/fConcentration.resx @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + fConcentration + + + Assembly + + \ No newline at end of file diff --git a/Files/ShapeTileGames/fConcentration.vb b/Files/ShapeTileGames/fConcentration.vb new file mode 100644 index 0000000..9b94c99 --- /dev/null +++ b/Files/ShapeTileGames/fConcentration.vb @@ -0,0 +1,258 @@ +Imports ShapeTileGames.OldTile + +Public Class fConcentration + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents oMenu As System.Windows.Forms.MainMenu + Friend WithEvents mFile As System.Windows.Forms.MenuItem + Friend WithEvents oNew As System.Windows.Forms.MenuItem + Friend WithEvents oDash0 As System.Windows.Forms.MenuItem + Friend WithEvents oExit As System.Windows.Forms.MenuItem + Private Sub InitializeComponent() + Me.oMenu = New System.Windows.Forms.MainMenu + Me.mFile = New System.Windows.Forms.MenuItem + Me.oNew = New System.Windows.Forms.MenuItem + Me.oDash0 = New System.Windows.Forms.MenuItem + Me.oExit = New System.Windows.Forms.MenuItem + ' + 'oMenu + ' + Me.oMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mFile}) + ' + 'mFile + ' + Me.mFile.Index = 0 + Me.mFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.oNew, Me.oDash0, Me.oExit}) + Me.mFile.Text = "&File" + ' + 'oNew + ' + Me.oNew.Index = 0 + Me.oNew.Shortcut = System.Windows.Forms.Shortcut.CtrlN + Me.oNew.Text = "&New" + ' + 'oDash0 + ' + Me.oDash0.Index = 1 + Me.oDash0.Text = "-" + ' + 'oExit + ' + Me.oExit.Index = 2 + Me.oExit.Text = "E&xit" + ' + 'fConcentration + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) + Me.BackColor = System.Drawing.Color.Black + Me.ClientSize = New System.Drawing.Size(386, 221) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.MaximizeBox = False + Me.Menu = Me.oMenu + Me.MinimizeBox = False + Me.Name = "fConcentration" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Brain Drain Concentration" + + End Sub + +#End Region + + Dim FTiles As ArrayList + Dim FFirstOneFlipped As ColoredShape + Private oWav As WavLibrary + Dim oGT As GameTimer + + Private Sub fConcentration_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + oGT = New GameTimer + With oGT + .Dock = DockStyle.Bottom + .Height = 32 + .Font = New Font("Tahoma", 16, FontStyle.Italic Or FontStyle.Bold) + .ForeColor = Color.LightGray + AddHandler .TimesUp, AddressOf TimerDone + AddHandler .SecondsChanged, AddressOf TimerSeconds + End With + + Me.Controls.Add(oGT) + + SetupWavLibrary() + StartGame() + + End Sub + + Private Sub SetupWavLibrary() + + oWav = New WavLibrary + oWav.LoadFromResource("ShapeTileGames.die1.wav", "die1") + oWav.LoadFromResource("ShapeTileGames.8ping.wav", "8ping") + oWav.LoadFromResource("ShapeTileGames.ouch.wav", "ouch") + oWav.LoadFromResource("ShapeTileGames.ovation.wav", "ovation") + + End Sub + + Private Sub StartGame() + + Dim oShape As ColoredShape + + Dim oRand As New Random + Dim i, j, k As Integer + Dim iCtr As Integer + Dim p As Point + + Me.Cursor = Cursors.WaitCursor + oGT.StopTimer() + + 'note how two references pointing to the same object + 'me.controls and FTiles. + If Not FTiles Is Nothing Then + For Each oShape In FTiles + Me.Controls.Remove(oShape) + Next + End If + + FTiles = New ArrayList + + For i = 0 To 3 '4 shapes... + For j = 0 To 3 '4 colors... + For k = 0 To 1 '2 copies + 'oShape = New ColoredShape(i, j) + oShape = ColoredShape.CreateByIndex(i, j) + oShape.Backwards = True + oShape.Width = 48 + oShape.Left = (iCtr Mod 8) * oShape.Width + oShape.Top = (iCtr \ 8) * oShape.Height + AddHandler oShape.Click, AddressOf ShapeClick + + 'adding a reference to two places, the form and to an arraylist + FTiles.Add(oShape) + Me.Controls.Add(oShape) + + iCtr += 1 + Next + Next + Next + + 'swap positions randomly + For k = 0 To 999 + i = oRand.Next(0, FTiles.Count) + j = oRand.Next(0, FTiles.Count) + If i <> j Then + p = CType(FTiles.Item(i), ColoredShape).Location + + CType(FTiles.Item(i), ColoredShape).Location = _ + CType(FTiles.Item(j), ColoredShape).Location + + CType(FTiles.Item(j), ColoredShape).Location = p + End If + Next + + FFirstOneFlipped = Nothing + Me.Cursor = Cursors.Default + oGT.StartTimer() + + End Sub + + Private Sub ShapeClick(ByVal sender As Object, _ + ByVal e As System.EventArgs) + + Dim s As ColoredShape = sender + + s.Backwards = False + oWav.Play("die1", 100) + Application.DoEvents() + + If FFirstOneFlipped Is Nothing Then + FFirstOneFlipped = s + Else + If s.Equals(FFirstOneFlipped) Then + System.Threading.Thread.Sleep(100) 'pause just a sec + Me.Controls.Remove(s) + Me.Controls.Remove(FFirstOneFlipped) + + FTiles.Remove(s) + FTiles.Remove(FFirstOneFlipped) + oWav.Play("die1", 100) + + If FTiles.Count = 0 Then + oGT.StopTimer() + oWav.Play("ovation", 100) + MsgBox("you win") + End If + Else + System.Threading.Thread.Sleep(500) + s.Backwards = True + FFirstOneFlipped.Backwards = True + oWav.Play("ouch", 100) + End If + FFirstOneFlipped = Nothing + End If + + End Sub + + Private Sub oExit_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles oExit.Click + + Me.Close() + End Sub + + Private Sub TimerDone(ByVal sender As Object) + MsgBox("you lose") + End Sub + + Private Sub TimerSeconds(ByVal sender As Object, ByVal t As TimeSpan) + + If t.TotalSeconds < 60 Then + CType(sender, GameTimer).ForeColor = Color.Red + Else + CType(sender, GameTimer).ForeColor = Color.LightGray + End If + + End Sub + + Private Sub oNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles oNew.Click + If MsgBox("Restart Game?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, _ + "Restart") = MsgBoxResult.Yes Then + + Call StartGame() + End If + End Sub + + Private Sub fConcentration_Closing(ByVal sender As Object, _ + ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing + + If MsgBox("End Game?", MsgBoxStyle.YesNo _ + Or MsgBoxStyle.Question, "Confirm?") = MsgBoxResult.No Then e.Cancel = True + + End Sub +End Class diff --git a/Files/ShapeTileGames/fDeductile.resx b/Files/ShapeTileGames/fDeductile.resx new file mode 100644 index 0000000..ec03034 --- /dev/null +++ b/Files/ShapeTileGames/fDeductile.resx @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + 17, 17 + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + fDeductile + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/ShapeTileGames/fDeductile.vb b/Files/ShapeTileGames/fDeductile.vb new file mode 100644 index 0000000..dc76f42 --- /dev/null +++ b/Files/ShapeTileGames/fDeductile.vb @@ -0,0 +1,336 @@ +Imports ShapeTileGames.NewTile + +Public Class fDeductile + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents oMenu As System.Windows.Forms.MainMenu + Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem + Friend WithEvents mNew As System.Windows.Forms.MenuItem + Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem + Friend WithEvents mExit As System.Windows.Forms.MenuItem + Friend WithEvents lbClues As System.Windows.Forms.ListBox + Friend WithEvents lbInstructions As System.Windows.Forms.Label + Friend WithEvents cbGuess As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.oMenu = New System.Windows.Forms.MainMenu + Me.MenuItem1 = New System.Windows.Forms.MenuItem + Me.mNew = New System.Windows.Forms.MenuItem + Me.MenuItem2 = New System.Windows.Forms.MenuItem + Me.mExit = New System.Windows.Forms.MenuItem + Me.lbClues = New System.Windows.Forms.ListBox + Me.lbInstructions = New System.Windows.Forms.Label + Me.cbGuess = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'oMenu + ' + Me.oMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1}) + ' + 'MenuItem1 + ' + Me.MenuItem1.Index = 0 + Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mNew, Me.MenuItem2, Me.mExit}) + Me.MenuItem1.Text = "&File" + ' + 'mNew + ' + Me.mNew.Index = 0 + Me.mNew.Text = "&New" + ' + 'MenuItem2 + ' + Me.MenuItem2.Index = 1 + Me.MenuItem2.Text = "-" + ' + 'mExit + ' + Me.mExit.Index = 2 + Me.mExit.Text = "E&xit" + ' + 'lbClues + ' + Me.lbClues.AllowDrop = True + Me.lbClues.BackColor = System.Drawing.Color.Black + Me.lbClues.BorderStyle = System.Windows.Forms.BorderStyle.None + Me.lbClues.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lbClues.ForeColor = System.Drawing.Color.LightGray + Me.lbClues.ItemHeight = 16 + Me.lbClues.Location = New System.Drawing.Point(144, 32) + Me.lbClues.Name = "lbClues" + Me.lbClues.Size = New System.Drawing.Size(296, 272) + Me.lbClues.TabIndex = 0 + ' + 'lbInstructions + ' + Me.lbInstructions.ForeColor = System.Drawing.Color.LightGray + Me.lbInstructions.Location = New System.Drawing.Point(176, 312) + Me.lbInstructions.Name = "lbInstructions" + Me.lbInstructions.Size = New System.Drawing.Size(224, 32) + Me.lbInstructions.TabIndex = 1 + Me.lbInstructions.Text = "Drag and Drop tiles to switch positions. Right button drag swaps color only" + Me.lbInstructions.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'cbGuess + ' + Me.cbGuess.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.cbGuess.ForeColor = System.Drawing.SystemColors.Control + Me.cbGuess.Location = New System.Drawing.Point(16, 320) + Me.cbGuess.Name = "cbGuess" + Me.cbGuess.Size = New System.Drawing.Size(64, 23) + Me.cbGuess.TabIndex = 2 + Me.cbGuess.Text = "Guess" + ' + 'fDeductile + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.BackColor = System.Drawing.Color.Black + Me.ClientSize = New System.Drawing.Size(454, 359) + Me.Controls.Add(Me.cbGuess) + Me.Controls.Add(Me.lbInstructions) + Me.Controls.Add(Me.lbClues) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Menu = Me.oMenu + Me.Name = "fDeductile" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "DeducTile Reasoning" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private oGT As GameTimer + Private FTiles As ArrayList + Private FPuzGen As DeductileReasoning.PuzzleGenerator + + Private FDragRect As Rectangle + Private FDragShape As ColoredShape + Private FDidRight As Boolean + + Private Sub mExit_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles mExit.Click + Me.Close() + End Sub + + Private Sub StartGame() + + Dim oShape As ColoredShape + + Dim oRand As New Random + Dim i As Integer + + Me.Cursor = Cursors.WaitCursor + oGT.StopTimer() + + If Not FTiles Is Nothing Then + For Each oShape In FTiles + Me.Controls.Remove(oShape) + Next + End If + + FTiles = New ArrayList + + For i = 0 To 3 + oShape = New ColoredShape(i, i) + With oShape + .Backwards = False + .Width = 64 + .Location = New Point(16, 32 + (i * 64)) + .AllowDrop = True + AddHandler .MouseDown, AddressOf ShapeMouseDown + AddHandler .MouseMove, AddressOf ShapeMouseMove + AddHandler .MouseUp, AddressOf ShapeMouseUp + AddHandler .DragOver, AddressOf ShapeDragOver + AddHandler .DragDrop, AddressOf ShapeDragDrop + End With + + 'adding a reference to two places, the form and to an arraylist + FTiles.Add(oShape) + Me.Controls.Add(oShape) + + Next + + FPuzGen = New DeductileReasoning.PuzzleGenerator + FPuzGen.PopulateListBox(lbClues) + + oGT.StartAt = New TimeSpan(0, 3, 0) + oGT.StartTimer() + Me.Cursor = Cursors.Default + + End Sub + + Private Sub fDeductile_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load + + oGT = New GameTimer + With oGT + .Dock = DockStyle.Top + .Height = 32 + .Font = New Font("Tahoma", 16, FontStyle.Italic Or FontStyle.Bold) + .ForeColor = Color.LightGray + .StartAt = New TimeSpan(0, 3, 0) + AddHandler .TimesUp, AddressOf TimerDone + AddHandler .SecondsChanged, AddressOf TimerSeconds + End With + + Me.Controls.Add(oGT) + StartGame() + End Sub + + Private Sub TimerDone(ByVal sender As Object) + If MsgBox("You lose, play again?", _ + MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Try Again") = MsgBoxResult.Yes Then + + StartGame() + Else + Me.Close() + End If + End Sub + + Private Sub TimerSeconds(ByVal sender As Object, ByVal t As TimeSpan) + + If t.TotalSeconds <= 10 Then + CType(sender, GameTimer).ForeColor = Color.Red + Else + CType(sender, GameTimer).ForeColor = Color.LightGray + End If + + End Sub + + Private Sub mNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mNew.Click + + If MsgBox("Restart Game?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, _ + "Restart") = MsgBoxResult.Yes Then + + Call StartGame() + End If + + End Sub + + Private Sub ShapeMouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) + + Dim dragSize As Size = SystemInformation.DragSize + + FDragRect = New Rectangle(New Point(e.X - (dragSize.Width / 2), _ + e.Y - (dragSize.Height / 2)), dragSize) + + + End Sub + + Private Sub ShapeMouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) + + FDragRect = Rectangle.Empty + FDragShape = Nothing + + End Sub + + Private Sub ShapeMouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) + + If ((e.Button And MouseButtons.Left) = MouseButtons.Left) Or _ + ((e.Button And MouseButtons.Right) = MouseButtons.Right) Then + + ' If the mouse moves outside the rectangle, start the drag. + If (Rectangle.op_Inequality(FDragRect, Rectangle.Empty) And _ + Not FDragRect.Contains(e.X, e.Y)) Then + + FDidRight = ((e.Button And MouseButtons.Right) = MouseButtons.Right) + FDragShape = sender + + sender.DoDragDrop(sender, DragDropEffects.All) + + End If + End If + End Sub + + Private Sub ShapeDragOver(ByVal sender As Object, ByVal e As DragEventArgs) + e.Effect = DragDropEffects.All + End Sub + + Private Sub ShapeDragDrop(ByVal sender As Object, ByVal e As DragEventArgs) + + Dim oDest As ColoredShape = CType(sender, ColoredShape) + + If oDest.Equals(FDragShape) Then Exit Sub + + If Not FDidRight Then + 'left drag, simply swap positions + Dim p As Point + + p = FDragShape.Location + FDragShape.Location = oDest.Location + oDest.Location = p + Else + 'right drag, swap colors + Dim c As Color + + c = FDragShape.Color + FDragShape.Color = oDest.Color + oDest.Color = c + + oDest.Invalidate() + FDragShape.Invalidate() + End If + End Sub + + Private Sub fDeductile_Closing(ByVal sender As Object, _ + ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing + + If oGT.Enabled Then + If MsgBox("End Game?", MsgBoxStyle.YesNo _ + Or MsgBoxStyle.Question, "Confirm?") = MsgBoxResult.No Then e.Cancel = True + End If + + End Sub + + Private Sub cbGuess_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGuess.Click + + Dim f As ColoredShape = FTiles.Item(0) + + 'FTiles.Sort() 'calls compareTo + FTiles.Sort() + + If FPuzGen.IsSolution(FTiles.Item(0), FTiles.Item(1), _ + FTiles.Item(2), FTiles.Item(3)) Then + + oGT.StopTimer() + If MsgBox("You win, play again?", _ + MsgBoxStyle.YesNo Or MsgBoxStyle.Question, "Try Again") = MsgBoxResult.Yes Then + StartGame() + Else + Me.Close() + End If + Else + oGT.AddTime(New TimeSpan(0, 0, -5)) + End If + End Sub + +End Class diff --git a/Files/ShapeTileGames/fLoseYourMind.resx b/Files/ShapeTileGames/fLoseYourMind.resx new file mode 100644 index 0000000..b248de7 --- /dev/null +++ b/Files/ShapeTileGames/fLoseYourMind.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + True + + + Assembly + + + 8, 8 + + + True + + + Assembly + + + False + + + Assembly + + + Assembly + + + True + + + False + + + True + + + Assembly + + + 8, 8 + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + fLoseYourMind + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/ShapeTileGames/fLoseYourMind.vb b/Files/ShapeTileGames/fLoseYourMind.vb new file mode 100644 index 0000000..80202a7 --- /dev/null +++ b/Files/ShapeTileGames/fLoseYourMind.vb @@ -0,0 +1,338 @@ +Imports ShapeTileGames.NewTile + +Public Class fLoseYourMind + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents pnTop As System.Windows.Forms.Panel + Friend WithEvents cbGuess As System.Windows.Forms.Button + Friend WithEvents pnBottom As System.Windows.Forms.Panel + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents lbInstructions As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.pnTop = New System.Windows.Forms.Panel + Me.cbGuess = New System.Windows.Forms.Button + Me.pnBottom = New System.Windows.Forms.Panel + Me.Label1 = New System.Windows.Forms.Label + Me.lbInstructions = New System.Windows.Forms.Label + Me.pnBottom.SuspendLayout() + Me.SuspendLayout() + ' + 'pnTop + ' + Me.pnTop.Dock = System.Windows.Forms.DockStyle.Top + Me.pnTop.Location = New System.Drawing.Point(0, 0) + Me.pnTop.Name = "pnTop" + Me.pnTop.Size = New System.Drawing.Size(292, 48) + Me.pnTop.TabIndex = 0 + ' + 'cbGuess + ' + Me.cbGuess.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.cbGuess.ForeColor = System.Drawing.SystemColors.Control + Me.cbGuess.Location = New System.Drawing.Point(216, 128) + Me.cbGuess.Name = "cbGuess" + Me.cbGuess.Size = New System.Drawing.Size(48, 23) + Me.cbGuess.TabIndex = 4 + Me.cbGuess.Text = "Guess" + ' + 'pnBottom + ' + Me.pnBottom.Controls.Add(Me.lbInstructions) + Me.pnBottom.Controls.Add(Me.Label1) + Me.pnBottom.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pnBottom.Location = New System.Drawing.Point(0, 579) + Me.pnBottom.Name = "pnBottom" + Me.pnBottom.Size = New System.Drawing.Size(292, 40) + Me.pnBottom.TabIndex = 9 + ' + 'Label1 + ' + Me.Label1.Dock = System.Windows.Forms.DockStyle.Bottom + Me.Label1.ForeColor = System.Drawing.Color.LightGray + Me.Label1.Location = New System.Drawing.Point(0, 24) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(292, 16) + Me.Label1.TabIndex = 10 + Me.Label1.Text = "Top row indicates Shape/Bottom indicates Color" + Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'lbInstructions + ' + Me.lbInstructions.Dock = System.Windows.Forms.DockStyle.Bottom + Me.lbInstructions.ForeColor = System.Drawing.Color.LightGray + Me.lbInstructions.Location = New System.Drawing.Point(0, 8) + Me.lbInstructions.Name = "lbInstructions" + Me.lbInstructions.Size = New System.Drawing.Size(292, 16) + Me.lbInstructions.TabIndex = 9 + Me.lbInstructions.Text = "Left/Right click to change Shape/Color" + Me.lbInstructions.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'fLoseYourMind + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.BackColor = System.Drawing.Color.Black + Me.ClientSize = New System.Drawing.Size(292, 619) + Me.Controls.Add(Me.pnBottom) + Me.Controls.Add(Me.cbGuess) + Me.Controls.Add(Me.pnTop) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Name = "fLoseYourMind" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Lose Your Mind" + Me.pnBottom.ResumeLayout(False) + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private FSolution As LoseYourMind.TileCollection + Private FCurrentGuess As LoseYourMind.TileCollectionGuess + Private FGuesses As ArrayList + Private oWav As WavLibrary + + Private Const NUMTILES As Integer = 4 + Private Const TILESIZE As Integer = 48 + + Private Sub fLoseYourMind_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + Dim lb As Label + Dim i As Integer + + For i = 0 To 9 + lb = New Label + lb.Text = (i + 1) & "." + lb.TextAlign = ContentAlignment.MiddleRight + lb.Width = 24 + lb.Location = New Point(4, HeightFromTurnNumber(i) + TILESIZE - lb.Height) + lb.ForeColor = Color.LightGray + lb.BackColor = Color.Transparent + Me.Controls.Add(lb) + Next + + SetupWavLibrary() + StartGame() + End Sub + + Private Sub SetupWavLibrary() + + oWav = New WavLibrary + oWav.LoadFromResource("ShapeTileGames.die1.wav", "die1") + oWav.LoadFromResource("ShapeTileGames.8ping.wav", "8ping") + oWav.LoadFromResource("ShapeTileGames.ouch.wav", "ouch") + oWav.LoadFromResource("ShapeTileGames.ovation.wav", "ovation") + + End Sub + + + Private Function HeightFromTurnNumber(ByVal iTurn As Integer) As Integer + Return Me.Height - (iTurn * TILESIZE) - (TILESIZE * 2) - pnBottom.Height + End Function + + Private Sub ShapeMouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) + + Dim oShape As ColoredShape = sender + + If ((e.Button And MouseButtons.Left) = MouseButtons.Left) Then + oShape.ToggleShape() + oWav.Play("die1", 100) + End If + + If ((e.Button And MouseButtons.Right) = MouseButtons.Right) Then + oShape.ToggleColor() + oWav.Play("die1", 100) + End If + End Sub + + Private Sub cbGuess_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGuess.Click + + Dim oGH As LoseYourMind.GuessHintRenderer + Dim cMsg As String + + FGuesses.Add(FCurrentGuess) + FCurrentGuess.CheckAgainst(FSolution) + + oGH = New LoseYourMind.GuessHintRenderer(FCurrentGuess) + oGH.Location = cbGuess.Location + oGH.Size = New Size(54, 32) + Me.Controls.Add(oGH) + + If FCurrentGuess.Wins Then + oWav.Play("ovation", 100) + ShowSolution() + + cMsg = "Winnah, Winnah, Chicken Dinnah!" & Environment.NewLine + cMsg &= "Play again?" + If MsgBox(cMsg, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, "You win") = MsgBoxResult.Yes Then + Call StartGame() + Exit Sub + Else + Me.Close() + End If + + Else + If FGuesses.Count = 10 Then + oWav.Play("ouch", 100) + ShowSolution() + cMsg = "You Lose!" & Environment.NewLine + cMsg &= "Play again?" + If MsgBox(cMsg, MsgBoxStyle.Question Or MsgBoxStyle.YesNo, "You lose") = MsgBoxResult.Yes Then + Call StartGame() + Exit Sub + Else + Me.Close() + End If + + Else + oWav.Play("8ping", 100) + End If + cbGuess.Top -= TILESIZE + Call SetupGuess() + End If + + End Sub + + Private Sub ShowSolution() + Dim oShape As ColoredShape + + For Each oShape In FSolution + oShape.Backwards = False + Next + cbGuess.Visible = False + + End Sub + + + Private Sub DeleteOldGameControls() + + Dim o As Control + Dim i, iTop As Integer + + 'can't use a 'for each' with a remove + i = 0 + Do While i < Me.Controls.Count + o = Me.Controls.Item(i) + If TypeOf o Is LoseYourMind.GuessHintRenderer Then + Me.Controls.Remove(o) + ElseIf TypeOf o Is ColoredShape Then + Me.Controls.Remove(o) + Else + i += 1 + End If + Loop + + i = 0 + Do While i < pnTop.Controls.Count + o = pnTop.Controls.Item(i) + If TypeOf o Is ColoredShape Then + pnTop.Controls.Remove(o) + Else + i += 1 + End If + Loop + + + End Sub + + Private Sub StartGame() + + Dim oRand As New Random + Dim oShape As ColoredShape + Dim i, iTop As Integer + + DeleteOldGameControls() + + FGuesses = New ArrayList + cbGuess.Visible = True + + FSolution = New LoseYourMind.TileCollection + i = 0 + Do + oShape = New ColoredShape(oRand.Next(0, 4), oRand.Next(0, 4)) + oShape.Backwards = True + oShape.Width = TILESIZE + oShape.Left = 32 + (i * oShape.Width) + + FSolution.Add(oShape) + pnTop.Controls.Add(oShape) + i += 1 + Loop Until FSolution.Count = NUMTILES + + iTop = HeightFromTurnNumber(0) + cbGuess.Location = New Point((TILESIZE * NUMTILES) + 40, iTop + 8) + + Call SetupGuess() + End Sub + + Private Sub SetupGuess() + + Dim oShape As ColoredShape + Dim oTC As New LoseYourMind.TileCollectionGuess + Dim o As Control + Dim i, iTop As Integer + + 'create 4 tiles for guessing, put in a guess object. + + 'remove clicking ability on all shapes + For Each o In Me.Controls + If TypeOf o Is ColoredShape Then + RemoveHandler o.MouseDown, AddressOf ShapeMouseDown + End If + Next + + FCurrentGuess = New LoseYourMind.TileCollectionGuess + + iTop = HeightFromTurnNumber(FGuesses.Count) + Do + oShape = New ColoredShape(i, i) + With oShape + .Location = New Point(32 + (i * TILESIZE), iTop) + .Width = TILESIZE + .Backwards = False + + 'copy from guess before + If FGuesses.Count > 0 Then + oTC = FGuesses.Item(FGuesses.Count - 1) + .CopyFrom(oTC.Item(i)) 'copies shape and color + End If + AddHandler .MouseDown, AddressOf ShapeMouseDown + End With + Me.Controls.Add(oShape) + FCurrentGuess.Add(oShape) + + i += 1 + Loop Until i >= NUMTILES + + End Sub +End Class diff --git a/Files/ShapeTileGames/fMain.resx b/Files/ShapeTileGames/fMain.resx new file mode 100644 index 0000000..a3bac4f --- /dev/null +++ b/Files/ShapeTileGames/fMain.resx @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + fMain + + + Assembly + + \ No newline at end of file diff --git a/Files/ShapeTileGames/fMain.vb b/Files/ShapeTileGames/fMain.vb new file mode 100644 index 0000000..b10fcca --- /dev/null +++ b/Files/ShapeTileGames/fMain.vb @@ -0,0 +1,126 @@ +Imports System.Drawing.Drawing2D + +Public Class fMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents cbCon As System.Windows.Forms.Button + Friend WithEvents cbDeduc As System.Windows.Forms.Button + Friend WithEvents cbLose As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.cbCon = New System.Windows.Forms.Button + Me.cbDeduc = New System.Windows.Forms.Button + Me.cbLose = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'cbCon + ' + Me.cbCon.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.cbCon.Location = New System.Drawing.Point(36, 24) + Me.cbCon.Name = "cbCon" + Me.cbCon.Size = New System.Drawing.Size(120, 23) + Me.cbCon.TabIndex = 0 + Me.cbCon.Text = "Concentration" + ' + 'cbDeduc + ' + Me.cbDeduc.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.cbDeduc.Location = New System.Drawing.Point(36, 56) + Me.cbDeduc.Name = "cbDeduc" + Me.cbDeduc.Size = New System.Drawing.Size(120, 23) + Me.cbDeduc.TabIndex = 1 + Me.cbDeduc.Text = "Deductile Reasoning" + ' + 'cbLose + ' + Me.cbLose.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.cbLose.Location = New System.Drawing.Point(36, 88) + Me.cbLose.Name = "cbLose" + Me.cbLose.Size = New System.Drawing.Size(120, 23) + Me.cbLose.TabIndex = 2 + Me.cbLose.Text = "Lose Your Mind" + ' + 'fMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(192, 171) + Me.Controls.Add(Me.cbLose) + Me.Controls.Add(Me.cbDeduc) + Me.Controls.Add(Me.cbCon) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "fMain" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "ShapeTile Games" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub ConcenClick(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbCon.Click + + Dim f As New fConcentration + f.ShowDialog() + + End Sub + + Private Sub DeducClick(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbDeduc.Click + + Dim f As New fDeductile + f.ShowDialog() + + End Sub + + Private Sub cbLose_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbLose.Click + + Dim f As New fLoseYourMind + f.ShowDialog() + + End Sub + + Private Sub fMain_Paint(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint + + Dim b As LinearGradientBrush + + b = New LinearGradientBrush(ClientRectangle, _ + Color.Red, Color.Black, LinearGradientMode.Vertical) + + e.Graphics.FillRectangle(b, ClientRectangle) + + End Sub + +End Class diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.ColoredShape.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.ColoredShape.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.ColoredShape.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.GameTimer.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.GameTimer.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.GameTimer.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.OldColoredShape.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.OldColoredShape.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.OldColoredShape.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.OldTile.ColoredShape.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.OldTile.ColoredShape.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.OldTile.ColoredShape.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.ShapeTile3.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.ShapeTile3.resources new file mode 100644 index 0000000..d42e555 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.ShapeTile3.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.exe b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.exe new file mode 100644 index 0000000..5a35b00 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.exe differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fConcentration.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fConcentration.resources new file mode 100644 index 0000000..8f921d0 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fConcentration.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fDeductile.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fDeductile.resources new file mode 100644 index 0000000..8b2b9af Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fDeductile.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fLoseYourMind.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fLoseYourMind.resources new file mode 100644 index 0000000..e71816c Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fLoseYourMind.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fMain.resources b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fMain.resources new file mode 100644 index 0000000..24e36e4 Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.fMain.resources differ diff --git a/Files/ShapeTileGames/obj/Debug/ShapeTileGames.pdb b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.pdb new file mode 100644 index 0000000..af6b4ef Binary files /dev/null and b/Files/ShapeTileGames/obj/Debug/ShapeTileGames.pdb differ diff --git a/Files/SpaceRocks/AssemblyInfo.vb b/Files/SpaceRocks/AssemblyInfo.vb new file mode 100644 index 0000000..fc90682 --- /dev/null +++ b/Files/SpaceRocks/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/SpaceRocks/SpaceRocks.sln b/Files/SpaceRocks/SpaceRocks.sln new file mode 100644 index 0000000..65572f8 --- /dev/null +++ b/Files/SpaceRocks/SpaceRocks.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SpaceRocks", "SpaceRocks.vbproj", "{C29A52E9-2EB5-4452-981A-DF356D1438C7}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {C29A52E9-2EB5-4452-981A-DF356D1438C7}.Debug.ActiveCfg = Debug|.NET + {C29A52E9-2EB5-4452-981A-DF356D1438C7}.Debug.Build.0 = Debug|.NET + {C29A52E9-2EB5-4452-981A-DF356D1438C7}.Release.ActiveCfg = Release|.NET + {C29A52E9-2EB5-4452-981A-DF356D1438C7}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/SpaceRocks/SpaceRocks.suo b/Files/SpaceRocks/SpaceRocks.suo new file mode 100644 index 0000000..68e220f Binary files /dev/null and b/Files/SpaceRocks/SpaceRocks.suo differ diff --git a/Files/SpaceRocks/SpaceRocks.vbproj b/Files/SpaceRocks/SpaceRocks.vbproj new file mode 100644 index 0000000..6e1972e --- /dev/null +++ b/Files/SpaceRocks/SpaceRocks.vbproj @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/SpaceRocks/SpaceRocks.vbproj.user b/Files/SpaceRocks/SpaceRocks.vbproj.user new file mode 100644 index 0000000..2864829 --- /dev/null +++ b/Files/SpaceRocks/SpaceRocks.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/SpaceRocks/bin/SpaceRocks.exe b/Files/SpaceRocks/bin/SpaceRocks.exe new file mode 100644 index 0000000..9f4aab2 Binary files /dev/null and b/Files/SpaceRocks/bin/SpaceRocks.exe differ diff --git a/Files/SpaceRocks/bin/SpaceRocks.pdb b/Files/SpaceRocks/bin/SpaceRocks.pdb new file mode 100644 index 0000000..c1267b7 Binary files /dev/null and b/Files/SpaceRocks/bin/SpaceRocks.pdb differ diff --git a/Files/SpaceRocks/dxBullets.vb b/Files/SpaceRocks/dxBullets.vb new file mode 100644 index 0000000..0e23d25 --- /dev/null +++ b/Files/SpaceRocks/dxBullets.vb @@ -0,0 +1,186 @@ +Imports Microsoft.DirectX +Imports Microsoft.DirectX.DirectDraw + +Namespace dxWorld + + Public Class dxBulletSprite + Inherits dxSprite + + Private FFrameAliveCount As Integer + + Sub New() + MyBase.New() + FBoundingBox = New Rectangle(10, 10, 12, 12) + End Sub + + Private FVelocity As PointF + Property Velocity() As PointF + Get + Return FVelocity + End Get + Set(ByVal Value As PointF) + FVelocity = Value + End Set + End Property + + Public Overrides Sub Move() + Location = New PointF(Location.X + Velocity.X, Location.Y + Velocity.Y) + FFrameAliveCount += 1 + End Sub + + ReadOnly Property pFrameAliveCount() As Integer + Get + Return FFrameAliveCount + End Get + End Property + End Class + + Class dxBulletCollection + + Private FBullets As ArrayList + Private FSurface As Surface + Private FShowBoundingBox As Boolean + Private FRand As New Random + + Sub New() + MyBase.New() + FBullets = New ArrayList + End Sub + + ReadOnly Property pCount() As Integer + Get + Try + Return FBullets.Count + Catch + Return 0 + End Try + End Get + End Property + + Property pShowBoundingBox() As Boolean + Get + Return FShowBoundingBox + End Get + Set(ByVal Value As Boolean) + + Dim aBullet As dxBulletSprite + + FShowBoundingBox = Value + + For Each aBullet In FBullets + aBullet.pShowBoundingBox = Value + Next + + End Set + End Property + + Public Sub RestoreSurfaces(ByVal oDraw As Microsoft.DirectX.DirectDraw.Device) + + Dim oCK As New ColorKey + oCK.ColorSpaceLowValue = RGB(255, 255, 255) + oCK.ColorSpaceHighValue = RGB(255, 255, 255) + + Dim oSurf As Microsoft.DirectX.DirectDraw.Surface + + Dim a As Reflection.Assembly = _ + System.Reflection.Assembly.GetExecutingAssembly() + + If Not FSurface Is Nothing Then + FSurface.Dispose() + FSurface = Nothing + End If + + FSurface = New Surface(a.GetManifestResourceStream("SpaceRocks.Bullet.bmp"), _ + New SurfaceDescription, oDraw) + + FSurface.SetColorKey(ColorKeyFlags.SourceDraw, oCK) + + End Sub + + Public Sub Shoot(ByVal p As PointF, ByVal iAngle As Integer) + + If FBullets.Count >= 4 Then Exit Sub + + Dim dx, dy As Single + Dim aBullet As dxBulletSprite + + aBullet = New dxBulletSprite + With aBullet + .pShowBoundingBox = Me.pShowBoundingBox + .Location = p + + dy = -Math.Sin(iAngle * Math.PI / 180) * 6 + dx = Math.Cos(iAngle * Math.PI / 180) * 6 + + .Velocity = New PointF(dx, dy) + .Move() + + AddHandler .GetSurfaceData, AddressOf GetBulletSurfaceData + End With + FBullets.Add(aBullet) + + End Sub + + Private Sub GetBulletSurfaceData(ByVal aSprite As dxSprite, _ + ByRef oSurf As Surface, ByRef oRect As Rectangle) + + oSurf = FSurface + oRect = New Rectangle(0, 0, 31, 31) + + End Sub + + Public Sub Move() + + Dim aBullet As dxBulletSprite + Dim i As Integer + + For Each aBullet In FBullets + aBullet.Move() + Next + + 'remove bullets on the screen too long. + 'have to use a loop so you don't skip over when deleting + i = 0 + Do While i < FBullets.Count + aBullet = FBullets.Item(i) + If aBullet.pFrameAliveCount >= 100 Then + FBullets.Remove(aBullet) + Else + i = i + 1 + End If + Loop + + End Sub + + Public Sub Draw(ByVal oSurf As Microsoft.DirectX.DirectDraw.Surface) + + Dim aBullet As dxBulletSprite + + For Each aBullet In FBullets + aBullet.Draw(oSurf) + Next + + End Sub + + Public Sub BreakRocks(ByVal FRocks As dxRockCollection) + + Dim aBullet As dxBulletSprite + Dim i As Integer + + 'check each bullet to see if it hits a rock + 'have to use a loop so you don't skip over when deleting + i = 0 + Do While i < FBullets.Count + aBullet = FBullets.Item(i) + If FRocks.CollidingWith(aBullet.WorldBoundingBox, bBreakRock:=True) Then + FBullets.Remove(aBullet) + Else + i = i + 1 + End If + Loop + + End Sub + + End Class + +End Namespace diff --git a/Files/SpaceRocks/dxRocks.vb b/Files/SpaceRocks/dxRocks.vb new file mode 100644 index 0000000..c1d1ad8 --- /dev/null +++ b/Files/SpaceRocks/dxRocks.vb @@ -0,0 +1,345 @@ +Imports Microsoft.DirectX +Imports Microsoft.DirectX.DirectDraw + +Namespace dxWorld + + Public Enum dxRockSize + rsLarge = 0 + rsMed = 1 + rsSmall = 2 + End Enum + + Public Class dxRockSprite + Inherits dxSprite + + Public Event RockBroken(ByVal aRock As dxRockSprite) + + Const MAXV As Single = 7.0 + + Private FFrameCount As Integer + Private FRockSize As dxRockSize + Private FRotSpeed As Integer '0,1 or 2 + Private FAlternateModel As Boolean 'first or second graphic + Private FSpinReverse As Boolean + Private FDir As Integer = 1 + + Property pAlternateModel() As Boolean + Get + Return FAlternateModel + End Get + Set(ByVal Value As Boolean) + FAlternateModel = Value + End Set + End Property + + Property pSpinReverse() As Boolean + Get + Return FSpinReverse + End Get + Set(ByVal Value As Boolean) + FSpinReverse = Value + FDir = IIf(Value, -1, 1) + End Set + End Property + + Property pRockSize() As dxRockSize + Get + Return FRockSize + End Get + Set(ByVal Value As dxRockSize) + FRockSize = Value + + Select Case FRockSize + Case dxRockSize.rsLarge + FBoundingBox = New Rectangle(8, 21, 78, 60) + Case dxRockSize.rsMed + FBoundingBox = New Rectangle(5, 17, 52, 40) + Case dxRockSize.rsSmall + FBoundingBox = New Rectangle(3, 7, 26, 20) + End Select + End Set + End Property + + Property pRotSpeed() As Integer + Get + Return FRotSpeed + End Get + Set(ByVal Value As Integer) + If Value < 0 Or Value > 2 Then + Throw New Exception("invalid rock rotation speed (0-2)") + Else + FRotSpeed = Value + End If + End Set + End Property + + Public Overrides Sub Move() + + FFrameCount += 1 + + If FFrameCount Mod 3 <= pRotSpeed Then + Frame = (Frame + FDir) + If Frame < 0 Then Frame += 36 + If Frame > 35 Then Frame -= 36 + End If + + Location = New PointF(Location.X + Velocity.X, Location.Y + Velocity.Y) + End Sub + + Private FVelocity As PointF + Property Velocity() As PointF + Get + Return FVelocity + End Get + Set(ByVal Value As PointF) + FVelocity = Value + + If FVelocity.X < -MAXV Then FVelocity.X = -MAXV + If FVelocity.X > MAXV Then FVelocity.X = MAXV + + If FVelocity.Y < -MAXV Then FVelocity.Y = -MAXV + If FVelocity.Y > MAXV Then FVelocity.Y = MAXV + + End Set + End Property + + 'runs when rock shot + Public Sub Break() + 'notify the collection so he can split me into 2 + RaiseEvent RockBroken(Me) + End Sub + + End Class + + Class dxRockCollection + + Private FRocks As ArrayList + Private FRockSurfaces As ArrayList + Private FShowBoundingBox As Boolean + Private FRand As New Random + Private FRocksLastTime As Integer = 3 + + Sub New() + MyBase.New() + FRocks = New ArrayList + FRockSurfaces = New ArrayList + End Sub + + ReadOnly Property pCount() As Integer + Get + Try + Return FRocks.Count + Catch + Return 0 + End Try + End Get + End Property + + Property pShowBoundingBox() As Boolean + Get + Return FShowBoundingBox + End Get + Set(ByVal Value As Boolean) + + Dim aRock As dxRockSprite + + FShowBoundingBox = Value + + For Each aRock In FRocks + aRock.pShowBoundingBox = Value + Next + + End Set + End Property + + Public Sub RestoreSurfaces(ByVal oDraw As Microsoft.DirectX.DirectDraw.Device) + + Dim oCK As New ColorKey + oCK.ColorSpaceLowValue = RGB(255, 255, 255) + oCK.ColorSpaceHighValue = RGB(255, 255, 255) + + Dim i As Integer + Dim cName As String + Dim oSurf As Microsoft.DirectX.DirectDraw.Surface + + Dim a As Reflection.Assembly = _ + System.Reflection.Assembly.GetExecutingAssembly() + + Do While FRockSurfaces.Count > 1 + oSurf = FRockSurfaces.Item(0) + oSurf.Dispose() + oSurf = Nothing + Loop + + 'load the bitmaps + For i = 0 To 5 + + cName = "SpaceRocks.Rock" + Select Case i + Case 0 : cName &= "ABig" + Case 1 : cName &= "AMed" + Case 2 : cName &= "ASmall" + Case 3 : cName &= "BBig" + Case 4 : cName &= "BMed" + Case 5 : cName &= "BSmall" + End Select + cName &= ".bmp" + + oSurf = New Surface(a.GetManifestResourceStream(cName), _ + New SurfaceDescription, oDraw) + oSurf.SetColorKey(ColorKeyFlags.SourceDraw, oCK) + FRockSurfaces.Add(oSurf) + + Next + + + End Sub + + Private Sub AddRocks(ByVal iNum As Integer) + + Dim i As Integer + For i = 1 To iNum + AddRock() + Next + + End Sub + + 'adds a large rock to a random edge + Private Overloads Function AddRock() + + Dim oPt As PointF + 'start location along the edges + + Select Case FRand.Next(0, Integer.MaxValue) Mod 4 + Case 0 + oPt = New PointF(0, FRand.Next(0, Integer.MaxValue) Mod HGT) + Case 1 + oPt = New PointF(WID, FRand.Next(0, Integer.MaxValue) Mod HGT) + Case 2 + oPt = New PointF(FRand.Next(0, Integer.MaxValue) Mod WID, 0) + Case 3 + oPt = New PointF(FRand.Next(0, Integer.MaxValue) Mod WID, HGT) + End Select + + Return AddRock(dxRockSize.rsLarge, oPt) + End Function + + Private Overloads Function AddRock(ByVal pSize As dxRockSize, _ + ByVal p As PointF) As dxRockSprite + + Dim aRock As dxRockSprite + + aRock = New dxRockSprite + With aRock + .pShowBoundingBox = Me.pShowBoundingBox + .pAlternateModel = FRand.Next(0, Integer.MaxValue) Mod 2 = 0 + .pSpinReverse = FRand.Next(0, Integer.MaxValue) Mod 2 = 0 + .pRotSpeed = FRand.Next(0, Integer.MaxValue) Mod 3 + .pRockSize = pSize + Select Case pSize + Case dxRockSize.rsLarge + .Size = New Size(96, 96) + Case dxRockSize.rsMed + .Size = New Size(64, 64) + Case dxRockSize.rsSmall + .Size = New Size(32, 32) + End Select + + .Location = p + + Do 'no straight up/down or left/right + .Velocity = New PointF(FRand.Next(-3, 3), FRand.Next(-3, 3)) + Loop Until .Velocity.X <> 0 And .Velocity.Y <> 0 + + .Move() 'the first move makes sure they're off the edge + + AddHandler .GetSurfaceData, AddressOf GetRockSurfaceData + AddHandler .RockBroken, AddressOf RockBroken + End With + FRocks.Add(aRock) + End Function + + Private Sub GetRockSurfaceData(ByVal aSprite As dxSprite, _ + ByRef oSurf As Surface, ByRef oRect As Rectangle) + + Dim aRock As dxRockSprite = CType(aSprite, dxRockSprite) + Dim iIndex As Integer + + iIndex = IIf(aRock.pAlternateModel, 3, 0) + Select Case aRock.pRockSize + Case dxRockSize.rsLarge + 'nothing + Case dxRockSize.rsMed + iIndex += 1 + Case dxRockSize.rsSmall + iIndex += 2 + End Select + + oSurf = CType(FRockSurfaces.Item(iIndex), Surface) + oRect = New Rectangle((aRock.Frame Mod 6) * aRock.Size.Width, _ + (aRock.Frame \ 6) * aRock.Size.Height, aRock.Size.Width, aRock.Size.Height) + + End Sub + + Public Sub Move() + + Dim aRock As dxRockSprite + + If FRocks.Count = 0 Then + FRocksLastTime += 1 + AddRocks(FRocksLastTime) + End If + + For Each aRock In FRocks + aRock.Move() + Next + + + End Sub + + Public Sub Draw(ByVal oSurf As Microsoft.DirectX.DirectDraw.Surface) + + Dim aRock As dxRockSprite + + For Each aRock In FRocks + aRock.Draw(oSurf) + Next + + End Sub + + Private Sub RockBroken(ByVal aRock As dxRockSprite) + + Select Case aRock.pRockSize + Case dxRockSize.rsLarge + AddRock(dxRockSize.rsMed, aRock.Location) + AddRock(dxRockSize.rsMed, aRock.Location) + + Case dxRockSize.rsMed + AddRock(dxRockSize.rsSmall, aRock.Location) + AddRock(dxRockSize.rsSmall, aRock.Location) + + Case dxRockSize.rsSmall + 'nothing + End Select + FRocks.Remove(aRock) + + End Sub + + Public Function CollidingWith(ByVal aRect As Rectangle, ByVal bBreakRock As Boolean) As Boolean + + Dim aRock As dxRockSprite + + For Each aRock In FRocks + If aRock.WorldBoundingBox.IntersectsWith(aRect) Then + If bBreakRock Then + aRock.Break() + End If + Return True + End If + Next + + Return False + End Function + End Class + +End Namespace diff --git a/Files/SpaceRocks/dxShipSprite.vb b/Files/SpaceRocks/dxShipSprite.vb new file mode 100644 index 0000000..8a098ed --- /dev/null +++ b/Files/SpaceRocks/dxShipSprite.vb @@ -0,0 +1,271 @@ +Imports Microsoft.DirectX +Imports Microsoft.DirectX.DirectDraw + +Namespace dxWorld + + Public Enum ShipStatus + ssAlive = 0 + ssDying = 1 + ssDead = 2 + End Enum + + Public Class dxShipSprite + Inherits dxSprite + + Private FShipSurfaceOff As Microsoft.DirectX.DirectDraw.Surface + Private FShipSurfaceOn As Microsoft.DirectX.DirectDraw.Surface + Private FShipSurfaceBoom As Microsoft.DirectX.DirectDraw.Surface + + Private FSkipFrame As Integer + Private FAngle As Integer + Private FLivesLeft As Integer = 3 + Private oRand As New Random + + Const MAXA As Single = 3.5 + Const MAXV As Single = 4.0 + + Public Sub New() + MyBase.new() + FBoundingBox = New Rectangle(27, 28, 42, 42) + AddHandler Me.GetSurfaceData, AddressOf GetShipSurfaceData + End Sub + + Private FIsTurningLeft As Boolean + Property IsTurningLeft() As Boolean + Get + Return FIsTurningLeft + End Get + Set(ByVal Value As Boolean) + FIsTurningLeft = Value + End Set + End Property + + Private FIsTurningRight As Boolean + Property IsTurningRight() As Boolean + Get + Return FIsTurningRight + End Get + Set(ByVal Value As Boolean) + FIsTurningRight = Value + End Set + End Property + + Private FThrustersOn As Boolean + Property ThrustersOn() As Boolean + Get + Return FThrustersOn + End Get + Set(ByVal Value As Boolean) + FThrustersOn = Value + End Set + End Property + + Private FStatus As ShipStatus + ReadOnly Property Status() As ShipStatus + Get + Return FStatus + End Get + End Property + + Public Sub KillMe() + If FStatus = ShipStatus.ssAlive Then + Frame = -1 'reset frame to 0 for explosion + FStatus = ShipStatus.ssDying + FLivesLeft -= 1 + End If + End Sub + + Public Sub BringMeToLife(ByVal x As Integer, ByVal y As Integer) + If FLivesLeft > 0 Then + Me.Frame = 0 + Me.Location = New PointF(x, y) + Me.Velocity = New PointF(0, 0) + FStatus = ShipStatus.ssAlive + End If + End Sub + + ReadOnly Property LivesLeft() As Integer + Get + Return FLivesLeft + End Get + End Property + + Private FVelocity As PointF + Property Velocity() As PointF + Get + Return FVelocity + End Get + Set(ByVal Value As PointF) + FVelocity = Value + + If FVelocity.X < -MAXV Then FVelocity.X = -MAXV + If FVelocity.X > MAXV Then FVelocity.X = MAXV + + If FVelocity.Y < -MAXV Then FVelocity.Y = -MAXV + If FVelocity.Y > MAXV Then FVelocity.Y = MAXV + + End Set + End Property + + Private FAcceleration As Single = 0 + Property Acceleration() As Single + Get + Return FAcceleration + End Get + Set(ByVal Value As Single) + FAcceleration = Value + + If FAcceleration < 0 Then FAcceleration = 0 + If FAcceleration > MAXA Then FAcceleration = MAXA + End Set + End Property + + Private Sub Turn() + Dim iTemp As Integer = Me.Frame + + If Not Me.Status = ShipStatus.ssAlive Then Exit Sub + + 'not moving! + If IsTurningLeft And IsTurningRight Then + Exit Sub + End If + + If IsTurningRight Then + iTemp -= 1 + If iTemp < 0 Then iTemp += 24 + ElseIf IsTurningLeft Then + iTemp = (iTemp + 1) Mod 24 + End If + + Frame = iTemp + + End Sub + + Public Overrides Sub Move() + + Dim dx, dy As Single + + 'we're only moving every x frames + FSkipFrame = (FSkipFrame + 1) Mod 1000 + If FSkipFrame Mod 3 = 0 Then + + Select Case Me.Status + Case ShipStatus.ssAlive + Turn() + + If ThrustersOn Then + Acceleration += 1 + + dy = -Math.Sin(FAngle * Math.PI / 180) * Acceleration + dx = Math.Cos(FAngle * Math.PI / 180) * Acceleration + + Velocity = New PointF(Velocity.X + dx, Velocity.Y + dy) + Else + Acceleration = 0 + End If + Case ShipStatus.ssDying + Frame += 1 + + Velocity = New PointF(0, 0) + Acceleration = 0 + + 'we're done drawing the boom + If Frame >= 6 Then + FStatus = ShipStatus.ssDead + End If + + Case ShipStatus.ssDead + 'nothing + End Select + + End If + + Location = New PointF(Location.X + Velocity.X, Location.Y + Velocity.Y) + + End Sub + + ReadOnly Property Angle() As Integer + Get + Return FAngle + End Get + End Property + + 'frame tied to Angle + Overrides Property Frame() As Integer + Get + Return MyBase.Frame + End Get + Set(ByVal Value As Integer) + MyBase.Frame = Value + FAngle = Frame * 15 + End Set + End Property + + 'we can keep surfaces in the ship sprite class because there's only one of them + Public Sub RestoreSurfaces(ByVal oDraw As Microsoft.DirectX.DirectDraw.Device) + + Dim oCK As New ColorKey + + Dim a As Reflection.Assembly = _ + System.Reflection.Assembly.GetExecutingAssembly() + + If Not FShipSurfaceOff Is Nothing Then + FShipSurfaceOff.Dispose() + FShipSurfaceOff = Nothing + End If + + FShipSurfaceOff = New Surface(a.GetManifestResourceStream( _ + "SpaceRocks.ShipNoFire.bmp"), New SurfaceDescription, oDraw) + FShipSurfaceOff.SetColorKey(ColorKeyFlags.SourceDraw, oCK) + + If Not FShipSurfaceOn Is Nothing Then + FShipSurfaceOn.Dispose() + FShipSurfaceOn = Nothing + End If + + FShipSurfaceOn = New Surface(a.GetManifestResourceStream( _ + "SpaceRocks.ShipFire.bmp"), New SurfaceDescription, oDraw) + FShipSurfaceOn.SetColorKey(ColorKeyFlags.SourceDraw, oCK) + + If Not FShipSurfaceBoom Is Nothing Then + FShipSurfaceBoom.Dispose() + FShipSurfaceBoom = Nothing + End If + + FShipSurfaceBoom = New Surface(a.GetManifestResourceStream( _ + "SpaceRocks.Boom.bmp"), New SurfaceDescription, oDraw) + FShipSurfaceBoom.SetColorKey(ColorKeyFlags.SourceDraw, oCK) + + End Sub + + Private Sub GetShipSurfaceData(ByVal aSprite As dxSprite, _ + ByRef oSurf As Surface, ByRef oRect As Rectangle) + + Dim aShip As dxShipSprite = CType(aSprite, dxShipSprite) + + Select Case aShip.Status + Case ShipStatus.ssDead + oSurf = Nothing + + Case ShipStatus.ssDying + oSurf = FShipSurfaceBoom + + Case ShipStatus.ssAlive + + If aShip.ThrustersOn AndAlso _ + oRand.Next(0, Integer.MaxValue) Mod 10 <> 0 Then + + oSurf = FShipSurfaceOn + Else + oSurf = FShipSurfaceOff + End If + + End Select + + oRect = New Rectangle((aShip.Frame Mod 6) * 96, (aShip.Frame \ 6) * 96, 96, 96) + + End Sub + + End Class + +End Namespace \ No newline at end of file diff --git a/Files/SpaceRocks/dxSprite.vb b/Files/SpaceRocks/dxSprite.vb new file mode 100644 index 0000000..a1f3efd --- /dev/null +++ b/Files/SpaceRocks/dxSprite.vb @@ -0,0 +1,209 @@ +Imports Microsoft.DirectX +Imports Microsoft.DirectX.DirectDraw +Imports System.Math + +Namespace dxWorld + + 'the base sprite class. contains information about position + 'and state + Public MustInherit Class dxSprite + + 'get the correct surface and drawing rectangle to use + Public Event GetSurfaceData(ByVal sender As dxSprite, _ + ByRef oSource As Microsoft.DirectX.DirectDraw.Surface, _ + ByRef oRect As Rectangle) + + Public MustOverride Sub Move() + + Private FLocation As PointF 'upper left corner + Property Location() As PointF + Get + Return FLocation + End Get + Set(ByVal Value As PointF) + FLocation = Value + + If FLocation.X <= -Size.Width Then + FLocation.X += WID + ElseIf FLocation.X >= WID Then + FLocation.X -= (WID + Size.Width - 1) + End If + + If FLocation.Y <= -Size.Height Then + FLocation.Y += (HGT + Size.Height) + ElseIf FLocation.Y >= HGT Then + FLocation.Y -= (HGT + Size.Height - 1) + End If + + End Set + End Property + + Private FSize As Size 'size of one frame + Property Size() As Size + Get + Return FSize + End Get + Set(ByVal Value As Size) + FSize = Value + End Set + End Property + + Private FFrame As Integer + Overridable Property Frame() As Integer + Get + Return FFrame + End Get + Set(ByVal Value As Integer) + FFrame = Value + End Set + End Property + + 'object-space, 0,0 = upper left corner of object + Protected FBoundingBox As Rectangle + ReadOnly Property BoundingBox() As Rectangle + Get + Return FBoundingBox + End Get + End Property + + 'translated to world coordinates and clipped + Protected FWBB As Rectangle + ReadOnly Property WorldBoundingBox() As Rectangle + Get + Return FWBB + End Get + End Property + + + Private FShowBoundingBox As Boolean = False + Property pShowBoundingBox() As Boolean + Get + Return FShowBoundingBox + End Get + Set(ByVal Value As Boolean) + FShowBoundingBox = Value + End Set + End Property + + ReadOnly Property Center() As PointF + Get + Return New PointF(Location.X + (Size.Width \ 2), _ + Location.Y + (Size.Height \ 2)) + End Get + End Property + + Public Sub Draw(ByVal oSurf As Microsoft.DirectX.DirectDraw.Surface) + + Dim oSource As Microsoft.DirectX.DirectDraw.Surface + Dim oRect As Rectangle + Dim oPt As Point + Dim iDiff As Integer + + RaiseEvent GetSurfaceData(Me, oSource, oRect) + + If oSource Is Nothing Then + Exit Sub + Else + Try + FWBB = Me.BoundingBox 'start w/ normal bbox + + 'start at the location + oPt = New Point(System.Math.Floor(Location.X), _ + System.Math.Floor(Location.Y)) + + If oPt.X < 0 Then + 'draw partial on left side + oRect = New Rectangle(oRect.Left - oPt.X, oRect.Top, _ + oRect.Width + oPt.X, oRect.Height) + + If oPt.X + FWBB.Left < 0 Then + + FWBB = New Rectangle(0, FWBB.Top, _ + FWBB.Width + (oPt.X + FWBB.Left), FWBB.Height) + + Else + + FWBB = New Rectangle(FWBB.Left + oPt.X, FWBB.Top, _ + FWBB.Width, FWBB.Height) + + End If + oPt.X = 0 + End If + + If oPt.Y < 0 Then + 'draw partial on top side + oRect = New Rectangle(oRect.Left, oRect.Top - oPt.Y, _ + oRect.Width, oRect.Height + oPt.Y) + + If oPt.Y + FWBB.Top < 0 Then + + FWBB = New Rectangle(FWBB.Left, 0, _ + FWBB.Width, FWBB.Height + (oPt.Y + FWBB.Top)) + + Else + + FWBB = New Rectangle(FWBB.Left, FWBB.Top + oPt.Y, _ + FWBB.Width, FWBB.Height) + + End If + + + oPt.Y = 0 + End If + + If oPt.X + oRect.Width > WID Then + 'draw partial on right side + oRect = New Rectangle(oRect.Left, oRect.Top, _ + WID - oPt.X, oRect.Height) + + If oPt.X + FWBB.Left + FWBB.Width > WID Then + + FWBB = New Rectangle(FWBB.Left, FWBB.Top, _ + WID - (oPt.X + FWBB.Left), FWBB.Height) + + End If + + End If + + If oPt.Y + oRect.Height > HGT Then + 'draw partial on bottom + oRect = New Rectangle(oRect.Left, oRect.Top, _ + oRect.Width, HGT - oPt.Y) + + If oPt.Y + FWBB.Top + FWBB.Height > HGT Then + + FWBB = New Rectangle(FWBB.Left, FWBB.Top, _ + FWBB.Width, HGT - (oPt.Y + FWBB.Top)) + + End If + + End If + + 'should never happen, just in case + If oRect.Width <= 0 Or oRect.Height <= 0 Then Return + + 'offset the bounding box by the world coordinates + FWBB.Offset(oPt.X, oPt.Y) + + 'draw the sprite + oSurf.DrawFast(oPt.X, oPt.Y, oSource, oRect, _ + DrawFastFlags.DoNotWait Or DrawFastFlags.SourceColorKey) + + 'draw the bounding box + If Me.pShowBoundingBox Then + oSurf.ForeColor = Color.Red + + oSurf.DrawBox(FWBB.Left, FWBB.Top, FWBB.Right, FWBB.Bottom) + + End If + + Catch oEx As Exception + Debug.WriteLine("--------------------------------------") + Debug.WriteLine(oEx.Message) + End Try + End If + + End Sub + End Class + +End Namespace \ No newline at end of file diff --git a/Files/SpaceRocks/dxWorld.vb b/Files/SpaceRocks/dxWorld.vb new file mode 100644 index 0000000..c6d4d33 --- /dev/null +++ b/Files/SpaceRocks/dxWorld.vb @@ -0,0 +1,361 @@ +Imports Microsoft.DirectX +Imports Microsoft.DirectX.DirectDraw +Imports Microsoft.DirectX.DirectInput + +Namespace dxWorld + + 'contains all the directx surface objects, and all logic for drawing + 'draws a black screen with text 'hit esc to end' + Public MustInherit Class dxWorld + + Private FFrm As Form + + Private FNeedToRestore As Boolean = False + + Protected oRand As New Random + Protected oDraw As Microsoft.DirectX.DirectDraw.Device + Protected oFront As Microsoft.DirectX.DirectDraw.Surface + Protected oBack As Microsoft.DirectX.DirectDraw.Surface + Protected oJoystick As Microsoft.DirectX.DirectInput.Device + + Public Sub New(ByVal f As Form) + MyBase.New() + + FFrm = f + FFrm.Cursor.Dispose() 'byebye cursor + AddHandler FFrm.KeyDown, AddressOf FormKeyDown + AddHandler FFrm.KeyUp, AddressOf FormKeyUp + AddHandler FFrm.Disposed, AddressOf FormDispose + + InitializeDirectDraw() + InitializeJoystick() + InitializeWorld() + + Do While FFrm.Created + DrawFrame() + Loop + End Sub + + Protected Overridable Sub FormDispose(ByVal sender As Object, _ + ByVal e As System.EventArgs) + + If Not (oJoystick Is Nothing) Then + oJoystick.Unacquire() + End If + + End Sub + + ReadOnly Property WorldRectangle() As Rectangle + Get + Return New Rectangle(0, 0, WID, HGT) + End Get + End Property + + 'override for better keyboard handling + Protected MustOverride Sub FormKeyDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.KeyEventArgs) + + 'override for better keyboard handling + Protected Overridable Sub FormKeyUp(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.KeyEventArgs) + + If e.KeyCode = Keys.Escape Then + FFrm.Close() + End If + End Sub + + Private Sub InitializeDirectDraw() + + Dim oSurfaceDesc As New SurfaceDescription + Dim oSurfaceCaps As New SurfaceCaps + Dim i As Integer + + oDraw = New Microsoft.DirectX.DirectDraw.Device + + oDraw.SetCooperativeLevel(FFrm, _ + Microsoft.DirectX.DirectDraw.CooperativeLevelFlags.FullscreenExclusive) + oDraw.SetDisplayMode(WID, HGT, 16, 0, False) + + With oSurfaceDesc + .SurfaceCaps.PrimarySurface = True + .SurfaceCaps.Flip = True + .SurfaceCaps.Complex = True + .BackBufferCount = 1 + oFront = New Surface(oSurfaceDesc, oDraw) + oSurfaceCaps.BackBuffer = True + oBack = oFront.GetAttachedSurface(oSurfaceCaps) + oBack.ForeColor = Color.White + .Clear() + End With + + FNeedToRestore = True + + End Sub + + Private Sub InitializeJoystick() + + Dim oInst As DeviceInstance + Dim oDOInst As DeviceObjectInstance + + 'get the first attached joystick + For Each oInst In Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly) + oJoystick = New Microsoft.DirectX.DirectInput.Device(oInst.InstanceGuid) + Exit For + Next + + If Not (oJoystick Is Nothing) Then + + oJoystick.SetDataFormat(DeviceDataFormat.Joystick) + oJoystick.SetCooperativeLevel(FFrm, _ + Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Exclusive Or _ + Microsoft.DirectX.DirectInput.CooperativeLevelFlags.Foreground) + + ' Set the numeric range for each axis to +/- 256. + For Each oDOInst In oJoystick.Objects + If 0 <> (oDOInst.ObjectId And CInt(DeviceObjectTypeFlags.Axis)) Then + + oJoystick.Properties.SetRange(ParameterHow.ById, _ + oDOInst.ObjectId, New InputRange(-256, +256)) + End If + Next + End If + End Sub + + 'override to set up your world objects + Protected MustOverride Sub InitializeWorld() + + 'override when bitmaps have to be reloaded + Protected Overridable Sub RestoreSurfaces() + oDraw.RestoreAllSurfaces() + End Sub + + 'clears back buffer to black. calls protected sub. flips back to front + Private Sub DrawFrame() + + If oFront Is Nothing Then Exit Sub + + If Not oDraw.TestCooperativeLevel() Then + FNeedToRestore = True + Return + End If + + If FNeedToRestore Then + RestoreSurfaces() + FNeedToRestore = False + End If + + oBack.ColorFill(0) + + DrawWorldWithinFrame() + + Try + oFront.Flip(oBack, FlipFlags.DoNotWait) + Catch oEX As Exception + Debug.WriteLine(oEX.Message) + Finally + Application.DoEvents() + End Try + + End Sub + + 'override. put all your drawing in here. + Protected Overridable Sub DrawWorldWithinFrame() + + Try + oBack.ForeColor = Color.White + oBack.DrawText(10, 10, "Press escape to exit", False) + Catch oEX As Exception + Debug.WriteLine(oEX.Message) + End Try + + End Sub + End Class + + Public Class dxSpaceRocks + Inherits dxWorld + + Private FShip As dxShipSprite + Private FRocks As dxRockCollection + Private FBullets As dxBulletCollection + + Private FLeftPressed As Boolean = False + Private FRightPressed As Boolean = False + Private FUpPressed As Boolean = False + Private FSpacePressed As Boolean = False + + Public Sub New(ByVal f As Form) + MyBase.New(f) + End Sub + + Protected Overrides Sub InitializeWorld() + + Dim oRand As New Random + + FShip = New dxShipSprite + FShip.Location = New PointF(100, 100) + FShip.Size = New Size(96, 96) + FShip.pShowBoundingBox = False + + FRocks = New dxRockCollection + FRocks.pShowBoundingBox = False + + FBullets = New dxBulletCollection + FBullets.pShowBoundingBox = False + + End Sub + + Protected Overrides Sub RestoreSurfaces() + MyBase.RestoreSurfaces() + + FShip.RestoreSurfaces(oDraw) + FRocks.RestoreSurfaces(oDraw) + FBullets.RestoreSurfaces(odraw) + + End Sub + + Protected Overrides Sub DrawWorldWithinFrame() + + Dim p As New Point((WID / 2) - 40, 10) + + MyBase.DrawWorldWithinFrame() + + 'joysticks don't generate events, so we update the ship + 'based on joystick state each turn + UpdateShipState() + + FShip.Move() + FRocks.Move() + FBullets.Move() + + FBullets.Draw(oBack) + FShip.Draw(oBack) + FRocks.Draw(oBack) + + FBullets.BreakRocks(FRocks) + + oBack.ForeColor = Color.White + Select Case FShip.Status + Case ShipStatus.ssAlive + oBack.DrawText(p.X, p.Y, "Lives Left: " & FShip.LivesLeft, False) + If FRocks.CollidingWith(FShip.WorldBoundingBox, bBreakRock:=False) Then + FShip.KillMe() + End If + + Case ShipStatus.ssDying + oBack.DrawText(p.X, p.Y, "Oops.", False) + + Case ShipStatus.ssDead + If FShip.LivesLeft = 0 Then + oBack.DrawText(p.X, p.Y, "Game Over", False) + Else + oBack.DrawText(p.X, p.Y, _ + "Hit SpaceBar to make ship appear in middle of screen", False) + End If + End Select + + End Sub + + Protected Overrides Sub FormKeyDown(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.KeyEventArgs) + + Select Case e.KeyCode + Case Keys.Left + FLeftPressed = True + Case Keys.Right + FRightPressed = True + Case Keys.Up + FUpPressed = True + Case Keys.Space + FSpacePressed = True + Case Keys.B + FShip.pShowBoundingBox = Not FShip.pShowBoundingBox + FRocks.pShowBoundingBox = Not FRocks.pShowBoundingBox + FBullets.pShowBoundingBox = Not FBullets.pShowBoundingBox + End Select + End Sub + + Protected Overrides Sub FormKeyUp(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.KeyEventArgs) + + MyBase.FormKeyUp(sender, e) + + Select Case e.KeyCode + Case Keys.Left + FLeftPressed = False + Case Keys.Right + FRightPressed = False + Case Keys.Up + FUpPressed = False + End Select + End Sub + + Private Sub UpdateShipState() + + Dim oState As New JoystickState + Dim bButtons As Byte() + Dim b As Byte + + Dim p As PointF + + If Not oJoystick Is Nothing Then + + Try + oJoystick.Poll() + + Catch oEX As InputException + If TypeOf oEX Is NotAcquiredException Or _ + TypeOf oEX Is InputLostException Then + + Try + ' Acquire the device. + oJoystick.Acquire() + Catch + Exit Sub + End Try + End If + End Try + + Try + oState = oJoystick.CurrentJoystickState + Catch + Exit Sub + End Try + + 'ship is turning if x axis movement + FShip.IsTurningRight = (oState.X > 100) Or FRightPressed + FShip.IsTurningLeft = (oState.X < -100) Or FLeftPressed + FShip.ThrustersOn = (oState.Y < -100) Or FUpPressed + + 'any button pushed on the joystick will work + bButtons = oState.GetButtons() + For Each b In bButtons + If (b And &H80) <> 0 Then + FSpacePressed = True + Exit For + End If + Next + + Else + FShip.IsTurningRight = FRightPressed + FShip.IsTurningLeft = FLeftPressed + FShip.ThrustersOn = FUpPressed + End If + + If FSpacePressed Then + Select Case FShip.Status + Case ShipStatus.ssDead + 'center screen + FShip.BringMeToLife(WID \ 2 - FShip.Size.Width \ 2, _ + HGT \ 2 - FShip.Size.Height \ 2) + Case ShipStatus.ssAlive + p = FShip.Center + p.X = p.X - 16 + p.Y = p.Y - 16 + + FBullets.Shoot(p, FShip.Angle) + End Select + FSpacePressed = False + End If + End Sub + End Class +End Namespace \ No newline at end of file diff --git a/Files/SpaceRocks/fMain.resx b/Files/SpaceRocks/fMain.resx new file mode 100644 index 0000000..1400b5a --- /dev/null +++ b/Files/SpaceRocks/fMain.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + fMain + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/SpaceRocks/fMain.vb b/Files/SpaceRocks/fMain.vb new file mode 100644 index 0000000..bbea0ec --- /dev/null +++ b/Files/SpaceRocks/fMain.vb @@ -0,0 +1,57 @@ + +Public Class fMain + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Private Sub InitializeComponent() + ' + 'fMain + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(292, 273) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None + Me.Name = "fMain" + Me.Text = "SpaceRocks" + Me.WindowState = System.Windows.Forms.FormWindowState.Maximized + + End Sub + +#End Region + Dim FWorld As dxWorld.dxWorld + + Private Sub fMain_Load(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles MyBase.Load + + FWorld = New dxWorld.dxSpaceRocks(Me) + + End Sub + +End Class diff --git a/Files/SpaceRocks/mSpaceRocks.vb b/Files/SpaceRocks/mSpaceRocks.vb new file mode 100644 index 0000000..57f242a --- /dev/null +++ b/Files/SpaceRocks/mSpaceRocks.vb @@ -0,0 +1,7 @@ +Module mSpaceRocks + + 'screen size + Public Const WID As Integer = 1024 + Public Const HGT As Integer = 768 + +End Module diff --git a/Files/SpaceRocks/obj/Debug/SpaceRocks.exe b/Files/SpaceRocks/obj/Debug/SpaceRocks.exe new file mode 100644 index 0000000..9f4aab2 Binary files /dev/null and b/Files/SpaceRocks/obj/Debug/SpaceRocks.exe differ diff --git a/Files/SpaceRocks/obj/Debug/SpaceRocks.fMain.resources b/Files/SpaceRocks/obj/Debug/SpaceRocks.fMain.resources new file mode 100644 index 0000000..66df0d9 Binary files /dev/null and b/Files/SpaceRocks/obj/Debug/SpaceRocks.fMain.resources differ diff --git a/Files/SpaceRocks/obj/Debug/SpaceRocks.pdb b/Files/SpaceRocks/obj/Debug/SpaceRocks.pdb new file mode 100644 index 0000000..c1267b7 Binary files /dev/null and b/Files/SpaceRocks/obj/Debug/SpaceRocks.pdb differ diff --git a/Files/ThreadParametersOne/AssemblyInfo.vb b/Files/ThreadParametersOne/AssemblyInfo.vb new file mode 100644 index 0000000..7170132 --- /dev/null +++ b/Files/ThreadParametersOne/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/ThreadParametersOne/Form1.resx b/Files/ThreadParametersOne/Form1.resx new file mode 100644 index 0000000..fa2015e --- /dev/null +++ b/Files/ThreadParametersOne/Form1.resx @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Form1 + + + Assembly + + \ No newline at end of file diff --git a/Files/ThreadParametersOne/Form1.vb b/Files/ThreadParametersOne/Form1.vb new file mode 100644 index 0000000..1d2c3b4 --- /dev/null +++ b/Files/ThreadParametersOne/Form1.vb @@ -0,0 +1,202 @@ +Imports System.Threading + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents lbOut As System.Windows.Forms.ListBox + Friend WithEvents cbGo As System.Windows.Forms.Button + Friend WithEvents tbNum As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents lbStatus As System.Windows.Forms.ListBox + Private Sub InitializeComponent() + Me.lbOut = New System.Windows.Forms.ListBox + Me.cbGo = New System.Windows.Forms.Button + Me.tbNum = New System.Windows.Forms.TextBox + Me.Label1 = New System.Windows.Forms.Label + Me.lbStatus = New System.Windows.Forms.ListBox + Me.SuspendLayout() + ' + 'lbOut + ' + Me.lbOut.Location = New System.Drawing.Point(8, 64) + Me.lbOut.Name = "lbOut" + Me.lbOut.Size = New System.Drawing.Size(192, 199) + Me.lbOut.TabIndex = 0 + ' + 'cbGo + ' + Me.cbGo.Location = New System.Drawing.Point(96, 32) + Me.cbGo.Name = "cbGo" + Me.cbGo.Size = New System.Drawing.Size(64, 23) + Me.cbGo.TabIndex = 1 + Me.cbGo.Text = "Go" + ' + 'tbNum + ' + Me.tbNum.Location = New System.Drawing.Point(16, 32) + Me.tbNum.Name = "tbNum" + Me.tbNum.Size = New System.Drawing.Size(72, 21) + Me.tbNum.TabIndex = 2 + Me.tbNum.Text = "10" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(8, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(176, 23) + Me.Label1.TabIndex = 3 + Me.Label1.Text = "number of threads to generate" + ' + 'lbStatus + ' + Me.lbStatus.Location = New System.Drawing.Point(208, 64) + Me.lbStatus.Name = "lbStatus" + Me.lbStatus.Size = New System.Drawing.Size(160, 199) + Me.lbStatus.TabIndex = 4 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(376, 273) + Me.Controls.Add(Me.lbStatus) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.tbNum) + Me.Controls.Add(Me.cbGo) + Me.Controls.Add(Me.lbOut) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.Text = "Threads" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub cbGo_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGo.Click + + Dim iNumOf As Integer + Dim iLoop As Integer + Dim FThreads As ArrayList + Dim oExec As MyThreadExecutor + + Cursor = Cursors.WaitCursor + lbOut.Items.Clear() + lbStatus.Items.Clear() + Application.DoEvents() + + Try + + Try + iNumOf = CInt(tbNum.Text) + Catch + iNumOf = 10 'default 10 + End Try + + FThreads = New ArrayList + For iLoop = 1 To iNumOf + oExec = New MyThreadExecutor("Thread" & iLoop, iLoop * 2, iLoop * 3) + AddHandler oExec.NotifyDone, AddressOf DoneNotification + FThreads.Add(oExec) + Next + + For Each oExec In FThreads + oExec.pThread.Start() + Next + + 'wait for each thread to finish + For Each oExec In FThreads + oExec.pThread.Join() + Next + + 'output the results + For Each oExec In FThreads + lbOut.Items.Add(oExec.pThread.Name & " generated value " & oExec.pReturnVal) + Next + + Finally + Cursor = Cursors.Default + End Try + + End Sub + + 'first try. not thread safe! + Public Sub DoneNotification(ByVal sender As Object) + lbStatus.Items.Add(CType(sender, MyThreadExecutor).pThread.Name & " is done") + End Sub + +End Class + +Public Delegate Sub AddListBoxDelegate(ByVal cThreadName As String) + +Public Class MyThreadExecutor + + Private FThread As Thread + Private FMin As Integer + Private FMax As Integer + Private FReturnVal As Integer + + Public Event NotifyDone(ByVal sender As Object) + + Public Sub New(ByVal n As String, ByVal iMin As Integer, ByVal iMax As Integer) + MyBase.New() + FMin = iMin + FMax = iMax + + FThread = New Thread(AddressOf RunMe) + FThread.Name = n + FThread.IsBackground = True + End Sub + + ReadOnly Property pThread() As Thread + Get + Return FThread + End Get + End Property + + ReadOnly Property pReturnVal() As Integer + Get + Return FReturnVal + End Get + End Property + + Private Sub RunMe() + + Dim oRand As New Random + + 'pause a random amount of time to simulate doing actual work + FThread.Sleep(oRand.Next(1, 4) * 1000) + FReturnVal = oRand.Next(FMin, FMax + 1) + + RaiseEvent NotifyDone(Me) + End Sub + +End Class \ No newline at end of file diff --git a/Files/ThreadParametersOne/ThreadParameters.sln b/Files/ThreadParametersOne/ThreadParameters.sln new file mode 100644 index 0000000..26d63c8 --- /dev/null +++ b/Files/ThreadParametersOne/ThreadParameters.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ThreadParameters", "ThreadParameters.vbproj", "{776129E7-B7BE-46F9-B220-29E5CD300E35}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Debug.ActiveCfg = Debug|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Debug.Build.0 = Debug|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Release.ActiveCfg = Release|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/ThreadParametersOne/ThreadParameters.suo b/Files/ThreadParametersOne/ThreadParameters.suo new file mode 100644 index 0000000..b9e8950 Binary files /dev/null and b/Files/ThreadParametersOne/ThreadParameters.suo differ diff --git a/Files/ThreadParametersOne/ThreadParameters.vbproj b/Files/ThreadParametersOne/ThreadParameters.vbproj new file mode 100644 index 0000000..7d233a4 --- /dev/null +++ b/Files/ThreadParametersOne/ThreadParameters.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/ThreadParametersOne/ThreadParameters.vbproj.user b/Files/ThreadParametersOne/ThreadParameters.vbproj.user new file mode 100644 index 0000000..77f7b49 --- /dev/null +++ b/Files/ThreadParametersOne/ThreadParameters.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/ThreadParametersOne/bin/ThreadParameters.exe b/Files/ThreadParametersOne/bin/ThreadParameters.exe new file mode 100644 index 0000000..e2f2560 Binary files /dev/null and b/Files/ThreadParametersOne/bin/ThreadParameters.exe differ diff --git a/Files/ThreadParametersOne/bin/ThreadParameters.pdb b/Files/ThreadParametersOne/bin/ThreadParameters.pdb new file mode 100644 index 0000000..7f4534a Binary files /dev/null and b/Files/ThreadParametersOne/bin/ThreadParameters.pdb differ diff --git a/Files/ThreadParametersOne/obj/Debug/ThreadParameters.Form1.resources b/Files/ThreadParametersOne/obj/Debug/ThreadParameters.Form1.resources new file mode 100644 index 0000000..706d853 Binary files /dev/null and b/Files/ThreadParametersOne/obj/Debug/ThreadParameters.Form1.resources differ diff --git a/Files/ThreadParametersOne/obj/Debug/ThreadParameters.exe b/Files/ThreadParametersOne/obj/Debug/ThreadParameters.exe new file mode 100644 index 0000000..e2f2560 Binary files /dev/null and b/Files/ThreadParametersOne/obj/Debug/ThreadParameters.exe differ diff --git a/Files/ThreadParametersOne/obj/Debug/ThreadParameters.pdb b/Files/ThreadParametersOne/obj/Debug/ThreadParameters.pdb new file mode 100644 index 0000000..7f4534a Binary files /dev/null and b/Files/ThreadParametersOne/obj/Debug/ThreadParameters.pdb differ diff --git a/Files/ThreadParametersThree/AssemblyInfo.vb b/Files/ThreadParametersThree/AssemblyInfo.vb new file mode 100644 index 0000000..7170132 --- /dev/null +++ b/Files/ThreadParametersThree/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/ThreadParametersThree/Form1.resx b/Files/ThreadParametersThree/Form1.resx new file mode 100644 index 0000000..a212f71 --- /dev/null +++ b/Files/ThreadParametersThree/Form1.resx @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + Form1 + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/ThreadParametersThree/Form1.vb b/Files/ThreadParametersThree/Form1.vb new file mode 100644 index 0000000..956f37e --- /dev/null +++ b/Files/ThreadParametersThree/Form1.vb @@ -0,0 +1,223 @@ +Imports System.Threading + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents lbOut As System.Windows.Forms.ListBox + Friend WithEvents cbGo As System.Windows.Forms.Button + Friend WithEvents tbNum As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents lbStatus As System.Windows.Forms.ListBox + Private Sub InitializeComponent() + Me.lbOut = New System.Windows.Forms.ListBox + Me.cbGo = New System.Windows.Forms.Button + Me.tbNum = New System.Windows.Forms.TextBox + Me.Label1 = New System.Windows.Forms.Label + Me.lbStatus = New System.Windows.Forms.ListBox + Me.SuspendLayout() + ' + 'lbOut + ' + Me.lbOut.Location = New System.Drawing.Point(8, 64) + Me.lbOut.Name = "lbOut" + Me.lbOut.Size = New System.Drawing.Size(192, 199) + Me.lbOut.TabIndex = 0 + ' + 'cbGo + ' + Me.cbGo.Location = New System.Drawing.Point(96, 32) + Me.cbGo.Name = "cbGo" + Me.cbGo.Size = New System.Drawing.Size(64, 23) + Me.cbGo.TabIndex = 1 + Me.cbGo.Text = "Go" + ' + 'tbNum + ' + Me.tbNum.Location = New System.Drawing.Point(16, 32) + Me.tbNum.Name = "tbNum" + Me.tbNum.Size = New System.Drawing.Size(72, 21) + Me.tbNum.TabIndex = 2 + Me.tbNum.Text = "10" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(8, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(176, 23) + Me.Label1.TabIndex = 3 + Me.Label1.Text = "number of threads to generate" + ' + 'lbStatus + ' + Me.lbStatus.Location = New System.Drawing.Point(208, 64) + Me.lbStatus.Name = "lbStatus" + Me.lbStatus.Size = New System.Drawing.Size(160, 199) + Me.lbStatus.TabIndex = 4 + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(376, 273) + Me.Controls.Add(Me.lbStatus) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.tbNum) + Me.Controls.Add(Me.cbGo) + Me.Controls.Add(Me.lbOut) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.Text = "Threads" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub cbGo_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGo.Click + + Dim iNumOf As Integer + Dim iLoop As Integer + Dim FThreads As ArrayList + Dim oExec As MyThreadExecutor + Dim bDone As Boolean + + Cursor = Cursors.WaitCursor + lbOut.Items.Clear() + lbStatus.Items.Clear() + Application.DoEvents() + + Try + + Try + iNumOf = CInt(tbNum.Text) + Catch + iNumOf = 10 'default 10 + End Try + + FThreads = New ArrayList + For iLoop = 1 To iNumOf + oExec = New MyThreadExecutor("Thread" & iLoop, iLoop * 2, iLoop * 3) + AddHandler oExec.NotifyDone, AddressOf DoneNotification + FThreads.Add(oExec) + Next + + For Each oExec In FThreads + oExec.pThread.Start() + Next + + 'wait for each thread to finish. can't use JOIN + bDone = False + Do While Not bDone + For Each oExec In FThreads + bDone = True + If oExec.pThread.IsAlive Then + bDone = False + End If + Application.DoEvents() + Next + Loop + + 'output the results + For Each oExec In FThreads + lbOut.Items.Add(oExec.pThread.Name & " generated value " & oExec.pReturnVal) + Next + + Finally + Cursor = Cursors.Default + End Try + + End Sub + + Public Delegate Sub AddListBoxDelegate(ByVal cThreadName As String) + + 'thread safe (but doesn't work in this program) + Public Sub DoneNotification(ByVal sender As Object) + + Dim oExec As MyThreadExecutor = CType(sender, MyThreadExecutor) + + If lbStatus.InvokeRequired Then + Dim oDel As New AddListBoxDelegate(AddressOf Me.AddListBoxValue) + lbStatus.Invoke(oDel, New Object(0) {oExec.pThread.Name}) + Else + AddListBoxValue(oExec.pThread.Name) + End If + End Sub + + Public Sub AddListBoxValue(ByVal cThreadName As String) + lbStatus.Items.Add(cThreadName & " is done") + End Sub + + +End Class + +Public Class MyThreadExecutor + + Private FThread As Thread + Private FMin As Integer + Private FMax As Integer + Private FReturnVal As Integer + + Public Event NotifyDone(ByVal sender As Object) + + Public Sub New(ByVal n As String, ByVal iMin As Integer, ByVal iMax As Integer) + MyBase.New() + FMin = iMin + FMax = iMax + + FThread = New Thread(AddressOf RunMe) + FThread.Name = n + FThread.IsBackground = True + End Sub + + ReadOnly Property pThread() As Thread + Get + Return FThread + End Get + End Property + + ReadOnly Property pReturnVal() As Integer + Get + Return FReturnVal + End Get + End Property + + Private Sub RunMe() + + Dim oRand As New Random + + 'pause a random amount of time to simulate doing actual work + FThread.Sleep(oRand.Next(1, 4) * 1000) + + FReturnVal = oRand.Next(FMin, FMax + 1) + RaiseEvent NotifyDone(Me) + End Sub + +End Class \ No newline at end of file diff --git a/Files/ThreadParametersThree/ThreadParameters.sln b/Files/ThreadParametersThree/ThreadParameters.sln new file mode 100644 index 0000000..26d63c8 --- /dev/null +++ b/Files/ThreadParametersThree/ThreadParameters.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ThreadParameters", "ThreadParameters.vbproj", "{776129E7-B7BE-46F9-B220-29E5CD300E35}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Debug.ActiveCfg = Debug|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Debug.Build.0 = Debug|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Release.ActiveCfg = Release|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/ThreadParametersThree/ThreadParameters.suo b/Files/ThreadParametersThree/ThreadParameters.suo new file mode 100644 index 0000000..d2e0dcd Binary files /dev/null and b/Files/ThreadParametersThree/ThreadParameters.suo differ diff --git a/Files/ThreadParametersThree/ThreadParameters.vbproj b/Files/ThreadParametersThree/ThreadParameters.vbproj new file mode 100644 index 0000000..7d233a4 --- /dev/null +++ b/Files/ThreadParametersThree/ThreadParameters.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/ThreadParametersThree/ThreadParameters.vbproj.user b/Files/ThreadParametersThree/ThreadParameters.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Files/ThreadParametersThree/ThreadParameters.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/ThreadParametersThree/bin/ThreadParameters.exe b/Files/ThreadParametersThree/bin/ThreadParameters.exe new file mode 100644 index 0000000..90d299a Binary files /dev/null and b/Files/ThreadParametersThree/bin/ThreadParameters.exe differ diff --git a/Files/ThreadParametersThree/bin/ThreadParameters.pdb b/Files/ThreadParametersThree/bin/ThreadParameters.pdb new file mode 100644 index 0000000..27963e0 Binary files /dev/null and b/Files/ThreadParametersThree/bin/ThreadParameters.pdb differ diff --git a/Files/ThreadParametersThree/obj/Debug/ThreadParameters.Form1.resources b/Files/ThreadParametersThree/obj/Debug/ThreadParameters.Form1.resources new file mode 100644 index 0000000..706d853 Binary files /dev/null and b/Files/ThreadParametersThree/obj/Debug/ThreadParameters.Form1.resources differ diff --git a/Files/ThreadParametersThree/obj/Debug/ThreadParameters.exe b/Files/ThreadParametersThree/obj/Debug/ThreadParameters.exe new file mode 100644 index 0000000..90d299a Binary files /dev/null and b/Files/ThreadParametersThree/obj/Debug/ThreadParameters.exe differ diff --git a/Files/ThreadParametersThree/obj/Debug/ThreadParameters.pdb b/Files/ThreadParametersThree/obj/Debug/ThreadParameters.pdb new file mode 100644 index 0000000..27963e0 Binary files /dev/null and b/Files/ThreadParametersThree/obj/Debug/ThreadParameters.pdb differ diff --git a/Files/ThreadParametersTwo (broken)/AssemblyInfo.vb b/Files/ThreadParametersTwo (broken)/AssemblyInfo.vb new file mode 100644 index 0000000..7170132 --- /dev/null +++ b/Files/ThreadParametersTwo (broken)/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/ThreadParametersTwo (broken)/Form1.resx b/Files/ThreadParametersTwo (broken)/Form1.resx new file mode 100644 index 0000000..a0775c9 --- /dev/null +++ b/Files/ThreadParametersTwo (broken)/Form1.resx @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + Assembly + + + False + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + + Form1 + + \ No newline at end of file diff --git a/Files/ThreadParametersTwo (broken)/Form1.vb b/Files/ThreadParametersTwo (broken)/Form1.vb new file mode 100644 index 0000000..6f8d0f9 --- /dev/null +++ b/Files/ThreadParametersTwo (broken)/Form1.vb @@ -0,0 +1,227 @@ +Imports System.Threading + +Public Class Form1 + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents lbOut As System.Windows.Forms.ListBox + Friend WithEvents cbGo As System.Windows.Forms.Button + Friend WithEvents tbNum As System.Windows.Forms.TextBox + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents lbStatus As System.Windows.Forms.ListBox + Friend WithEvents Label2 As System.Windows.Forms.Label + Private Sub InitializeComponent() + Me.lbOut = New System.Windows.Forms.ListBox + Me.cbGo = New System.Windows.Forms.Button + Me.tbNum = New System.Windows.Forms.TextBox + Me.Label1 = New System.Windows.Forms.Label + Me.lbStatus = New System.Windows.Forms.ListBox + Me.Label2 = New System.Windows.Forms.Label + Me.SuspendLayout() + ' + 'lbOut + ' + Me.lbOut.Location = New System.Drawing.Point(8, 64) + Me.lbOut.Name = "lbOut" + Me.lbOut.Size = New System.Drawing.Size(192, 199) + Me.lbOut.TabIndex = 0 + ' + 'cbGo + ' + Me.cbGo.Location = New System.Drawing.Point(96, 32) + Me.cbGo.Name = "cbGo" + Me.cbGo.Size = New System.Drawing.Size(64, 23) + Me.cbGo.TabIndex = 1 + Me.cbGo.Text = "Go" + ' + 'tbNum + ' + Me.tbNum.Location = New System.Drawing.Point(16, 32) + Me.tbNum.Name = "tbNum" + Me.tbNum.Size = New System.Drawing.Size(72, 21) + Me.tbNum.TabIndex = 2 + Me.tbNum.Text = "10" + ' + 'Label1 + ' + Me.Label1.Location = New System.Drawing.Point(8, 8) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(176, 23) + Me.Label1.TabIndex = 3 + Me.Label1.Text = "number of threads to generate" + ' + 'lbStatus + ' + Me.lbStatus.Location = New System.Drawing.Point(208, 64) + Me.lbStatus.Name = "lbStatus" + Me.lbStatus.Size = New System.Drawing.Size(160, 199) + Me.lbStatus.TabIndex = 4 + ' + 'Label2 + ' + Me.Label2.Location = New System.Drawing.Point(200, 8) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(168, 48) + Me.Label2.TabIndex = 5 + Me.Label2.Text = "NOTE: this sample program will hang when run. Read Chapter 9 for details" + Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'Form1 + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(376, 273) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.lbStatus) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.tbNum) + Me.Controls.Add(Me.cbGo) + Me.Controls.Add(Me.lbOut) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "Form1" + Me.Text = "Threads" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub cbGo_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbGo.Click + + Dim iNumOf As Integer + Dim iLoop As Integer + Dim FThreads As ArrayList + Dim oExec As MyThreadExecutor + + Cursor = Cursors.WaitCursor + lbOut.Items.Clear() + lbStatus.Items.Clear() + Application.DoEvents() + + Try + + Try + iNumOf = CInt(tbNum.Text) + Catch + iNumOf = 10 'default 10 + End Try + + FThreads = New ArrayList + For iLoop = 1 To iNumOf + oExec = New MyThreadExecutor("Thread" & iLoop, iLoop * 2, iLoop * 3) + AddHandler oExec.NotifyDone, AddressOf DoneNotification + FThreads.Add(oExec) + Next + + For Each oExec In FThreads + oExec.pThread.Start() + Next + + 'wait for each thread to finish + For Each oExec In FThreads + oExec.pThread.Join() + Next + + 'output the results + For Each oExec In FThreads + lbOut.Items.Add(oExec.pThread.Name & " generated value " & oExec.pReturnVal) + Next + + Finally + Cursor = Cursors.Default + End Try + + End Sub + + Public Delegate Sub AddListBoxDelegate(ByVal cThreadName As String) + + 'thread safe (but doesn't work in this program) + Public Sub DoneNotification(ByVal sender As Object) + + Dim oExec As MyThreadExecutor = CType(sender, MyThreadExecutor) + + If lbStatus.InvokeRequired Then + Dim oDel As New AddListBoxDelegate(AddressOf Me.AddListBoxValue) + lbStatus.Invoke(oDel, New Object(0) {oExec.pThread.Name}) + Else + AddListBoxValue(oExec.pThread.Name) + End If + End Sub + + Public Sub AddListBoxValue(ByVal cThreadName As String) + lbStatus.Items.Add(cThreadName & " is done") + End Sub + + +End Class + +Public Class MyThreadExecutor + + Private FThread As Thread + Private FMin As Integer + Private FMax As Integer + Private FReturnVal As Integer + + Public Event NotifyDone(ByVal sender As Object) + + Public Sub New(ByVal n As String, ByVal iMin As Integer, ByVal iMax As Integer) + MyBase.New() + FMin = iMin + FMax = iMax + + FThread = New Thread(AddressOf RunMe) + FThread.Name = n + FThread.IsBackground = True + End Sub + + ReadOnly Property pThread() As Thread + Get + Return FThread + End Get + End Property + + ReadOnly Property pReturnVal() As Integer + Get + Return FReturnVal + End Get + End Property + + Private Sub RunMe() + + Dim oRand As New Random + + 'pause a random amount of time to simulate doing actual work + FThread.Sleep(oRand.Next(1, 4) * 1000) + + FReturnVal = oRand.Next(FMin, FMax + 1) + RaiseEvent NotifyDone(Me) + End Sub + +End Class \ No newline at end of file diff --git a/Files/ThreadParametersTwo (broken)/ThreadParameters.sln b/Files/ThreadParametersTwo (broken)/ThreadParameters.sln new file mode 100644 index 0000000..26d63c8 --- /dev/null +++ b/Files/ThreadParametersTwo (broken)/ThreadParameters.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ThreadParameters", "ThreadParameters.vbproj", "{776129E7-B7BE-46F9-B220-29E5CD300E35}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Debug.ActiveCfg = Debug|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Debug.Build.0 = Debug|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Release.ActiveCfg = Release|.NET + {776129E7-B7BE-46F9-B220-29E5CD300E35}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/ThreadParametersTwo (broken)/ThreadParameters.suo b/Files/ThreadParametersTwo (broken)/ThreadParameters.suo new file mode 100644 index 0000000..a8c4de8 Binary files /dev/null and b/Files/ThreadParametersTwo (broken)/ThreadParameters.suo differ diff --git a/Files/ThreadParametersTwo (broken)/ThreadParameters.vbproj b/Files/ThreadParametersTwo (broken)/ThreadParameters.vbproj new file mode 100644 index 0000000..7d233a4 --- /dev/null +++ b/Files/ThreadParametersTwo (broken)/ThreadParameters.vbproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/ThreadParametersTwo (broken)/ThreadParameters.vbproj.user b/Files/ThreadParametersTwo (broken)/ThreadParameters.vbproj.user new file mode 100644 index 0000000..f27b75b --- /dev/null +++ b/Files/ThreadParametersTwo (broken)/ThreadParameters.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/ThreadParametersTwo (broken)/bin/ThreadParameters.exe b/Files/ThreadParametersTwo (broken)/bin/ThreadParameters.exe new file mode 100644 index 0000000..57ade56 Binary files /dev/null and b/Files/ThreadParametersTwo (broken)/bin/ThreadParameters.exe differ diff --git a/Files/ThreadParametersTwo (broken)/bin/ThreadParameters.pdb b/Files/ThreadParametersTwo (broken)/bin/ThreadParameters.pdb new file mode 100644 index 0000000..a161c7d Binary files /dev/null and b/Files/ThreadParametersTwo (broken)/bin/ThreadParameters.pdb differ diff --git a/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.Form1.resources b/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.Form1.resources new file mode 100644 index 0000000..54d1f50 Binary files /dev/null and b/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.Form1.resources differ diff --git a/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.exe b/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.exe new file mode 100644 index 0000000..57ade56 Binary files /dev/null and b/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.exe differ diff --git a/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.pdb b/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.pdb new file mode 100644 index 0000000..a161c7d Binary files /dev/null and b/Files/ThreadParametersTwo (broken)/obj/Debug/ThreadParameters.pdb differ diff --git a/Files/Yhatzee/AssemblyInfo.vb b/Files/Yhatzee/AssemblyInfo.vb new file mode 100644 index 0000000..d6d5c8c --- /dev/null +++ b/Files/Yhatzee/AssemblyInfo.vb @@ -0,0 +1,32 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + + + + + + + + + +'The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: + + diff --git a/Files/Yhatzee/Yhatzee.sln b/Files/Yhatzee/Yhatzee.sln new file mode 100644 index 0000000..c77e09b --- /dev/null +++ b/Files/Yhatzee/Yhatzee.sln @@ -0,0 +1,29 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "YhatzeeDotNet", "YhatzeeDotNet.vbproj", "{1146C7CA-297B-44CB-B41A-1E89EC64E1E3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DicePanelNew", "..\DicePanelNew\DicePanelNew.vbproj", "{3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1146C7CA-297B-44CB-B41A-1E89EC64E1E3}.Debug.ActiveCfg = Debug|.NET + {1146C7CA-297B-44CB-B41A-1E89EC64E1E3}.Debug.Build.0 = Debug|.NET + {1146C7CA-297B-44CB-B41A-1E89EC64E1E3}.Release.ActiveCfg = Release|.NET + {1146C7CA-297B-44CB-B41A-1E89EC64E1E3}.Release.Build.0 = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.ActiveCfg = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Debug.Build.0 = Debug|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.ActiveCfg = Release|.NET + {3DDC0E97-AFDA-4DDA-8EE8-760A2710F14C}.Release.Build.0 = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Files/Yhatzee/Yhatzee.suo b/Files/Yhatzee/Yhatzee.suo new file mode 100644 index 0000000..96442ac Binary files /dev/null and b/Files/Yhatzee/Yhatzee.suo differ diff --git a/Files/Yhatzee/YhatzeeDotNet.vbproj b/Files/Yhatzee/YhatzeeDotNet.vbproj new file mode 100644 index 0000000..c1a72c8 --- /dev/null +++ b/Files/Yhatzee/YhatzeeDotNet.vbproj @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Files/Yhatzee/YhatzeeDotNet.vbproj.user b/Files/Yhatzee/YhatzeeDotNet.vbproj.user new file mode 100644 index 0000000..dd623fa --- /dev/null +++ b/Files/Yhatzee/YhatzeeDotNet.vbproj.user @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/Files/Yhatzee/bin/DicePanelNew.dll b/Files/Yhatzee/bin/DicePanelNew.dll new file mode 100644 index 0000000..f2b80ea Binary files /dev/null and b/Files/Yhatzee/bin/DicePanelNew.dll differ diff --git a/Files/Yhatzee/bin/DicePanelNew.pdb b/Files/Yhatzee/bin/DicePanelNew.pdb new file mode 100644 index 0000000..6f77a79 Binary files /dev/null and b/Files/Yhatzee/bin/DicePanelNew.pdb differ diff --git a/Files/Yhatzee/bin/YhatzeeDotNet.exe b/Files/Yhatzee/bin/YhatzeeDotNet.exe new file mode 100644 index 0000000..2b92830 Binary files /dev/null and b/Files/Yhatzee/bin/YhatzeeDotNet.exe differ diff --git a/Files/Yhatzee/bin/YhatzeeDotNet.pdb b/Files/Yhatzee/bin/YhatzeeDotNet.pdb new file mode 100644 index 0000000..73a97b5 Binary files /dev/null and b/Files/Yhatzee/bin/YhatzeeDotNet.pdb differ diff --git a/Files/Yhatzee/fYhatzee.resx b/Files/Yhatzee/fYhatzee.resx new file mode 100644 index 0000000..6e3f72e --- /dev/null +++ b/Files/Yhatzee/fYhatzee.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + Assembly + + + Assembly + + + False + + + Assembly + + + Assembly + + + False + + + (Default) + + + False + + + fYhatzee + + + False + + + 8, 8 + + + True + + + 80 + + + True + + + Assembly + + \ No newline at end of file diff --git a/Files/Yhatzee/fYhatzee.vb b/Files/Yhatzee/fYhatzee.vb new file mode 100644 index 0000000..86831de --- /dev/null +++ b/Files/Yhatzee/fYhatzee.vb @@ -0,0 +1,489 @@ +Imports System.Drawing.Text +Imports System.Drawing.Drawing2D + +Public Enum YhatzeeScoreType + ystNumber = 0 + ystKind = 1 + ystFullHouse = 2 + ystSmallStraight = 3 + ystLargeStraight = 4 + ystYhatzee = 5 + ystChance = 6 +End Enum + +Public Class fYhatzee + Inherits System.Windows.Forms.Form + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents cbRoll As System.Windows.Forms.Button + Friend WithEvents cbNewGame As System.Windows.Forms.Button + Private Sub InitializeComponent() + Me.cbRoll = New System.Windows.Forms.Button + Me.cbNewGame = New System.Windows.Forms.Button + Me.SuspendLayout() + ' + 'cbRoll + ' + Me.cbRoll.Location = New System.Drawing.Point(192, 8) + Me.cbRoll.Name = "cbRoll" + Me.cbRoll.TabIndex = 0 + Me.cbRoll.Text = "Roll #1" + ' + 'cbNewGame + ' + Me.cbNewGame.Location = New System.Drawing.Point(8, 8) + Me.cbNewGame.Name = "cbNewGame" + Me.cbNewGame.TabIndex = 1 + Me.cbNewGame.Text = "Start Game" + ' + 'fYhatzee + ' + Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14) + Me.ClientSize = New System.Drawing.Size(536, 437) + Me.Controls.Add(Me.cbNewGame) + Me.Controls.Add(Me.cbRoll) + Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D + Me.Name = "fYhatzee" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Yhatzee" + Me.ResumeLayout(False) + + End Sub + +#End Region + + Dim p As DicePanelNew.DicePanelNew.DicePanelNew + Dim oRand As Random + Dim oWav As WavLibrary + + Private FRoll As Integer + Private lbTotal As AALabel + + Private Sub FormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + p = New DicePanelNew.DicePanelNew.DicePanelNew + p.Dock = DockStyle.Right + p.Width = 260 + p.Visible = True + AddHandler p.DieBounced, AddressOf DiePanelDieBounced + AddHandler p.DieFrozen, AddressOf DiePanelDieFrozen + Me.Controls.Add(p) + + Call SetupWavLibrary() + oRand = New Random + + p.ClickToFreeze = True + p.NumDice = 5 + + Call MakeLabels() + End Sub + + Private Sub fYhatActivated(ByVal sender As Object, _ + ByVal e As System.EventArgs) Handles MyBase.Activated + + Static bDoneOnce As Boolean = False + + If Not bDoneOnce Then + bDoneOnce = True + StartGame() + End If + + End Sub + + Private Sub SetupWavLibrary() + + oWav = New WavLibrary + oWav.LoadFromResource("YhatzeeDotNet.die1.wav", "die1") + oWav.LoadFromResource("YhatzeeDotNet.die2.wav", "die2") + oWav.LoadFromResource("YhatzeeDotNet.ouch.wav", "ouch") + oWav.LoadFromResource("YhatzeeDotNet.applause.wav", "applause") + + End Sub + + + Private Sub StartGame() + + Dim o As Control + + cbNewGame.Visible = False + For Each o In Me.Controls + If TypeOf o Is AAYhatzeeScoreLabel Then + With CType(o, AAYhatzeeScoreLabel) + .Text = "" + .ScoreAssigned = False + End With + End If + Next + p.ClearFreeze() + Call CalcTotal() + pRoll = 1 + DoTheRoll() + End Sub + + Private Sub CalcTotal() + + Dim o As Control + Dim iTot As Integer = 0 + + For Each o In Me.Controls + If TypeOf o Is AAYhatzeeScoreLabel Then + With CType(o, AAYhatzeeScoreLabel) + If .ScoreAssigned Then + iTot += CInt(.Text) + End If + End With + End If + Next + + lbTotal.Text = iTot + End Sub + + ReadOnly Property AllBoxesFilled() As Boolean + Get + Dim o As Control + + For Each o In Me.Controls + If TypeOf o Is AAYhatzeeScoreLabel Then + With CType(o, AAYhatzeeScoreLabel) + If Not .ScoreAssigned Then + Return False + End If + End With + End If + Next + + Return True + End Get + End Property + + Private Sub DoTheRoll() + cbRoll.Visible = False + Cursor = Cursors.WaitCursor + Try + p.RollDice() + Finally + cbRoll.Visible = True + Cursor = Cursors.Default + End Try + End Sub + + Property pRoll() As Integer + Get + Return FRoll + End Get + Set(ByVal Value As Integer) + If Value < 1 Or Value > 3 Then + Throw New Exception("Valid Roll Values 1-3") + End If + FRoll = Value + cbRoll.Visible = FRoll < 3 + cbRoll.Text = "Roll #" & FRoll + 1 + End Set + End Property + + 'creates the anti-aliased labels + Private Sub MakeLabels() + + Dim lbA As AALabel + Dim lbY As AAYhatzeeScoreLabel + Dim f As Font + Dim y As Integer = 56 + Dim i As Integer + + f = New Font("Tahoma", 12, FontStyle.Bold Or FontStyle.Italic, GraphicsUnit.Point) + For i = 1 To 13 + lbA = New AALabel + With lbA + .BackColor = Color.Transparent + .ForeColor = Color.White + .Font = f + .Location = New Point(8, y) + .Size = New Size(148, 23) + .TextAlign = ContentAlignment.TopCenter + Select Case i + Case 1 + .Text = "Ones" + Case 2 + .Text = "Twos" + Case 3 + .Text = "Threes" + Case 4 + .Text = "Fours" + Case 5 + .Text = "Fives" + Case 6 + .Text = "Sixes" + Case 7 + .Text = "Three of a Kind" + Case 8 + .Text = "Four of a Kind" + Case 9 + .Text = "Full House" + Case 10 + .Text = "Small Straight" + Case 11 + .Text = "Large Straight" + Case 12 + .Text = "Yhatzee (!)" + Case 13 + .Text = "Chance" + End Select + End With + Me.Controls.Add(lbA) + + lbY = New AAYhatzeeScoreLabel + With lbY + .Font = f + .Location = New Point(164, y) + AddHandler lbY.MouseEnter, AddressOf MouseEnterLabel + AddHandler lbY.MouseLeave, AddressOf MouseLeaveLabel + AddHandler lbY.MouseDown, AddressOf MouseDownLabel + + Select Case i + Case 1, 2, 3, 4, 5, 6 + .ScoreType = YhatzeeScoreType.ystNumber + .ScoreValue = i + Case 7 + .ScoreType = YhatzeeScoreType.ystKind + .ScoreValue = 3 + Case 8 + .ScoreType = YhatzeeScoreType.ystKind + .ScoreValue = 4 + Case 9 + .ScoreType = YhatzeeScoreType.ystFullHouse + Case 10 + .ScoreType = YhatzeeScoreType.ystSmallStraight + Case 11 + .ScoreType = YhatzeeScoreType.ystLargeStraight + Case 12 + .ScoreType = YhatzeeScoreType.ystYhatzee + Case 13 + .ScoreType = YhatzeeScoreType.ystChance + End Select + End With + Me.Controls.Add(lbY) + + y += 24 + Next + + lbTotal = New AALabel + With lbTotal + .Font = f + .Location = New Point(164 - 36, y) + .BackColor = Color.LightBlue + .ForeColor = Color.Black + .Size = New Size(72, 23) + .TextAlign = ContentAlignment.TopRight + .BorderStyle = BorderStyle.FixedSingle + End With + Me.Controls.Add(lbTotal) + End Sub + + Private Sub cbRollClick(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbRoll.Click + + DoTheRoll() + pRoll += 1 + End Sub + + Private Sub MouseEnterLabel(ByVal sender As Object, ByVal e As System.EventArgs) + + 'do nothing if we're rolling + If Not p.AllDiceStopped Then Exit Sub + + Dim lb As AAYhatzeeScoreLabel = CType(sender, Label) + With lb + If Not .ScoreAssigned Then + Select Case .ScoreType + Case YhatzeeScoreType.ystNumber + .Text = p.YhatzeeNumberScore(CInt(.ScoreValue)) + Case YhatzeeScoreType.ystKind + .Text = p.YhatzeeeOfAKindScore(.ScoreValue) + Case YhatzeeScoreType.ystFullHouse + .Text = p.YhatzeeeFullHouseScore + Case YhatzeeScoreType.ystSmallStraight + .Text = p.YhatzeeeSmallStraightScore + Case YhatzeeScoreType.ystLargeStraight + .Text = p.YhatzeeeLargeStraightScore + Case YhatzeeScoreType.ystChance + .Text = p.YhatzeeeChanceScore + Case YhatzeeScoreType.ystYhatzee + .Text = p.YhatzeeeFiveOfAKindScore + End Select + + End If + End With + + End Sub + + Private Sub MouseDownLabel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) + + 'do nothing if we're rolling + If Not p.AllDiceStopped Then Exit Sub + + Dim lb As AAYhatzeeScoreLabel = CType(sender, Label) + With lb + If Not .ScoreAssigned Then + .ScoreAssigned = True + + If CInt(.Text) = 0 Then + oWav.PlaySynchronous("ouch") + Else + oWav.PlaySynchronous("applause") + End If + + Call CalcTotal() + If AllBoxesFilled() Then + cbNewGame.Visible = True + cbRoll.Visible = False + Else + p.ClearFreeze() + DoTheRoll() + pRoll = 1 + End If + End If + End With + + End Sub + + Private Sub MouseLeaveLabel(ByVal sender As Object, ByVal e As System.EventArgs) + + Dim lb As AAYhatzeeScoreLabel = CType(sender, Label) + With lb + If Not .ScoreAssigned Then + .Text = "" + End If + End With + + End Sub + + Private Sub cbNewGame_Click(ByVal sender As System.Object, _ + ByVal e As System.EventArgs) Handles cbNewGame.Click + + Call StartGame() + End Sub + + Private Sub DiePanelDieBounced() + + If oRand.Next(100) Mod 2 = 0 Then + oWav.Play("die1") + Else + oWav.Play("die2") + End If + + End Sub + + Private Sub DiePanelDieFrozen(ByVal bUnfreeze As Boolean) + + If bUnfreeze Then + oWav.Play("die1") + Else + oWav.Play("die2") + End If + + End Sub + + + Private Sub fYhatzee_Disposed(ByVal sender As Object, _ + ByVal e As System.EventArgs) Handles MyBase.Disposed + + oWav.Dispose() + End Sub + + Private Sub fYhatzee_Paint(ByVal sender As Object, _ + ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint + + Dim b As LinearGradientBrush + + b = New LinearGradientBrush(ClientRectangle, _ + Color.Red, Color.Black, LinearGradientMode.Vertical) + + e.Graphics.FillRectangle(b, ClientRectangle) + End Sub +End Class + + +Public Class AALabel + Inherits Label + + Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) + e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias + MyBase.OnPaint(e) + End Sub +End Class + +'the label that controls score +Public Class AAYhatzeeScoreLabel + Inherits AALabel + + Public Sub New() + MyBase.New() + + 'defaults + BackColor = Color.LightBlue + ForeColor = Color.Black + Size = New Size(36, 23) + TextAlign = ContentAlignment.TopCenter + BorderStyle = BorderStyle.FixedSingle + + End Sub + + Private FScoreType As YhatzeeScoreType + Property ScoreType() As YhatzeeScoreType + Get + Return FScoreType + End Get + Set(ByVal Value As YhatzeeScoreType) + FScoreType = Value + End Set + End Property + + Private FScoreValue As Integer + Property ScoreValue() As Integer + Get + Return FScoreValue + End Get + Set(ByVal Value As Integer) + FScoreValue = Value + End Set + End Property + + Private FScoreAssigned As Boolean = False + Property ScoreAssigned() As Boolean + Get + Return FScoreAssigned + End Get + Set(ByVal Value As Boolean) + FScoreAssigned = Value + End Set + End Property + +End Class \ No newline at end of file diff --git a/Files/Yhatzee/obj/Debug/Nothing.exe b/Files/Yhatzee/obj/Debug/Nothing.exe new file mode 100644 index 0000000..0021855 Binary files /dev/null and b/Files/Yhatzee/obj/Debug/Nothing.exe differ diff --git a/Files/Yhatzee/obj/Debug/Nothing.pdb b/Files/Yhatzee/obj/Debug/Nothing.pdb new file mode 100644 index 0000000..8ce50ff Binary files /dev/null and b/Files/Yhatzee/obj/Debug/Nothing.pdb differ diff --git a/Files/Yhatzee/obj/Debug/YhatzeeDotNet.exe b/Files/Yhatzee/obj/Debug/YhatzeeDotNet.exe new file mode 100644 index 0000000..2b92830 Binary files /dev/null and b/Files/Yhatzee/obj/Debug/YhatzeeDotNet.exe differ diff --git a/Files/Yhatzee/obj/Debug/YhatzeeDotNet.fYhatzee.resources b/Files/Yhatzee/obj/Debug/YhatzeeDotNet.fYhatzee.resources new file mode 100644 index 0000000..8364ee2 Binary files /dev/null and b/Files/Yhatzee/obj/Debug/YhatzeeDotNet.fYhatzee.resources differ diff --git a/Files/Yhatzee/obj/Debug/YhatzeeDotNet.pdb b/Files/Yhatzee/obj/Debug/YhatzeeDotNet.pdb new file mode 100644 index 0000000..73a97b5 Binary files /dev/null and b/Files/Yhatzee/obj/Debug/YhatzeeDotNet.pdb differ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..148a76f --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Freeware License, some rights reserved + +Copyright (c) 2003 Matthew Tagliaferri + +Permission is hereby granted, free of charge, to anyone obtaining a copy +of this software and associated documentation files (the "Software"), +to work with the Software within the limits of freeware distribution and fair use. +This includes the rights to use, copy, and modify the Software for personal use. +Users are also allowed and encouraged to submit corrections and modifications +to the Software for the benefit of other users. + +It is not allowed to reuse, modify, or redistribute the Software for +commercial use in any way, or for a user’s educational materials such as books +or blog articles without prior permission from the copyright holder. + +The above copyright notice and this permission notice need to be included +in all copies or substantial portions of the software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..916f285 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +#Apress Source Code + +This repository accompanies [*Learn VB .NET Through Game Programming*](http://www.apress.com/9781590591147) by Matthew Tagliaferri (Apress, 2003). + +![Cover image](9781590591147.jpg) + +Download the files as a zip using the green button, or clone the repository to your machine using Git. + +##Releases + +Release v1.0 corresponds to the code in the published book, without corrections or updates. + +##Contributions + +See the file Contributing.md for more information on how you can contribute to this repository. diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..f6005ad --- /dev/null +++ b/contributing.md @@ -0,0 +1,14 @@ +# Contributing to Apress Source Code + +Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers. + +## How to Contribute + +1. Make sure you have a GitHub account. +2. Fork the repository for the relevant book. +3. Create a new branch on which to make your change, e.g. +`git checkout -b my_code_contribution` +4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted. +5. Submit a pull request. + +Thank you for your contribution! \ No newline at end of file