Submit Your Article Forum Rules FAQ About Us
Search the forums:

Tech Support Team


Hello and Welcome to Tech Support Team! Before you can start posting and answering questions, you'll have to register. Registration is fast, simple and absolutely free! Feel free to browse through existing questions by choosing the forum you want to visit below.



Reply
  #1 (permalink)   Top
Old 1st November 2008, 07:47 PM
CJ1985's Avatar
TST Enthusiast
 
Join Date: Sep 2008, 295 posts.
Location: Michigan
Reputation: CJ1985 is on a distinguished road
Programming a game... help?

Okay, here's what the game is all about:

Long before personal computers, there was a company called E.S.R., Inc. that satisfied my desire to possess a computing device. They had three offerings: DR. NIM, DIGI-COMP I, and THINK-A-DOT. I owned them all, but my personal favorite was THINK-A-DOT. At the time it cost a mere $2.95, which was well within my monthly allowance. I recently saw one selling on eBay for $120. Since I no longer own my original machine, and cannot afford to replace it, I would like you to build me a virtual THINK-A-DOT in Visual Basic.

As originally constructed, a marble could be dropped into one of three holes in the top of the machine. It would then percolate through the machine and come out a hole on the bottom left or right. This was to allow for two-person competition, and really was of no interest to me. As the marble percolated through the machine it caused any dot it passed to change color from yellow to blue, and from blue to yellow. The color of the dot also controlled whether the marble would fall to the left (yellow) or to the right (blue). This meant there were ten possible paths through the machine from top to bottom, flipping either two or three dots to their alternate colors along the way. The initial pattern could be reset at any time by tilting the machine to the left or right.

ThinkaDot.exe provides a working example, if the following explanation is hard to understand. For your virtual machine, you will need some way to reset all the dots to yellow, some way to indicate the initial starting point of a virtual marble (left, middle, or right), and some way to represent the eight dots and change their color from yellow to blue or from blue to yellow. The logic is such that after changing a dot from yellow to blue, the next dot to be reversed is down and to the left. For a blue dot changing to yellow, the next dot to be reversed is down and to the right. A virtual marble dropping down the far left or far right side will only reverse two dots and not three. The folder, ThinkaDot, contains the start of a solution. It provides a picture of the machine, and a flipper control that can be dragged onto the picture just like any other control. The flipper control has a Boolean property, droppedLeft, that tells you the direction the ball fell; and two methods: flip that reverses the control, and reset.

A useful property of Think-a-Dot that can be used for testing, is that a marble dropped into any one of the three holes at the top, eight times in a row, will return the machine to the original pattern. Also, dropping a marble into each of the holes twice will return the machine to the original pattern.

(I can't upload the .exe file, it's not one of the acceptable uploads...)
There are two window forms... one called Flipper.vb and one called ThinkADot.vb

Here's the code from the ThinkADot.vb form
Code:
'Program:       ThinkaDot 3
'Programmer:    Glenn Cummings
'Date:          15 May 2006
'Description:   This project creates a virtual Think-a-Dot machine. In the original
'               machine, eight windows would alternately display a yellow dot or a
'               blue dot each time a marble passed through its underlying flipper. 
'               The placement of these flippers looked like this:
'
'                       flipper1                flipper2                flipper3
'
'
'                                   flipper4                flipper5
'
'
'                       flipper6                flipper7                flipper8
'
'               If the dot had been yellow, the marble would drop down and to the left;
'               if the dot had been blue, the marble would drop down and to the right. 
'               Each time a marble dropped, two or three flippers would change color.
'             
Public Class ThinkADot
    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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ThinkADot))
        Me.SuspendLayout()
        '
        'ThinkADot
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(544, 438)
        Me.MaximizeBox = False
        Me.Name = "ThinkADot"
        Me.Text = "ThinkADot"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub ThinkADot_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
Here's the code for the Flipper.vb form.

Code:
Public Class Flipper
    Inherits System.Windows.Forms.UserControl
    Private droppedLeftBoolean As Boolean = True

