Two Plus Two Poker Forums

Two Plus Two Poker Forums (https://forumserver.twoplustwo.com/)
-   Computer and Technical Help (https://forumserver.twoplustwo.com/48/computer-technical-help/)
-   -   Python Project: Binary Adding Machine (https://forumserver.twoplustwo.com/48/computer-technical-help/python-project-binary-adding-machine-1222464/)

daveT 08-06-2012 10:26 PM

Re: Python Project: Binary Adding Machine
 
*bump* Anyone making progress?

cyberfish 08-07-2012 08:36 AM

Re: Python Project: Binary Adding Machine
 
I'll finish my project in a few weeks (not enough time atm) and if someone is interested I could provide a github-link to source.
Atm I coded what I described in my prev. post (I found a better way to update circuit-state).
To do: add javadoc, gui, handle exceptions, check for loops, ...
And last but not least create the binary adding machine, but it should be possible to simulate any kind of digital circuit.

cyberfish 08-21-2012 08:09 AM

Re: Python Project: Binary Adding Machine
 
I'll give the github-link to my java-source files:
https://github.com/L8Fish/Circuits

This is not finished at all, the code in the initial commits illustrates how I approached the problem. I coded it in a short amount of time.
I made the commits also to experiment with git (which is new to me).

Now I plan to pick it up again and tune/expand the code until it becomes a decent project including javadoc, gui, ... .

I would appreciate any comments.

daveT 08-22-2012 01:25 AM

Re: Python Project: Binary Adding Machine
 
Wow. I just downloaded and stared at the java code and it all looks Herculean, thus I am afraid to ask how I can run it...

I mean, I know how to run java code, but I don't know what file to start with.

Nice work. I feel really lazy after looking at it. Hopefully someone here can review the work and give you some suggestions. I don't know any Java, so I have nothing to say but nice work.

cyberfish 08-22-2012 05:04 AM

Re: Python Project: Binary Adding Machine
 
That's the reason why I need to do more of these projects:
Keep it well structured, ... and documented (not just make it work). I'm not satisfied with some implementations and javadoc has to be added.

But some quick info:
Component (interface)
Element (abstract class implements Component)
Wire (class implements Component)
Input, Logic, Output (abstract class extends Element)

InputAction, OutputAction (interface)

AndGate, OrGate, NotGate (class extends Logic)
Battery (class extends Input)
Light (class extends Output implements OutputAction)
Switch (class extends Logic implements InputAction)

Circuit

TestCircuit (method main)

Code:

the example:
batt0 --- switch0 --- not0 ---
                                           
                                            and0 --- light0                       
batt1 --- switch1 ---               
                                or0 ---
batt2 --- switch2 ---

test.makeAction(pos,act);//uses the switches
//pos = 3, 4 or 5
//act = 0 or 1
//instead of 3, 4 or 5 I should use the reference to the correct InputAction-object
//instead of 0 or 1 I should use a final variable


cyberfish 08-27-2012 05:35 PM

Re: Python Project: Binary Adding Machine
 
I've finished my binary adding machine. I can add 2 very large binary numbers by using a circuit with more than 1000 wires (prolly some redundant wires). I make use of flexible blackboxes (xor -> half adder -> full adder -> ripple adder).

I get my blackboxes from pre-coded blackboxes. I also implemented a system to create them on the fly but there's a bug in it which I cannot solve very quick. After I solve this I will commit the code to github. Still messy stuff but I will continue working on this. A test-class however could be used pretty straight-forward.


All times are GMT -4. The time now is 06:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.

Copyright © 2008-2020, Two Plus Two Interactive