Binary, Quaternary, Octal, Hexadecimal Simulation

written by Teresa Carrigan

Run model in your browser



Modify the model to show fixed point representation; that is, specify a given number of digits to the right of the decimal place. Exactly the same tricks are used in conversion.

Allow the user to input a starting digit pattern.

Allow the user to input a decimal number, and then display the corresponding digit pattern.

Display the decimal equivalent of the digit pattern.

Modify the model to demonstrate direct conversion between base 4 and base 16. Binary is not needed because sixteen is four squared.

Modify the model to demonstrate direct converstion between base 3 and base 9. Since nine is three squared, each base nine digit directly corresponds to two base three digits.



Instead of nested ifelse blocks, taking the log base two of each base was done using: set base-list [ 2 4 8 16 ] set group-by ( 1 + position to-base base-list)

setup-random uses similar list tricks to choose a to-base that is different from the from-base.

one-step uses the NetLogo run command combined with a global integer variable step to run the next step, without needing nested ifelse blocks.




Applets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.