#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

    'UserControl 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 ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents Dot As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Flipper))
        Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
        Me.Dot = New System.Windows.Forms.Label
        Me.SuspendLayout()
        '
        'ImageList1
        '
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        Me.ImageList1.Images.SetKeyName(0, "")
        Me.ImageList1.Images.SetKeyName(1, "")
        '
        'Dot
        '
        Me.Dot.BackColor = System.Drawing.Color.White
        Me.Dot.ImageIndex = 0
        Me.Dot.ImageList = Me.ImageList1
        Me.Dot.Location = New System.Drawing.Point(0, 0)
        Me.Dot.Name = "Dot"
        Me.Dot.Size = New System.Drawing.Size(34, 34)
        Me.Dot.TabIndex = 0
        '
        'Flipper
        '
        Me.Controls.Add(Me.Dot)
        Me.Name = "Flipper"
        Me.Size = New System.Drawing.Size(34, 34)
        Me.ResumeLayout(False)

    End Sub

#End Region

    ReadOnly Property droppedLeft() As Boolean
        Get
            Return droppedLeftBoolean    'do flip before reading
        End Get
    End Property

    Public Sub flip()
        droppedLeftBoolean = Not droppedLeftBoolean
        Dot.ImageIndex = 1 - Dot.ImageIndex 'alternate dot color
    End Sub

    Public Sub reset()
        Dot.ImageIndex = 0            'reset image to yellow dot
        droppedLeftBoolean = True     'default direction
    End Sub

    Private Sub Dot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dot.Click

    End Sub
End Class
Now what I'm supposed to do is finish the coding for this, but I don't even know how to do that!!!! I'm so confused with this game or with the coding, and I've told this to the teacher numerous times and he doesn't seem to care!! *sighs*

Dudeking, ANY suggestions on this would be HIGHLY appreciated!!!!

Also I attached what the finish results should look like from the ThinkADot.exe file that the teacher had provided.
Attached Thumbnails
programming-game-help-thinkadot-screenshot.jpg  
__________________
"People think at the end of the day that a man is the only answer [to fulfillment]. Actually a job is better for me."
Princess Diana
Reply With Quote
  #2 (permalink)   Top
Old 1st November 2008, 11:16 PM
wladicus's Avatar
TST Expert
 
Join Date: Sep 2008, 846 posts.
Location: St. Thomas, Ontario, Canada
Reputation: wladicus is on a distinguished road
Nice Project CJ. Used to do a lot of programming but don't feel the urge that strongly any more after over 20 years at it. I found a 'cheesy' DOS version called THINKDOT.exe
If you want to download it, it is at this link: LOGICAL GAMES AND PUZZLES
Go to the bottom of the page and download logic3.exe and when you run that it self extracts about 4 games, one of which is THINKDOT.exe
*** Here is a better version that you can play online: Think-a-Dot
A more complicated version is found at ThinkADot&reg Home Page which is actually 'www.thinkadot.com'
__________________
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
joy,

walt
St. Thomas, Ontario, Canada = 42.77°N, 81.11°W =
That which appears to be without lies within...wladicus
->http://wladicus.blogspot.com/

Last edited by wladicus; 1st November 2008 at 11:27 PM. Reason: Modus operandi
Reply With Quote
  #3 (permalink)   Top
Old 1st November 2008, 11:32 PM
wladicus's Avatar
TST Expert
 
Join Date: Sep 2008, 846 posts.
Location: St. Thomas, Ontario, Canada
Reputation: wladicus is on a distinguished road
The following link discusses the gaming theory for various solutions in this game (helpful in understanding the programming) --> Think-a-Dot
Here is a JavaScript version of the original toy game. --> JavaScript Think-a-Dot
__________________
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
joy,

walt
St. Thomas, Ontario, Canada = 42.77°N, 81.11°W =
That which appears to be without lies within...wladicus
->http://wladicus.blogspot.com/

Last edited by wladicus; 1st November 2008 at 11:37 PM.
Reply With Quote
  #4 (permalink)   Top
