Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --pastebin get 5Www9BPT gen
- term.clear()
- local prompt = function(txt)
- term.setTextColor(colors.yellow)
- write(txt..": ")
- term.setTextColor(colors.white)
- return read()
- end
- while true do
- local g1 = prompt("genotype 1"):sub(1,2)
- local g2 = prompt("genotype 2"):sub(1,2)
- term.clear()
- local grid = {
- {g1:sub(1,1)..g2:sub(1,1),g1:sub(2,2)..g2:sub(1,1)},
- {g1:sub(1,1)..g2:sub(2,2),g1:sub(2,2)..g2:sub(2,2)},
- }
- local displayGrid = function(g)
- print(" "..g1:sub(1,1).." "..g1:sub(2,2).." ")
- print("")
- print(" ###########")
- print(" # # #")
- print(" "..g2:sub(1,1).." # "..g[1][1].." # "..g[1][2].." #")
- print(" # # #")
- print(" ###########")
- print(" # # #")
- print(" "..g2:sub(2,2).." # "..g[2][1].." # "..g[2][2].." #")
- print(" # # #")
- print(" ###########")
- local domAmnt = 0
- local XX,Xx,xx = 0, 0, 0
- for a = 1, #g do
- for b = 1, #g do
- if g[a][b]:find(g[a][b]:sub(1,1):upper()) then
- domAmnt = domAmnt + 1
- end
- if g[a][b] == (g[a][b]:sub(1,1):lower())..(g[a][b]:sub(1,1):lower()) then
- xx = xx + 1
- elseif g[a][b] == (g[a][b]:sub(1,1):upper())..(g[a][b]:sub(1,1):lower()) then
- Xx = Xx + 1
- elseif g[a][b] == (g[a][b]:sub(1,1):lower())..(g[a][b]:sub(1,1):upper()) then
- Xx = Xx + 1
- elseif g[a][b] == (g[a][b]:sub(1,1):upper())..(g[a][b]:sub(1,1):upper()) then
- XX = XX + 1
- end
- end
- end
- print("Pheno Ratio: "..domAmnt..":"..(4-domAmnt).." ("..(domAmnt/4)..")")
- print("Geno. Ratio: "..XX..":"..Xx..":"..xx)
- print("")
- end
- displayGrid(grid)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement