Giter VIP home page Giter VIP logo

flip-a-coin-golang's Introduction

Flip A Coin

Simple command-line tool made using GO

Monologue

I have a habit of flipping coin when I am unable to make decisions. Most of the time the heads represent the positive feeling or doing something and tails represent the negative feeling or not doing something. But, flipping the coin once and making decision based on that doesn't feel good. So my decision is always based on the frequency of heads and tails. Flipping a coin multiple time in google search is time consuming and most of the time I am in terminal. So I felt the need to make my own Flip A Coin command-line tool.

Usage

Clone the github repo in your local machine.

$ https://github.com/cruzelx/Flip-A-Coin-GOLANG

CD into the project directory.

$ cd <project-directory>

You can run the program in two different ways. For a single toss, run the program without any flags. For repeated toss, use -R flag with integer value as the repeat value

For single toss

$ go run main.go

For multiple toss

$ go run main.go -R 100

The coin is flipped 100 times and the aggregated result is printed in console.

If we are the same

Build a binary using build command.

$ go build

Make a bin directory at HOME

$ mkdir ${HOME}/bin

Copy flipacoin binary to ${HOME}/bin

$ cp <path-to-flipacoin-binary> ${HOME}/bin

Add following in shell config file. Eg, .bashrc or .zshrc

export PATH=${HOME}/bin

Refresh the terminal either by closing and reopening, or by using source command.

$ source ~/.zshrc

or

$ source ~/.bashrc

Flip a coin

$ flipacoin

Output: You have got a HEAD% or

$ flipacoin -R 40

Output: Total toss: 40, Heads: (18, 45%), Tails: (22, 55%)%

flip-a-coin-golang's People

Contributors

cruzelx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.