-module(gues).
-export([start/0]).

start() ->
  Game_num = generate_num(),
  % io:format("Game_num: ~B~n", [Game_num]),
  player_turn(Game_num).

player_turn(Game_num) ->
  Player_num = get_player_input(),
  check_input(Game_num, Player_num).

generate_num() -> rand:uniform(50).

get_player_input() -> {ok, [Num|_]} = io:fread("number: ", "~d"), Num.

check_input(Game_num, Player_num) when Player_num == Game_num -> 
	io:format("You`re wiener! haha");

check_input(Game_num, Player_num) when Player_num > Game_num -> 
  io:format("~B > X ~n", [Player_num]),
  player_turn(Game_num);

check_input(Game_num, Player_num) when Player_num < Game_num -> 
  io:format("~B < X ~n", [Player_num]),
  player_turn(Game_num).

Изменить пасту