Old 1st November 2008, 11:59 PM
wladicus's Avatar
TST Expert
 
Join Date: Sep 2008, 846 posts.
Location: St. Thomas, Ontario, Canada
Reputation: wladicus is on a distinguished road
This version seems to be the closest to your original --> Scratch | Project | Think-A-Dot
__________________
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
joy,

walt
St. Thomas, Ontario, Canada = 42.77°N, 81.11°W =
That which appears to be without lies within...wladicus
->http://wladicus.blogspot.com/
Reply With Quote
  #5 (permalink)   Top
Old 2nd November 2008, 01:15 AM
CJ1985's Avatar
TST Enthusiast
 
Join Date: Sep 2008, 295 posts.
Location: Michigan
Reputation: CJ1985 is on a distinguished road
THANK YOU SO MUCH WALT! (sorry for the caps)

I've been trying to figure out how to do it. I've searched all over online for this, how in the world did you find it? LOL
__________________
"People think at the end of the day that a man is the only answer [to fulfillment]. Actually a job is better for me."
Princess Diana
Reply With Quote
  #6 (permalink)   Top
Old 2nd November 2008, 01:19 AM
CJ1985's Avatar
TST Enthusiast
 
Join Date: Sep 2008, 295 posts.
Location: Michigan
Reputation: CJ1985 is on a distinguished road
The only problem is, the link that you gave me for the programming solution part in your second post is weird. lol
__________________
"People think at the end of the day that a man is the only answer [to fulfillment]. Actually a job is better for me."
Princess Diana
Reply With Quote
  #7 (permalink)   Top
Old 2nd November 2008, 03:44 PM
wladicus's Avatar
TST Expert
 
Join Date: Sep 2008, 846 posts.
Location: St. Thomas, Ontario, Canada
Reputation: wladicus is on a distinguished road
Quote:
Originally Posted by CJ1985 View Post
The only problem is, the link that you gave me for the programming solution part in your second post is weird. lol
CJ - The Think-a-Dot mechanical game (which you had) has lent itself to a lot of discussion in the mathematical & programming communities. It lends itself to something called 'Group Theory' and most programming requires the understanding of Boolean Logic (which is done with programming relying on Base 2 arithmetic) and also the Lisp programming language seems to be amongst the best-suited for exploring this theory to the fullest. I myself have not programmed in LISP before.

The other methods for making this game electronically is by building it using logic gates. Logic gates are circuits built with transistors that perform Boolean Logic mathematical functions. These circuits are built on microchips now-a-days. In the early days of computing vacuum tubes (diodes) were actually used, then transistors and now all is on microchips. In my study of electronics engineering technology I have designed and built many logic cicuits using Boolean Logic. The 'gates' used are named AND, NAND, OR and NOR depending upon the desired input/output function. The marvel of this particular game is that it was done by mechanical means rather than electronic means.

Sorry CJ, that is all I can tell you about this now. Maybe someone else will be able to give you something closer to what you are looking.

You can download a Word Document discussing the Think-a-Dot Group theory at this link -> http://www.google.ca/url?sa=t&source...n0hMMfW0KXOSnw
or view the HTML document at this link --> GROUP THEORY UNIT: TD
__________________
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
joy,

walt
St. Thomas, Ontario, Canada = 42.77°N, 81.11°W =
That which appears to be without lies within...wladicus
->http://wladicus.blogspot.com/

Last edited by wladicus; 2nd November 2008 at 03:51 PM. Reason: Modus operandi
Reply With Quote
Reply

Only registered members can participate in forum threads. You must register or log in to contribute.


Thread Tools

Forum Jump


All times are GMT. The time now is 01:53 PM.






Post A Question!
Useful Links
Main Menu
Home
Forum Rules
FAQ
About Us
Welcome Pack
Search the forums
TST Mobile
Contact Us
Send Message

These are the 8 most used thread tags
Tag Cloud
geforce modem monitor no ring response no signal nvidia soft modem win7